当前位置: 首页>>代码示例>>PHP>>正文


PHP PHPUnit_Extensions_Database_Operation_Factory::CLEAN_INSERT方法代码示例

本文整理汇总了PHP中PHPUnit_Extensions_Database_Operation_Factory::CLEAN_INSERT方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPUnit_Extensions_Database_Operation_Factory::CLEAN_INSERT方法的具体用法?PHP PHPUnit_Extensions_Database_Operation_Factory::CLEAN_INSERT怎么用?PHP PHPUnit_Extensions_Database_Operation_Factory::CLEAN_INSERT使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PHPUnit_Extensions_Database_Operation_Factory的用法示例。


在下文中一共展示了PHPUnit_Extensions_Database_Operation_Factory::CLEAN_INSERT方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: seedDatabases

 private function seedDatabases()
 {
     foreach (self::$conns as $i => $conn) {
         $setUpOperation = \PHPUnit_Extensions_Database_Operation_Factory::CLEAN_INSERT();
         $setUpOperation->execute($conn, $this->createXMLDataSet(dirname(__FILE__) . '/multi_seed' . $i . '.xml'));
     }
 }
开发者ID:dreamblazenet,项目名称:crazydatamapper,代码行数:7,代码来源:MultiDatabaseTestCase.php

示例2: getDatabaseTester

 /**
  * @return PHPUnit_Extensions_Database_DefaultTester
  */
 protected function getDatabaseTester()
 {
     $connection = new PHPUnit_Extensions_Database_DB_DefaultDatabaseConnection($this->pdo, 'sqlite');
     $tester = new PHPUnit_Extensions_Database_DefaultTester($connection);
     $tester->setSetUpOperation(PHPUnit_Extensions_Database_Operation_Factory::CLEAN_INSERT());
     $tester->setTearDownOperation(PHPUnit_Extensions_Database_Operation_Factory::NONE());
     $tester->setDataSet(new PHPUnit_Extensions_Database_DataSet_FlatXmlDataSet(dirname(__FILE__) . '/_files/bank-account-seed.xml'));
     return $tester;
 }
开发者ID:newsn31,项目名称:StarterTheme,代码行数:12,代码来源:BankAccountCompositeTest.php

示例3: applyTo

 public function applyTo(Database $db)
 {
     $pdo = $db->getPdo();
     $connection = new \PHPUnit_Extensions_Database_DB_DefaultDatabaseConnection($pdo, $db->getName());
     $databasetester = new \PHPUnit_Extensions_Database_DefaultTester($connection);
     $setupoperation = \PHPUnit_Extensions_Database_Operation_Factory::CLEAN_INSERT();
     $databasetester->setSetUpOperation($setupoperation);
     $databasetester->setDataSet($this->dataset);
     $databasetester->onSetUp();
 }
开发者ID:linkorb,项目名称:transmogrifier,代码行数:10,代码来源:Dataset.php

示例4: getDatabaseTester

 protected function getDatabaseTester()
 {
     $pdo = new PDO('mysql:host=localhost;dbname=c3op', 'root', '');
     $connection = new PHPUnit_Extensions_Database_DB_DefaultDatabaseConnection($pdo, 'c3op');
     $tester = new PHPUnit_Extensions_Database_DefaultTester($connection);
     $tester->setSetUpOperation(PHPUnit_Extensions_Database_Operation_Factory::CLEAN_INSERT());
     $tester->setTearDownOperation(PHPUnit_Extensions_Database_Operation_Factory::NONE());
     $tester->setDataSet(new PHPUnit_Extensions_Database_DataSet_FlatXMLDataSet(dirname(__FILE__) . '/fixture/projects_seed.xml'));
     return $tester;
 }
开发者ID:racporto,项目名称:c3op,代码行数:10,代码来源:dbXest.php

