@@ -91,7 +91,7 @@ public static function fromTransactions(array $expectedEvents)
91
91
*/
92
92
public function commandFailed (CommandFailedEvent $ event )
93
93
{
94
- if ($ this ->ignoreCommandFailed ) {
94
+ if ($ this ->ignoreCommandFailed || ( $ this -> ignoreExtraEvents && count ( $ this -> actualEvents ) === count ( $ this -> expectedEvents )) ) {
95
95
return ;
96
96
}
97
97
@@ -105,7 +105,7 @@ public function commandFailed(CommandFailedEvent $event)
105
105
*/
106
106
public function commandStarted (CommandStartedEvent $ event )
107
107
{
108
- if ($ this ->ignoreCommandStarted ) {
108
+ if ($ this ->ignoreCommandStarted || ( $ this -> ignoreExtraEvents && count ( $ this -> actualEvents ) === count ( $ this -> expectedEvents )) ) {
109
109
return ;
110
110
}
111
111
@@ -119,7 +119,7 @@ public function commandStarted(CommandStartedEvent $event)
119
119
*/
120
120
public function commandSucceeded (CommandSucceededEvent $ event )
121
121
{
122
- if ($ this ->ignoreCommandSucceeded ) {
122
+ if ($ this ->ignoreCommandSucceeded || ( $ this -> ignoreExtraEvents && count ( $ this -> actualEvents ) === count ( $ this -> expectedEvents )) ) {
123
123
return ;
124
124
}
125
125
@@ -150,15 +150,11 @@ public function stopMonitoring()
150
150
*/
151
151
public function assert (FunctionalTestCase $ test , Context $ context )
152
152
{
153
- $ actualEvents = $ this ->ignoreExtraEvents
154
- ? array_slice ($ this ->actualEvents , 0 , count ($ this ->expectedEvents ))
155
- : $ this ->actualEvents ;
156
-
157
- $ test ->assertCount (count ($ this ->expectedEvents ), $ actualEvents );
153
+ $ test ->assertCount (count ($ this ->expectedEvents ), $ this ->actualEvents );
158
154
159
155
$ mi = new MultipleIterator (MultipleIterator::MIT_NEED_ANY );
160
156
$ mi ->attachIterator (new ArrayIterator ($ this ->expectedEvents ));
161
- $ mi ->attachIterator (new ArrayIterator ($ actualEvents ));
157
+ $ mi ->attachIterator (new ArrayIterator ($ this -> actualEvents ));
162
158
163
159
foreach ($ mi as $ events ) {
164
160
list ($ expectedEventAndClass , $ actualEvent ) = $ events ;
0 commit comments