Permalink
Browse files

- Merge [3393].

  • Loading branch information...
1 parent 31bb0d9 commit ab2eb2176a3ebd2ec40212828b73bf6e0ebf020a @sebastianbergmann committed Jul 9, 2008
Showing with 17 additions and 6 deletions.
  1. +17 −6 PHPUnit/Framework/MockObject/InvocationMocker.php
@@ -111,6 +111,7 @@ public function expects(PHPUnit_Framework_MockObject_Matcher_Invocation $matcher
public function invoke(PHPUnit_Framework_MockObject_Invocation $invocation)
{
+ $exception = NULL;
$hasReturnValue = FALSE;
if (strtolower($invocation->methodName) == '__tostring') {
@@ -119,15 +120,25 @@ public function invoke(PHPUnit_Framework_MockObject_Invocation $invocation)
$returnValue = NULL;
}
- foreach($this->matchers as $match) {
- if ($match->matches($invocation)) {
- $value = $match->invoked($invocation);
+ foreach ($this->matchers as $match) {
+ try {
+ if ($match->matches($invocation)) {
+ $value = $match->invoked($invocation);
- if (!$hasReturnValue) {
- $returnValue = $value;
- $hasReturnValue = TRUE;
+ if (!$hasReturnValue) {
+ $returnValue = $value;
+ $hasReturnValue = TRUE;
+ }
}
}
+
+ catch (Exception $e) {
+ $exception = $e;
+ }
+ }
+
+ if ($exception !== NULL) {
+ throw $exception;
}
return $returnValue;

0 comments on commit ab2eb21

Please sign in to comment.