/** * 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'); } }