/** * Teardown fixture data. Use transaction to speed up deletes * * @todo suppress log noise of SQL from fixture teardowns */ public function teardown() { Mad_Test_Fixture_Base::resetToTeardown(); foreach ($this->_fixtures as $fixture) { $fixture->teardown(); } }
public function testAddFixture() { $fixtures = new Mad_Test_Fixture_Collection($this->_conn, 'unit_tests'); $fixtures->addFixture('unit_tests'); $expected = array('unit_tests' => 2); $this->assertEquals($expected, Mad_Test_Fixture_Base::getParsed()); }
/** * Delete fixture data from the database */ protected function _teardownFixtures() { Mad_Test_Fixture_Base::resetToTeardown(); foreach ($this->_fixtures as $fixture) { $fixture->teardown(); $this->_print("deleting " . $fixture->getYmlName()); } }
public function testResetToTeardown() { $fixture = new Mad_Test_Fixture_Base($this->_conn, 'unit_tests_more'); $fixture->teardown(); $expected = array('unit_tests' => 0, 'unit_tests_more' => 0); $this->assertEquals($expected, $fixture->getToTeardown()); $fixture->resetToTeardown(); $expected = array('unit_tests' => 1, 'unit_tests_more' => 1); $this->assertEquals($expected, $fixture->getToTeardown()); }
/** * Temporarily suppresses all application logging. Used to hide the numerous * SQL statements involved in setting up and tearing down fixtures. * * IMPORTANT: This call suppresses logging for the entire application! Always * remember to balance this with a call to {@link _resumeLogging()} * * @see _resumeLogging() */ private static function _suppressLogging() { /* A counter is used since fixture loading can be recursive. Logging * is suppressed and resumed only at the top level. */ if (++self::$_suppressLogDepth > 1) { return; } if (is_null(self::$_suppressLogFilter)) { self::$_suppressLogFilter = new Horde_Log_Filter_Suppress(); $logger = self::logger(); if (!is_null($logger)) { $logger->addFilter(self::$_suppressLogFilter); } } self::$_suppressLogFilter->suppress(true); }