@@ -19,6 +19,27 @@ class MutexTest extends TestCase
1919
2020 protected Mutex $ mutex ;
2121
22+ protected function setUp (): void
23+ {
24+ $ this ->command = new class () extends Command
25+ {
26+ public int $ ran = 0 ;
27+
28+ public function handle (): int
29+ {
30+ ++$ this ->ran ;
31+
32+ return self ::SUCCESS ;
33+ }
34+ };
35+
36+ $ this ->mutex = m::mock (Mutex::class);
37+
38+ $ container = Container::getInstance ();
39+ $ container ->instance (Mutex::class, $ this ->mutex );
40+ $ this ->command ->setLaravel ($ container );
41+ }
42+
2243 public function testCanRunIsolatedCommandIfNotBlocked ()
2344 {
2445 $ this ->mutex ->shouldReceive ('create ' )
@@ -74,31 +95,10 @@ public function testCanRunCommandAgainNonAutomated()
7495 $ this ->assertEquals (1 , $ this ->command ->ran );
7596 }
7697
77- protected function setUp (): void
78- {
79- $ this ->command = new class extends Command
80- {
81- public int $ ran = 0 ;
82-
83- public function handle (): int
84- {
85- $ this ->ran ++;
86-
87- return self ::SUCCESS ;
88- }
89- };
90-
91- $ this ->mutex = m::mock (Mutex::class);
92-
93- $ container = Container::getInstance ();
94- $ container ->instance (Mutex::class, $ this ->mutex );
95- $ this ->command ->setLaravel ($ container );
96- }
97-
9898 protected function runCommand ($ withIsolated = true )
9999 {
100100 $ input = new ArrayInput (['-- ' . Options::ISOLATED => $ withIsolated ]);
101- $ output = new NullOutput ;
101+ $ output = new NullOutput () ;
102102
103103 $ this ->command ->run ($ input , $ output );
104104 }
0 commit comments