/**
  * @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;
 }
Пример #2
0
 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;
 }
Пример #3
0
 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();
 }
    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;
    }