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)
201201 if ($ command instanceof Closure) {
202202 [$ command , $ callback ] = [$ this ->firstClosureParameterType ($ command ), $ command ];
203203 } 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+ };
205211 }
206212
207213 PHPUnit::assertTrue (
@@ -219,6 +225,22 @@ public function assertChained(array $expectedChain)
219225 : $ this ->assertDispatchedWithChainOfClasses ($ command , $ expectedChain , $ callback );
220226 }
221227
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+
222244 /**
223245 * Assert if a job was dispatched with an empty chain based on a truth-test callback.
224246 *
You can’t perform that action at this time.
0 commit comments