Skip to content

Commit 4f5ad69

Browse files
committed
Add missing test
1 parent f215615 commit 4f5ad69

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Craftzing\TestBench\Laravel\Constraint\Bus;
6+
7+
use Illuminate\Support\Facades\Bus;
8+
use LogicException;
9+
use Orchestra\Testbench\TestCase;
10+
use PHPUnit\Framework\Attributes\Test;
11+
12+
final class WithoutBusMiddlewareTest extends TestCase
13+
{
14+
use WithoutBusMiddleware;
15+
16+
#[Test]
17+
public function itCanRemoveBusMiddleware(): void
18+
{
19+
Bus::pipeThrough([
20+
fn (mixed $command, mixed $next): mixed => throw new LogicException('This should not happen'),
21+
]);
22+
23+
$this->setUpWithoutBusMiddleware();
24+
25+
$result = Bus::dispatch($this->invokableClass());
26+
27+
$this->assertEquals('handled', $result);
28+
}
29+
30+
private function invokableClass(): object
31+
{
32+
return new class {
33+
public function __invoke(): string
34+
{
35+
return 'handled';
36+
}
37+
};
38+
}
39+
}

0 commit comments

Comments
 (0)