File tree Expand file tree Collapse file tree 1 file changed +39
-0
lines changed
src/Laravel/Constraint/Bus Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Original file line number Diff line number Diff line change
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
+ }
You can’t perform that action at this time.
0 commit comments