本文整理汇总了PHP中Doctrine\DBAL\Migrations\Configuration\Configuration::registerMigration方法的典型用法代码示例。如果您正苦于以下问题:PHP Configuration::registerMigration方法的具体用法?PHP Configuration::registerMigration怎么用?PHP Configuration::registerMigration使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Doctrine\DBAL\Migrations\Configuration\Configuration
的用法示例。
在下文中一共展示了Configuration::registerMigration方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testMigrateExecutesOlderVersionsThatHaveNetYetBeenMigrated
/**
* @see https://github.com/doctrine/migrations/issues/61
* @group regresion
* @dataProvider provideTestMigrationNames
*/
public function testMigrateExecutesOlderVersionsThatHaveNetYetBeenMigrated(array $migrations)
{
foreach ($migrations as $key => $class) {
$migration = new \Doctrine\DBAL\Migrations\Migration($this->config);
$this->config->registerMigration($key, $class);
$sql = $migration->migrate();
$this->assertCount(1, $sql, 'should have executed one migration');
}
}
示例2: testMigrateToCurrentVersionReturnsEmpty
public function testMigrateToCurrentVersionReturnsEmpty()
{
$this->config->registerMigration(1, 'Doctrine\\DBAL\\Migrations\\Tests\\Functional\\MigrateAddSqlTest');
$this->config->registerMigration(2, 'Doctrine\\DBAL\\Migrations\\Tests\\Functional\\MigrationMigrateFurther');
$migration = new \Doctrine\DBAL\Migrations\Migration($this->config);
$migration->migrate();
$sql = $migration->migrate();
$this->assertEquals(array(), $sql);
}
示例3: testAddSql
public function testAddSql()
{
$this->config->registerMigration(1, 'Doctrine\\DBAL\\Migrations\\Tests\\Functional\\MigrateAddSqlTest');
$migration = new \Doctrine\DBAL\Migrations\Migration($this->config);
$migration->migrate(1);
$migrations = $this->config->getMigrations();
$this->assertTrue($migrations[1]->isMigrated());
$schema = $this->config->getConnection()->getSchemaManager()->createSchema();
$this->assertTrue($schema->hasTable('test_add_sql_table'));
$check = $this->config->getConnection()->fetchAll('select * from test_add_sql_table');
$this->assertNotEmpty($check);
$this->assertEquals('test', $check[0]['test']);
$migration->migrate(0);
$this->assertFalse($migrations[1]->isMigrated());
$schema = $this->config->getConnection()->getSchemaManager()->createSchema();
$this->assertFalse($schema->hasTable('test_add_sql_table'));
}
示例4: testDeleteOptionIfVersionNotMigrated
/**
* Test "--delete" option on not migrated version.
*
* @expectedException InvalidArgumentException
* @expectedExceptionMessage The version "1233" does not exists in the version table.
*/
public function testDeleteOptionIfVersionNotMigrated()
{
$this->configuration->registerMigration(1233, 'Doctrine\\DBAL\\Migrations\\Tests\\Stub\\Version1Test');
$commandTester = new CommandTester($this->command);
$commandTester->execute(array('--delete' => true, 'version' => 1233), array('interactive' => false));
}
示例5: registerMigration
/**
* {@inheritdoc}
*/
public function registerMigration($version, $class)
{
$this->ensureMigrationClassExists($class);
parent::registerMigration($version, $class);
}