/** * @expectedException \Oro\Bundle\MigrationBundle\Exception\InvalidNameException * @expectedExceptionMessage Could not create index for column with length more than 255. * @dataProvider invalidMigrationsProvider */ public function testIndexesFailed($migrations) { $migrationsToExecute = []; foreach ($migrations as $migration) { $migrationClass = 'Oro\\Bundle\\MigrationBundle\\Tests\\Unit\\Fixture\\TestPackage\\' . $migration; $migrationsToExecute[] = new $migrationClass(); } $this->executor->executeUp($migrationsToExecute); }
public function testUpdatedColumnIndexFailed() { $migrations = ['IndexMigration', 'UpdatedColumnIndexMigration']; $migrationsToExecute = []; foreach ($migrations as $migration) { $migrationClass = 'Oro\\Bundle\\MigrationBundle\\Tests\\Unit\\Fixture\\TestPackage\\' . $migration; $migrationsToExecute[] = new MigrationState(new $migrationClass()); } $migrationsToExecute[] = new MigrationState(new Test1BundleInstallation()); $this->setExpectedException('\\RuntimeException', 'Failed migrations: Oro\\Bundle\\MigrationBundle\\Tests\\Unit\\Fixture\\TestPackage\\UpdatedColumnIndexMigration.'); $this->executor->executeUp($migrationsToExecute); $this->assertEquals('> Oro\\Bundle\\MigrationBundle\\Tests\\Unit\\Fixture\\TestPackage\\UpdatedColumnIndexMigration', $this->logger->getMessages()[2]); $this->assertEquals(' ERROR: Could not create index for column with length more than 255.' . ' Please correct "key" column length "index_table2" in table in' . ' "Oro\\Bundle\\MigrationBundle\\Tests\\Unit\\Fixture\\TestPackage\\UpdatedColumnIndexMigration" migration', $this->logger->getMessages()[3]); $this->assertEquals('> Oro\\Bundle\\MigrationBundle\\Tests\\Unit\\Fixture\\TestPackage\\Test1Bundle\\Migrations\\Schema' . '\\Test1BundleInstallation - skipped', $this->logger->getMessages()[4]); }