Example #1
0
 public function setUp()
 {
     $this->testDatabase = 'yentu_rollback_test';
     parent::setup();
     $this->createDb($GLOBALS['DB_NAME']);
     $this->initDb($GLOBALS['DB_FULL_DSN'], file_get_contents("tests/sql/{$GLOBALS['DRIVER']}/pre_rollback.sql"));
     $this->connect($GLOBALS['DB_FULL_DSN']);
     $this->setupStreams();
     $init = new \yentu\commands\Init();
     $init->createConfigFile(array('driver' => $GLOBALS['DRIVER'], 'host' => $GLOBALS['DB_HOST'], 'dbname' => $GLOBALS["DB_NAME"], 'user' => $GLOBALS['DB_USER'], 'password' => $GLOBALS['DB_PASSWORD'], 'file' => $GLOBALS['DB_FILE']));
     Config::readPath(\yentu\Yentu::getPath('config'), 'yentu');
 }
Example #2
0
 protected function initYentu($name)
 {
     $init = new \yentu\commands\Init();
     $this->setupStreams();
     $init->run(array('driver' => $GLOBALS['DRIVER'], 'host' => $GLOBALS['DB_HOST'], 'dbname' => $name, 'user' => $GLOBALS['DB_USER'], 'password' => $GLOBALS['DB_PASSWORD'], 'file' => $GLOBALS['DB_FILE']));
 }
Example #3
0
 /**
  * @expectedException \yentu\exceptions\CommandException
  */
 public function testExistingDb()
 {
     $this->pdo->query('CREATE TABLE yentu_history(dummy INTEGER)');
     $initCommand = new \yentu\commands\Init();
     \yentu\Yentu::setDefaultHome(vfsStream::url("home/yentu"));
     $initCommand->run(array('driver' => $GLOBALS['DRIVER'], 'host' => $GLOBALS['DB_HOST'], 'dbname' => $GLOBALS['DB_NAME'], 'user' => $GLOBALS['DB_USER'], 'password' => $GLOBALS['DB_PASSWORD'], 'file' => $GLOBALS['DB_FILE']));
 }