/** * Executes the matcher on a given argument value. * * Forwards the call to Hamcrest's matches() method. * * @param mixed $argument * @throws Phake_Exception_MethodMatcherException */ protected function matches(&$argument) { if (!$this->matcher->matches($argument)) { $description = new \Hamcrest\StringDescription(); $description->appendText("Expected ")->appendDescriptionOf($this->matcher)->appendText(' but '); $this->matcher->describeMismatch($argument, $description); throw new Phake_Exception_MethodMatcherException($description); } }
public function assertDescription($expected, \Hamcrest\Matcher $matcher) { $description = new \Hamcrest\StringDescription(); $description->appendDescriptionOf($matcher); $this->assertEquals($expected, (string) $description, 'Expected description'); }