File tree Expand file tree Collapse file tree 1 file changed +20
-20
lines changed Expand file tree Collapse file tree 1 file changed +20
-20
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,26 @@ class MutexTest extends TestCase
1919
2020 protected MutexService $ mutex ;
2121
22+ protected function setUp (): void
23+ {
24+ $ this ->command = new class extends Command {
25+ public int $ ran = 0 ;
26+
27+ public function handle (): int
28+ {
29+ ++$ this ->ran ;
30+
31+ return self ::SUCCESS ;
32+ }
33+ };
34+
35+ $ this ->mutex = m::mock (MutexService::class);
36+
37+ $ container = Container::getInstance ();
38+ $ container ->instance (MutexService::class, $ this ->mutex );
39+ $ this ->command ->setLaravel ($ container );
40+ }
41+
2242 public function testCanRunIsolatedCommandIfNotBlocked ()
2343 {
2444 $ this ->mutex ->shouldReceive ('create ' )
@@ -71,26 +91,6 @@ public function testCanRunCommandAgainNonAutomated()
7191 $ this ->assertEquals (1 , $ this ->command ->ran );
7292 }
7393
74- protected function setUp (): void
75- {
76- $ this ->command = new class extends Command {
77- public int $ ran = 0 ;
78-
79- public function handle (): int
80- {
81- ++$ this ->ran ;
82-
83- return self ::SUCCESS ;
84- }
85- };
86-
87- $ this ->mutex = m::mock (MutexService::class);
88-
89- $ container = Container::getInstance ();
90- $ container ->instance (MutexService::class, $ this ->mutex );
91- $ this ->command ->setLaravel ($ container );
92- }
93-
9494 protected function runCommand ($ withIsolated = true )
9595 {
9696 $ input = new ArrayInput (['-- ' . Options::Isolated => $ withIsolated ]);
You can’t perform that action at this time.
0 commit comments