示例5: setUpBeforeClass

 public static function setUpBeforeClass()
 {
     $config = array('dbname' => 'DBALiteTest', 'username' => 'dbalite', 'password' => 'testme', 'host' => '127.0.0.1');
     $csvfile = DATA_DIR . 'TABLE_Products.csv';
     $pdoObj = new PDO("pgsql:host=127.0.0.1 dbname={$config['dbname']}", $config['username'], $config['password']);
     self::$phpunitConn = new PHPUnit_Extensions_Database_DB_DefaultDatabaseConnection($pdoObj);
     self::$dataset = new PHPUnit_Extensions_Database_Dataset_CsvDataSet();
     self::$dataset->addTable('Products', $csvfile);
     $setupOperation = PHPUnit_Extensions_Database_Operation_Factory::CLEAN_INSERT();
     $setupOperation->execute(self::$phpunitConn, self::$dataset);
     $driver = DBALite::factory('pgsql', $config);
     $sql = 'SELECT * FROM "Products" WHERE "CategoryID" = ?';
     self::$dbaliteStmt = $driver->prepare($sql);
     self::$dbaliteDriver = $driver;
 }
开发者ID:paulyg,项目名称:dbalite,代码行数:15,代码来源:PgsqlTest.php

示例6: setUpBeforeClass

 public static function setUpBeforeClass()
 {
     $dbfile = DATA_DIR . 'SqliteTest.sqlite';
     $csvfile = DATA_DIR . 'TABLE_Products.csv';
     $pdoObj = new PDO("sqlite:{$dbfile}");
     self::$phpunitConn = new PHPUnit_Extensions_Database_DB_DefaultDatabaseConnection($pdoObj);
     self::$dataset = new PHPUnit_Extensions_Database_Dataset_CsvDataSet();
     self::$dataset->addTable('Products', $csvfile);
     $setupOperation = PHPUnit_Extensions_Database_Operation_Factory::CLEAN_INSERT();
     $setupOperation->execute(self::$phpunitConn, self::$dataset);
     $driver = DBALite::factory('sqlite', array('dbname' => $dbfile));
     $sql = 'SELECT * FROM Products WHERE CategoryID = ?';
     self::$dbaliteStmt = $driver->prepare($sql);
     self::$dbaliteDriver = $driver;
 }
开发者ID:paulyg,项目名称:dbalite,代码行数:15,代码来源:SqliteTest.php

示例7: __construct

    function __construct()
    {
    // connect for unit testing framework
        $pdo = new PDO('mysql:host=' . HOST . ';dbname=' .
            DB_NAME, USERNAME, PASSWORD);

        $connection = new PHPUnit_Extensions_Database_DB_DefaultDatabaseConnection($pdo, 'test');
        $tester     = new PHPUnit_Extensions_Database_DefaultTester($connection);

        $tester->setSetUpOperation(PHPUnit_Extensions_Database_Operation_Factory::CLEAN_INSERT());
        $tester->setTearDownOperation(PHPUnit_Extensions_Database_Operation_Factory::NONE());
        $tester->setDataSet(new PHPUnit_Extensions_Database_DataSet_FlatXMLDataSet
            (dirname(__FILE__).'/../models/files/users.xml'));

        $this->tester = $tester;
    }
开发者ID:robehickman,项目名称:decentralised_microblogging_system,代码行数:16,代码来源:ctrlMessagesTest.php

示例8: setUp

 /**
  * Executed when this test case is initialized
  */
 public function setUp()
 {
     $this->databaseTester = NULL;
     // Build the PDO datasource name (DSN)
     $database_dsn = Kohana::config('database.default.connection.type') . ":" . "dbname=" . Kohana::config('database.default.connection.database') . ";" . "host=" . Kohana::config('database.default.connection.host');
     // Create PDO object
     $pdo = new PDO($database_dsn, Kohana::config('database.default.connection.user'), Kohana::config('database.default.connection.pass'));
     // Create connection
     $connection = new PHPUnit_Extensions_Database_DB_DefaultDatabaseConnection($pdo, Kohana::config('database.default.connection.database'));
     // Set up the database tester object, setup operation and dataset
     $this->databaseTester = new PHPUnit_Extensions_Database_DefaultTester($connection);
     $this->databaseTester->setSetUpOperation(PHPUnit_Extensions_Database_Operation_Factory::CLEAN_INSERT());
     // 	Set the dataset for the tester
     $this->databaseTester->setDataSet($this->getDataSet());
     // Run setup
     $this->databaseTester->onSetUp();
 }
