Skip to content

Commit

Permalink
Add call count to one call exception message
Browse files Browse the repository at this point in the history
  • Loading branch information
dancras committed Sep 1, 2012
1 parent e68f921 commit 1edea7d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Doubles/Spy/MethodSpy.php
Expand Up @@ -205,7 +205,7 @@ public function __construct($methodName)
private function checkOneCall()
{
if ($this->callCount !== 1) {
throw new OneCallException('One call violation for ' . $this->methodName);
throw new OneCallException($this->methodName, $this->callCount);
}
}

Expand Down
6 changes: 6 additions & 0 deletions src/Doubles/Spy/OneCallException.php
Expand Up @@ -12,5 +12,11 @@
*/
class OneCallException extends DoublesException
{
public function __construct($methodName, $callCount)
{
parent::__construct(
"One call violation for {$methodName}. Call count was {$callCount}"
);
}
}

0 comments on commit 1edea7d

Please sign in to comment.