本文整理汇总了PHP中PHPUnit_Extensions_Database_Operation_Factory::INSERT方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPUnit_Extensions_Database_Operation_Factory::INSERT方法的具体用法?PHP PHPUnit_Extensions_Database_Operation_Factory::INSERT怎么用?PHP PHPUnit_Extensions_Database_Operation_Factory::INSERT使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPUnit_Extensions_Database_Operation_Factory
的用法示例。
在下文中一共展示了PHPUnit_Extensions_Database_Operation_Factory::INSERT方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getSetUpOperation
public function getSetUpOperation()
{
// whether you want cascading truncates
// set false if unsure
$cascadeTruncates = false;
return new PHPUnit_Extensions_Database_Operation_Composite(array(new PHPUnit_Extensions_Database_Operation_MySQL55Truncate($cascadeTruncates), PHPUnit_Extensions_Database_Operation_Factory::INSERT()));
}
示例2: getDatabaseTester
protected function getDatabaseTester()
{
$tester = new PHPUnit_Extensions_Database_DefaultTester($this->_conn);
$tester->setSetUpOperation(new PHPUnit_Extensions_Database_Operation_Composite(array(new DB_operation_set_env('foreign_key_checks', 0), PHPUnit_Extensions_Database_Operation_Factory::DELETE_ALL(), new DB_operation_set_env('foreign_key_checks', 1), PHPUnit_Extensions_Database_Operation_Factory::INSERT())));
$tester->setTearDownOperation(PHPUnit_Extensions_Database_Operation_Factory::NONE());
return $tester;
}
示例3: getSetUpOperation
public function getSetUpOperation()
{
$cascadeTruncates = TRUE;
//if you want cascading truncates, false otherwise
//if unsure choose false
return new \PHPUnit_Extensions_Database_Operation_Composite(array(new Operation\MySQLTruncate($cascadeTruncates), \PHPUnit_Extensions_Database_Operation_Factory::INSERT()));
}
示例4: getSetUpOperation
/**
* Returns the database operation executed in test setup.
*
* @return PHPUnit_Extensions_Database_Operation_DatabaseOperation
*
* @since 12.1
*/
protected function getSetUpOperation()
{
// Required given the use of InnoDB contraints.
return new PHPUnit_Extensions_Database_Operation_Composite(array(PHPUnit_Extensions_Database_Operation_Factory::DELETE_ALL(), PHPUnit_Extensions_Database_Operation_Factory::INSERT()));
}
示例5: getSetUpOperation
/**
* 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()));
}
示例6: getSetUpOperation
/**
* templates the setUp method that runs before each test; this method expunges the database before each run
*
* @see https://phpunit.de/manual/current/en/fixtures.html#fixtures.more-setup-than-teardown PHPUnit Fixtures: setUp and tearDown
* @see https://github.com/sebastianbergmann/dbunit/issues/37 TRUNCATE fails on tables which have foreign key constraints
* @return PHPUnit_Extensions_Database_Operation_Composite array containing delete and insert commands
**/
public final function getSetUpOperation()
{
return new PHPUnit_Extensions_Database_Operation_Composite(array(PHPUnit_Extensions_Database_Operation_Factory::DELETE_ALL(), PHPUnit_Extensions_Database_Operation_Factory::INSERT()));
}
示例7: __construct
public function __construct(IDatabaseConnection $connection)
{
$this->connection = $connection;
$this->setUpOperation = new \PHPUnit_Extensions_Database_Operation_Composite(array(new Operations\Truncate($connection->allowsCascading()), OperationFactory::INSERT()));
$this->tearDownOperation = OperationFactory::NONE();
}
示例8: getSetUpOperation
/**
* Returns the database operation executed in test setup.
* Overriding to fix Mysql 5.5 truncate errors
*
* @return PHPUnit_Extensions_Database_Operation_DatabaseOperation
*/
protected function getSetUpOperation()
{
//return PHPUnit_Extensions_Database_Operation_Factory::CLEAN_INSERT();
$cascadeTruncates = TRUE;
return new PHPUnit_Extensions_Database_Operation_Composite(array(new Unittest_Database_Operation_MySQL55Truncate($cascadeTruncates), PHPUnit_Extensions_Database_Operation_Factory::INSERT()));
}
示例9: getSetUpOperation
/**
* setupd db
* called in setUp()
*/
public function getSetUpOperation()
{
$cascadeTruncates = false;
// True if you want cascading truncates, false otherwise. If unsure choose false.
return new \PHPUnit_Extensions_Database_Operation_Composite(array(new TruncateOperation($cascadeTruncates), \PHPUnit_Extensions_Database_Operation_Factory::INSERT()));
}
示例10: loadFixtures
/**
* Load database fixtures
*
* @param \HQ\Test\FixtureLoader $fixtureLoader
* @param AbstractConnection $connection
*/
protected function loadFixtures(FixtureLoader $fixtureLoader, AbstractConnection $connection)
{
$this->executeQueryWithForeignKeySetting(function () use($fixtureLoader, $connection) {
$fixtureSet = $fixtureLoader->load($connection, $this);
// create database tester & setup tasks
$databaseTester = $this->createDatabaseTester($connection);
$databaseTester->setSetUpOperation(\PHPUnit_Extensions_Database_Operation_Factory::INSERT());
$databaseTester->setDataSet($fixtureSet);
$databaseTester->onSetUp();
}, $connection, $this->disableFixturesForeignKeyChecks);
}
示例11: getSetUpOperation
protected function getSetUpOperation()
{
return PHPUnit_Extensions_Database_Operation_Factory::INSERT();
}
示例12: getSetUpOperation
public function getSetUpOperation()
{
$cascadeTruncates = TRUE;
return new \PHPUnit_Extensions_Database_Operation_Composite(array(new FoodAppTruncateOperation($cascadeTruncates), \PHPUnit_Extensions_Database_Operation_Factory::INSERT()));
}
示例13: getSetUpOperation
/**
* Use our own truncate operation so that we can work with InnoDB foreign
* keys constraints.
*
* @see http://stackoverflow.com/questions/10331445/phpunit-and-mysql-truncation-error
* @return \PHPUnit_Extensions_Database_Operation_Composite
*/
public function getSetUpOperation()
{
return new \PHPUnit_Extensions_Database_Operation_Composite(array(new TruncateOperation(true), \PHPUnit_Extensions_Database_Operation_Factory::INSERT()));
}
示例14: getSetUpOperation
/**
* @return \PHPUnit_Extensions_Database_Operation
*/
protected function getSetUpOperation()
{
return new \PHPUnit_Extensions_Database_Operation_Composite(array(\PHPUnit_Extensions_Database_Operation_Factory::DELETE_ALL(), \PHPUnit_Extensions_Database_Operation_Factory::INSERT()));
}