@@ -65,7 +65,8 @@ public function assertDispatched($command, $callback = null)
65
65
}
66
66
67
67
PHPUnit::assertTrue (
68
- $ this ->dispatched ($ command , $ callback )->count () > 0 ,
68
+ $ this ->dispatched ($ command , $ callback )->count () > 0 ||
69
+ $ this ->dispatchedAfterResponse ($ command , $ callback )->count () > 0 ,
69
70
"The expected [ {$ command }] job was not dispatched. "
70
71
);
71
72
}
@@ -79,73 +80,77 @@ public function assertDispatched($command, $callback = null)
79
80
*/
80
81
public function assertDispatchedTimes ($ command , $ times = 1 )
81
82
{
83
+ $ count = $ this ->dispatched ($ command )->count () +
84
+ $ this ->dispatchedAfterResponse ($ command )->count ();
85
+
82
86
PHPUnit::assertTrue (
83
- ( $ count = $ this -> dispatched ( $ command )-> count ()) === $ times ,
87
+ $ count === $ times ,
84
88
"The expected [ {$ command }] job was pushed {$ count } times instead of {$ times } times. "
85
89
);
86
90
}
87
91
88
92
/**
89
- * Assert if a job was pushed after the response was sent a number of times .
93
+ * Determine if a job was dispatched based on a truth-test callback .
90
94
*
91
95
* @param string $command
92
- * @param int $times
96
+ * @param callable|null $callback
93
97
* @return void
94
98
*/
95
- public function assertDispatchedAfterResponseTimes ($ command , $ times = 1 )
99
+ public function assertNotDispatched ($ command , $ callback = null )
96
100
{
97
101
PHPUnit::assertTrue (
98
- ($ count = $ this ->dispatchedAfterResponse ($ command )->count ()) === $ times ,
99
- "The expected [ {$ command }] job was pushed {$ count } times instead of {$ times } times. "
102
+ $ this ->dispatched ($ command , $ callback )->count () === 0 &&
103
+ $ this ->dispatchedAfterResponse ($ command , $ callback )->count () === 0 ,
104
+ "The unexpected [ {$ command }] job was dispatched. "
100
105
);
101
106
}
102
107
103
108
/**
104
- * Determine if a job was dispatched based on a truth-test callback.
109
+ * Assert if a job was dispatched after the response was sent based on a truth-test callback.
105
110
*
106
111
* @param string $command
107
- * @param callable|null $callback
112
+ * @param callable|int| null $callback
108
113
* @return void
109
114
*/
110
- public function assertNotDispatched ($ command , $ callback = null )
115
+ public function assertDispatchedAfterResponse ($ command , $ callback = null )
111
116
{
117
+ if (is_numeric ($ callback )) {
118
+ return $ this ->assertDispatchedAfterResponseTimes ($ command , $ callback );
119
+ }
120
+
112
121
PHPUnit::assertTrue (
113
- $ this ->dispatched ($ command , $ callback )->count () === 0 ,
114
- "The unexpected [ {$ command }] job was dispatched. "
122
+ $ this ->dispatchedAfterResponse ($ command , $ callback )->count () > 0 ,
123
+ "The expected [ {$ command }] job was not dispatched for after sending the response . "
115
124
);
116
125
}
117
126
118
127
/**
119
- * Determine if a job was dispatched based on a truth-test callback .
128
+ * Assert if a job was pushed after the response was sent a number of times .
120
129
*
121
130
* @param string $command
122
- * @param callable|null $callback
131
+ * @param int $times
123
132
* @return void
124
133
*/
125
- public function assertNotDispatchedAfterResponse ($ command , $ callback = null )
134
+ public function assertDispatchedAfterResponseTimes ($ command , $ times = 1 )
126
135
{
127
136
PHPUnit::assertTrue (
128
- $ this ->dispatchedAfterResponse ($ command, $ callback )->count () === 0 ,
129
- "The unexpected [ {$ command }] job was dispatched for after sending the response . "
137
+ ( $ count = $ this ->dispatchedAfterResponse ($ command )->count ()) === $ times ,
138
+ "The expected [ {$ command }] job was pushed { $ count } times instead of { $ times } times . "
130
139
);
131
140
}
132
141
133
142
/**
134
- * Assert if a job was dispatched after the response was sent based on a truth-test callback.
143
+ * Determine if a job was dispatched based on a truth-test callback.
135
144
*
136
145
* @param string $command
137
- * @param callable|int| null $callback
146
+ * @param callable|null $callback
138
147
* @return void
139
148
*/
140
- public function assertDispatchedAfterResponse ($ command , $ callback = null )
149
+ public function assertNotDispatchedAfterResponse ($ command , $ callback = null )
141
150
{
142
- if (is_numeric ($ callback )) {
143
- return $ this ->assertDispatchedAfterResponseTimes ($ command , $ callback );
144
- }
145
-
146
151
PHPUnit::assertTrue (
147
- $ this ->dispatchedAfterResponse ($ command , $ callback )->count () > 0 ,
148
- "The expected [ {$ command }] job was not dispatched for after sending the response. "
152
+ $ this ->dispatchedAfterResponse ($ command , $ callback )->count () === 0 ,
153
+ "The unexpected [ {$ command }] job was dispatched for after sending the response. "
149
154
);
150
155
}
151
156
0 commit comments