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
19
19
20
20
protected MutexService $ mutex ;
21
21
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
+
22
42
public function testCanRunIsolatedCommandIfNotBlocked ()
23
43
{
24
44
$ this ->mutex ->shouldReceive ('create ' )
@@ -71,26 +91,6 @@ public function testCanRunCommandAgainNonAutomated()
71
91
$ this ->assertEquals (1 , $ this ->command ->ran );
72
92
}
73
93
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
-
94
94
protected function runCommand ($ withIsolated = true )
95
95
{
96
96
$ input = new ArrayInput (['-- ' . Options::Isolated => $ withIsolated ]);
You can’t perform that action at this time.
0 commit comments