public function doAssert(\Hamcrest_Matcher $matcher, $message = null) { if (!empty($message)) { \Hamcrest_MatcherAssert::assertThat($message, $this->value, $matcher); } else { \Hamcrest_MatcherAssert::assertThat($this->value, $matcher); } }
public function doAssert(\Hamcrest_Matcher $matcher, $message = null) { if (!empty($message)) { \Hamcrest_MatcherAssert::assertThat($message, $this->value, \Hamcrest_Core_IsCollectionContaining::hasItem($matcher)); } else { \Hamcrest_MatcherAssert::assertThat($this->value, \Hamcrest_Core_IsCollectionContaining::hasItem($matcher)); } }
/** * Resets the number of assertions performed to zero. */ public static function resetCount() { self::$_count = 0; }
/** * The standard tearDown method invocation * * @param Spec\TestCaseInterface $test */ public function tearDown(Spec\TestCaseInterface $test) { if (class_exists('\\Hamcrest_MatcherAssert', true)) { $test->addToAssertionCount(\Hamcrest_MatcherAssert::getCount() - $test->hamcrestAssertCount); } $suite = $test->getSuite(); // Restore the world $suite->restoreWorldSnapshot(); // @todo Move callback invocation logic here $suite->runAfterEachCallbacks($test); }
public function testAssertThatWithFourArgsThrowsErrorAndDoesntIncrementCount() { try { Hamcrest_MatcherAssert::assertThat(1, 2, 3, 4); self::fail('expected invalid argument exception'); } catch (InvalidArgumentException $ex) { self::assertEquals(0, Hamcrest_MatcherAssert::getCount(), 'assertion count'); } }