Exemplo n.º 1
0
 /**
  * @test
  */
 function execute_sql_php()
 {
     $this->pdo->exec("DROP PROCEDURE IF EXISTS sp_sample");
     $fn = $this->env->files('/sp/0000.php.sql');
     $this->executor->execute($fn);
     $row = $this->pdo->query("call sp_sample()")->fetch();
     assertEquals(array('one' => 1), $row);
 }
Exemplo n.º 2
0
 protected function setUp()
 {
     $env = TestEnv::create();
     $this->table = new DbTable($env->config());
     $this->pdo = $env->pdo();
     $this->pdo->query("drop table if exists db_migrate");
 }
Exemplo n.º 3
0
 /**
  * @test
  */
 function migrate_error()
 {
     $this->manager->setScriptDirectory($this->env->files('err'));
     try {
         $this->manager->migrate();
         $this->fail();
     } catch (\Doctrine\DBAL\DBALException $ex) {
         assertContains('Duplicate entry', $ex->getMessage());
     }
     $rows = $this->pdo->query("select * from tt")->fetchAll(PDO::FETCH_COLUMN);
     assertEquals(array(1000), $rows);
     // エラーの直前までのバージョンが適用済
     $list = $this->fetch_migrate_versions();
     assertEquals(array("0000.sql", "1000.sql"), $list);
 }
Exemplo n.º 4
0
 function fix_too_dataProvider()
 {
     $env = new TestEnv();
     $fn = $env->files();
     return array(array('fix', '--config', $fn, '--all', '--clear', 'version'), array('fix', '--config', $fn, '--all', '--clear'), array('fix', '--config', $fn, '--all', 'version'), array('fix', '--config', $fn, '--clear', 'version'));
 }
Exemplo n.º 5
0
 protected function setUp()
 {
     $this->env = new TestEnv();
     $this->pdo = $this->env->pdo();
 }