public function assertAssertion($expected, AbstractAssertion $assertion, $subject) { if (!$subject instanceof stdClass) { $subject = (object) [$assertion->getName() => $subject]; } $result = $assertion->getError($subject); if ($expected === true) { $message = sprintf('Assertion %s should pass', get_class($assertion)); $this->assertTrue(is_null($result), $message); } else { $message = sprintf('Assertion %s should fail', get_class($assertion)); $this->assertTrue($result instanceof Error, $message); $this->assertEquals($expected, $result->getMessage()); } }
/** * The name of the property this error was recorded for * * @return string */ public function getName() { return $this->assert->getName(); }