/** * Tear down operation - Executed when the test is complete */ public function tearDown() { // Tear down operation $this->databaseTester->setTearDownOperation(PHPUnit_Extensions_Database_Operation_Factory::TRUNCATE()); $this->databaseTester->setDataSet($this->getDataSet()); $this->databaseTester->onTearDown(); // Garbage collection unset($this->databaseTester); }
protected function getSetUpOperation() { if (self::$_oldDataset == null) { return PHPUnit_Extensions_Database_Operation_Factory::CLEAN_INSERT(true); } else if (self::$_oldDataset != $this->_dataset) { $truncate = PHPUnit_Extensions_Database_Operation_Factory::TRUNCATE(true); $truncate->execute($this->getConnection(), $this->createFlatXMLDataSet(self::$_oldDataset)); return PHPUnit_Extensions_Database_Operation_Factory::CLEAN_INSERT(true); } else { return PHPUnit_Extensions_Database_Operation_Factory::NONE(); } }
/** * Returns the database operation executed in test setup. * * @return \PHPUnit_Extensions_Database_Operation_Composite * * @since 1.0 */ protected function getSetUpOperation() { // At the moment we can safely TRUNCATE tables, since we're not using InnoDB tables nor foreign keys // However if we ever need them, we can use our InsertOperation and TruncateOperation to suppress foreign keys return new \PHPUnit_Extensions_Database_Operation_Composite(array(\PHPUnit_Extensions_Database_Operation_Factory::TRUNCATE(), \PHPUnit_Extensions_Database_Operation_Factory::INSERT())); }
protected function getTearDownOperation() { return \PHPUnit_Extensions_Database_Operation_Factory::TRUNCATE(); }
/** * @depends testConnection */ public function testBuild_withDefaultOperationsHasDefaultTearDownOperation($connection) { $dbConfig = $this->builder->connection($connection)->dataSet($this->dataSet)->build(); $this->assertEquals(PHPUnit_Extensions_Database_Operation_Factory::TRUNCATE(), $dbConfig->getTearDownOperation()); }
public function __construct() { $this->setUpOperation = PHPUnit_Extensions_Database_Operation_Factory::CLEAN_INSERT(); $this->tearDownOperation = PHPUnit_Extensions_Database_Operation_Factory::TRUNCATE(); }
protected function getSetUpOperation() { return new \PHPUnit_Extensions_Database_Operation_Composite(array(\PHPUnit_Extensions_Database_Operation_Factory::TRUNCATE(), new BulkInsertDatabaseOperation())); }
/** * templates the tearDown method that runs after each test; this method expunges the database after each run * * @return PHPUnit_Extensions_Database_Operation_IDatabaseOperation delete command for the database **/ public final function getTearDownOperation() { return PHPUnit_Extensions_Database_Operation_Factory::TRUNCATE(); }
public static function tearDownAfterClass() { $teardownOperation = PHPUnit_Extensions_Database_Operation_Factory::TRUNCATE(); $teardownOperation->execute(self::$phpunitConn, self::$dataset); }