/** * A test ended. * * @param PHPUnit_Framework_Test $test * @param float $time */ public function endTest(PHPUnit_Framework_Test $test, $time) { Mage::dispatchEvent('phpunit_test_end_before', array('test' => $test, 'listener' => $this)); if ($test instanceof PHPUnit_Framework_TestCase) { EcomDev_PHPUnit_Test_Case_Util::getFixture(get_class($test))->setScope(EcomDev_PHPUnit_Model_FixtureInterface::SCOPE_LOCAL)->discard(); // Clear applied fixture if (EcomDev_PHPUnit_Test_Case_Util::getExpectation(get_class($test))->isLoaded()) { EcomDev_PHPUnit_Test_Case_Util::getExpectation(get_class($test))->discard(); } EcomDev_PHPUnit_Test_Case_Util::tearDown(); EcomDev_PHPUnit_Helper::tearDown(); } Mage::dispatchEvent('phpunit_test_end_after', array('test' => $test, 'listener' => $this)); }
/** * Test that when set up is invoked, * test helpers that support setUp method invoked as well * */ public function testTearDown() { $helpers = $this->getHelpersForTest(4, true); $helpers[0]->expects($this->never())->method('tearDown'); $helpers[1]->expects($this->once())->method('tearDown'); $helpers[2]->expects($this->never())->method('tearDown'); $helpers[3]->expects($this->once())->method('tearDown'); EcomDev_PHPUnit_Helper::tearDown(); }