File tree Expand file tree Collapse file tree 1 file changed +23
-1
lines changed
src/Illuminate/Support/Testing/Fakes Expand file tree Collapse file tree 1 file changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -201,7 +201,13 @@ public function assertChained(array $expectedChain)
201
201
if ($ command instanceof Closure) {
202
202
[$ command , $ callback ] = [$ this ->firstClosureParameterType ($ command ), $ command ];
203
203
} elseif (! is_string ($ command )) {
204
- $ command = get_class ($ command );
204
+ $ instance = $ command ;
205
+
206
+ $ command = get_class ($ instance );
207
+
208
+ $ callback = function ($ job ) use ($ instance ) {
209
+ return serialize ($ this ->resetChainPropertiesToDefaults ($ job )) === serialize ($ instance );
210
+ };
205
211
}
206
212
207
213
PHPUnit::assertTrue (
@@ -219,6 +225,22 @@ public function assertChained(array $expectedChain)
219
225
: $ this ->assertDispatchedWithChainOfClasses ($ command , $ expectedChain , $ callback );
220
226
}
221
227
228
+ /**
229
+ * Reset the chain properties to their default values on the job.
230
+ *
231
+ * @param mixed $job
232
+ * @return mixed
233
+ */
234
+ protected function resetChainPropertiesToDefaults ($ job )
235
+ {
236
+ return tap (clone $ job , function ($ job ) {
237
+ $ job ->chainConnection = null ;
238
+ $ job ->chainQueue = null ;
239
+ $ job ->chainCatchCallbacks = null ;
240
+ $ job ->chained = [];
241
+ });
242
+ }
243
+
222
244
/**
223
245
* Assert if a job was dispatched with an empty chain based on a truth-test callback.
224
246
*
You can’t perform that action at this time.
0 commit comments