File tree 3 files changed +8
-27
lines changed
3 files changed +8
-27
lines changed Original file line number Diff line number Diff line change @@ -127,20 +127,15 @@ protected function storeOperation(OneTimeOperationFile $operationFile): void
127
127
return ;
128
128
}
129
129
130
- Operation::storeOperation ($ operationFile ->getOperationName (), $ operationFile -> getClassObject ()-> isAsync ( ));
130
+ Operation::storeOperation ($ operationFile ->getOperationName (), $ this -> isAsyncMode ( $ operationFile ));
131
131
}
132
132
133
- protected function processOperation (OneTimeOperationFile $ operationInstance )
133
+ protected function processOperation (OneTimeOperationFile $ operationFile )
134
134
{
135
- $ operation = $ operationInstance ->getClassObject ();
136
-
137
- $ this ->forceAsync && $ operation ->setAsync ();
138
- $ this ->forceSync && $ operation ->setSync ();
139
-
140
- if ($ operation ->isAsync ()) {
141
- OneTimeOperationProcessJob::dispatch ($ operationInstance ->getOperationName ());
135
+ if ($ this ->isAsyncMode ($ operationFile )) {
136
+ OneTimeOperationProcessJob::dispatch ($ operationFile ->getOperationName ());
142
137
} else {
143
- OneTimeOperationProcessJob::dispatchSync ($ operationInstance ->getOperationName ());
138
+ OneTimeOperationProcessJob::dispatchSync ($ operationFile ->getOperationName ());
144
139
}
145
140
}
146
141
@@ -156,7 +151,7 @@ protected function displayTestmodeWarning(): void
156
151
}
157
152
}
158
153
159
- protected function isAsyncMode (bool $ fallback ): bool
154
+ protected function isAsyncMode (OneTimeOperationFile $ operationFile ): bool
160
155
{
161
156
if ($ this ->forceAsync ) {
162
157
return true ;
@@ -166,6 +161,6 @@ protected function isAsyncMode(bool $fallback): bool
166
161
return false ;
167
162
}
168
163
169
- return $ fallback ;
164
+ return $ operationFile -> getClassObject ()-> isAsync () ;
170
165
}
171
166
}
Original file line number Diff line number Diff line change @@ -14,20 +14,6 @@ abstract class OneTimeOperation
14
14
*/
15
15
abstract public function process (): void ;
16
16
17
- public function setAsync (): self
18
- {
19
- $ this ->async = true ;
20
-
21
- return $ this ;
22
- }
23
-
24
- public function setSync (): self
25
- {
26
- $ this ->async = false ;
27
-
28
- return $ this ;
29
- }
30
-
31
17
public function isAsync (): bool
32
18
{
33
19
return $ this ->async ;
Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ public function test_the_whole_command_process()
27
27
// create operation file
28
28
$ this ->artisan ('operations:make AwesomeOperation ' )
29
29
->assertSuccessful ()
30
- ->expectsOutputToContain ('One-time- operation [2015_10_21_072800_awesome_operation] created successfully. ' );
30
+ ->expectsOutputToContain ('One-time operation [2015_10_21_072800_awesome_operation] created successfully. ' );
31
31
32
32
// file was created, but no operation entry yet
33
33
$ this ->assertFileExists ($ filepath );
You can’t perform that action at this time.
0 commit comments