Esempio n. 1
0
 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;
 }
Esempio n. 2
0
 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;
 }
Esempio n. 3
0
 public static function setUpBeforeClass()
 {
     $testdb = realpath(DATA_DIR . 'Select_Test_Db.sqlite');
     self::$driver = DBALite::factory('sqlite', array('dbname' => $testdb));
     self::$select = new DBALite_Select(self::$driver);
 }
Esempio n. 4
0
 public static function setUpBeforeClass()
 {
     $config = array('dbname' => 'DBALite_Test', 'username' => 'dbalite', 'password' => 'testme', 'host' => '127.0.0.1');
     self::$dbaliteConn = DBALite::factory('mysql', $config);
 }
Esempio n. 5
0
 /**
  * @expectedException DBALite_Exception
  */
 public function testFactoryNoDbname()
 {
     $driver = 'sqlite';
     $config = array('database' => self::$dbname);
     $instance = DBALite::factory($driver, $config);
 }
Esempio n. 6
0
 public static function setUpBeforeClass()
 {
     $config = array('dbname' => DATA_DIR . 'SqliteTest.sqlite');
     self::$dbaliteConn = DBALite::factory('sqlite', $config);
 }
Esempio n. 7
0
 public static function setUpBeforeClass()
 {
     $driver = 'sqlite';
     $config = array('dbname' => DATA_DIR . 'SqliteTest.sqlite', 'options' => array('fetchmode' => 'obj', 'casefolding' => 'lower', 'autoquoteidentifiers' => false));
     self::$database = DBALite::factory($driver, $config);
 }