reset registry between each test method
This commit is contained in:
parent
a901f154c2
commit
7a8481283f
@ -38,7 +38,7 @@
|
||||
throw new LogicException('Unable to register invocation because the object does not exist in the registry');
|
||||
}
|
||||
|
||||
$count = self::getInvocationCount($className, $methodName);
|
||||
$count = self::getInvocationCount($className, $methodName) + 1;
|
||||
$expectation = self::$trackers[$className]->registerInvocation(new MockInvocation($className, $methodName, $args, $count));
|
||||
return $expectation;
|
||||
}
|
||||
@ -52,7 +52,7 @@
|
||||
}
|
||||
|
||||
private static function getInvocationCount($className, $methodName) {
|
||||
$count = 1;
|
||||
$count = 0;
|
||||
foreach (self::$trackers[$className]->getInvocations() as $invocation) {
|
||||
if ($invocation->getMethod() === $methodName) {
|
||||
$count++;
|
||||
|
@ -15,6 +15,9 @@
|
||||
}
|
||||
|
||||
public function run(array $listeners) {
|
||||
//reset mock object registry
|
||||
MockRegistry::reset();
|
||||
|
||||
foreach ($listeners as $listener) {
|
||||
$listener->beforeTestMethod($this);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user