/** * @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); }
/** * @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); }
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')); }