开发者ID:neumicro,项目名称:Ushahidi_Web_Dev,代码行数:20,代码来源:Customforms_Test.php

示例9: getSetUpOperation

	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();
		}
	}
开发者ID:nathansamson,项目名称:CoOrg,代码行数:19,代码来源:model.test.class.php

示例10: getSetUpOperation

 /**
  * Returns the database operation executed in test setup.
  *
  * @return PHPUnit_Extensions_Database_Operation_DatabaseOperation
  */
 protected function getSetUpOperation()
 {
     return PHPUnit_Extensions_Database_Operation_Factory::CLEAN_INSERT();
 }
开发者ID:rmehner,项目名称:phpunit,代码行数:9,代码来源:TestCase.php

示例11: __construct

 /**
  * Creates a new database tester.
  *
  * @param PHPUnit_Extensions_Database_DB_IDatabaseConnection $databaseConnection
  */
 public function __construct()
 {
     $this->setUpOperation = PHPUnit_Extensions_Database_Operation_Factory::CLEAN_INSERT();
     $this->tearDownOperation = PHPUnit_Extensions_Database_Operation_Factory::NONE();
 }
开发者ID:rmehner,项目名称:phpunit,代码行数:10,代码来源:AbstractTester.php

示例12: testBuild_withDefaultOperationsHasDefaultSetUpOperation

 /**
  * @depends testConnection
  */
 public function testBuild_withDefaultOperationsHasDefaultSetUpOperation($connection)
 {
     $dbConfig = $this->builder->connection($connection)->dataSet($this->dataSet)->build();
     $this->assertEquals(PHPUnit_Extensions_Database_Operation_Factory::CLEAN_INSERT(), $dbConfig->getSetUpOperation());
 }
开发者ID:TheOnlyMerlin,项目名称:phpunit-extensions,代码行数:8,代码来源:BuilderTest.php

示例13: __construct

 public function __construct(\PHPUnit_Extensions_Database_DB_IDatabaseConnection $connection, $fixturePath)
 {
     parent::__construct($connection, $fixturePath);
     $this->setUpOperation = \PHPUnit_Extensions_Database_Operation_Factory::CLEAN_INSERT(true);
 }
开发者ID:wachterjohannes,项目名称:jackalope-doctrine-dbal,代码行数:5,代码来源:Pgsql.php

示例14: array

        break;
    default:
    case 'sqlite':
        $params = array('path' => PSX_PATH_CACHE . '/fusio_ui.db', 'driver' => 'pdo_sqlite');
        break;
}
$config = new Doctrine\DBAL\Configuration();
$connection = Doctrine\DBAL\DriverManager::getConnection($params, $config);
$container->set('connection', $connection);
if (isset($_SERVER['argv']) && in_array('--warmup', $_SERVER['argv'])) {
    // warmup
    $loader->addClassMap(['Fusio\\Impl\\Fixture' => __DIR__ . '/../tests/Fixture.php', 'Fusio\\Impl\\TestSchema' => __DIR__ . '/../tests/TestSchema.php']);
    // create schema
    $fromSchema = $connection->getSchemaManager()->createSchema();
    $version = new Fusio\Impl\Database\Version\Version010();
    $toSchema = $version->getSchema();
    Fusio\Impl\TestSchema::appendSchema($toSchema);
    $queries = $fromSchema->getMigrateToSql($toSchema, $connection->getDatabasePlatform());
    foreach ($queries as $query) {
        $connection->query($query);
    }
    // insert fixtures
    $connection = new PHPUnit_Extensions_Database_DB_DefaultDatabaseConnection($container->get('connection')->getWrappedConnection());
    PHPUnit_Extensions_Database_Operation_Factory::CLEAN_INSERT()->execute($connection, Fusio\Impl\Fixture::getDataSet());
    echo 'Warmup successful' . "\n";
} else {
    // run
    $request = $container->get('request_factory')->createRequest();
    $response = $container->get('response_factory')->createResponse();
    $container->get('dispatch')->route($request, $response);
}
开发者ID:uqiauto,项目名称:fusio,代码行数:31,代码来源:server.php


注:本文中的PHPUnit_Extensions_Database_Operation_Factory::CLEAN_INSERT方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。