Skip to content

Commit

Permalink
More properly create/invoke matchers.
Browse files Browse the repository at this point in the history
  • Loading branch information
martymcguire committed Feb 27, 2012
1 parent 723a515 commit c8dc961
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/MiniSpec/expector.php
Expand Up @@ -21,9 +21,10 @@ public function __call($name, $arguments)
// throw new Exception("No expectation named ".$name);
// }

if( array_key_exists($name, $expectations) ) {
$expectations[$name]::matcher($this->subject, $arguments);
} else {
if( array_key_exists($name, $this->expectations) ) {
$matcher = new $this->expectations[$name];
$matcher->matcher($this->subject, $arguments);
} else {
throw new Exception("No expectation named ".$name);
}
}
Expand Down

0 comments on commit c8dc961

Please sign in to comment.