|
@@ 19-45 (lines=27) @@
|
| 16 |
|
|
| 17 |
|
class MigrationExtensionManagerTest extends \PHPUnit_Framework_TestCase |
| 18 |
|
{ |
| 19 |
|
public function testValidExtension() |
| 20 |
|
{ |
| 21 |
|
$migration = new MigrationWithTestExtension(); |
| 22 |
|
$extension = new TestExtension(); |
| 23 |
|
$platform = new MySqlPlatform(); |
| 24 |
|
$nameGenerator = new DbIdentifierNameGenerator(); |
| 25 |
|
|
| 26 |
|
$manager = new MigrationExtensionManager(); |
| 27 |
|
$manager->addExtension('test', $extension); |
| 28 |
|
$manager->applyExtensions($migration); |
| 29 |
|
|
| 30 |
|
$this->assertSame($extension, $migration->getTestExtension()); |
| 31 |
|
$this->assertNull($extension->getDatabasePlatform()); |
| 32 |
|
$this->assertNull($extension->getNameGenerator()); |
| 33 |
|
|
| 34 |
|
$manager->setDatabasePlatform($platform); |
| 35 |
|
$this->assertSame($platform, $extension->getDatabasePlatform()); |
| 36 |
|
|
| 37 |
|
$manager->setNameGenerator($nameGenerator); |
| 38 |
|
$this->assertSame($nameGenerator, $extension->getNameGenerator()); |
| 39 |
|
|
| 40 |
|
$this->assertNull($migration->getDatabasePlatform()); |
| 41 |
|
$this->assertNull($migration->getNameGenerator()); |
| 42 |
|
$manager->applyExtensions($migration); |
| 43 |
|
$this->assertSame($platform, $migration->getDatabasePlatform()); |
| 44 |
|
$this->assertSame($nameGenerator, $migration->getNameGenerator()); |
| 45 |
|
} |
| 46 |
|
|
| 47 |
|
public function testAnotherValidExtension() |
| 48 |
|
{ |
|
@@ 47-73 (lines=27) @@
|
| 44 |
|
$this->assertSame($nameGenerator, $migration->getNameGenerator()); |
| 45 |
|
} |
| 46 |
|
|
| 47 |
|
public function testAnotherValidExtension() |
| 48 |
|
{ |
| 49 |
|
$migration = new MigrationWithTestExtension(); |
| 50 |
|
$extension = new AnotherTestExtension(); |
| 51 |
|
$platform = new MySqlPlatform(); |
| 52 |
|
$nameGenerator = new DbIdentifierNameGenerator(); |
| 53 |
|
|
| 54 |
|
$manager = new MigrationExtensionManager(); |
| 55 |
|
$manager->addExtension('test', $extension); |
| 56 |
|
$manager->applyExtensions($migration); |
| 57 |
|
|
| 58 |
|
$this->assertSame($extension, $migration->getTestExtension()); |
| 59 |
|
$this->assertNull($extension->getDatabasePlatform()); |
| 60 |
|
$this->assertNull($extension->getNameGenerator()); |
| 61 |
|
|
| 62 |
|
$manager->setDatabasePlatform($platform); |
| 63 |
|
$this->assertSame($platform, $extension->getDatabasePlatform()); |
| 64 |
|
|
| 65 |
|
$manager->setNameGenerator($nameGenerator); |
| 66 |
|
$this->assertSame($nameGenerator, $extension->getNameGenerator()); |
| 67 |
|
|
| 68 |
|
$this->assertNull($migration->getDatabasePlatform()); |
| 69 |
|
$this->assertNull($migration->getNameGenerator()); |
| 70 |
|
$manager->applyExtensions($migration); |
| 71 |
|
$this->assertSame($platform, $migration->getDatabasePlatform()); |
| 72 |
|
$this->assertSame($nameGenerator, $migration->getNameGenerator()); |
| 73 |
|
} |
| 74 |
|
|
| 75 |
|
public function testValidExtensionWithDependencies() |
| 76 |
|
{ |