|
11 | 11 |
|
12 | 12 | namespace Symfony\Bundle\MakerBundle\Tests\Maker; |
13 | 13 |
|
| 14 | +use Doctrine\Bundle\MigrationsBundle\Command\MigrationsDiffDoctrineCommand; |
14 | 15 | use Symfony\Bundle\MakerBundle\Maker\MakeMigration; |
15 | 16 | use Symfony\Bundle\MakerBundle\Test\MakerTestCase; |
16 | 17 | use Symfony\Bundle\MakerBundle\Test\MakerTestDetails; |
@@ -61,39 +62,41 @@ public function getTestDetails() |
61 | 62 | }), |
62 | 63 | ]; |
63 | 64 |
|
64 | | - yield 'migration_with_previous_migration_question' => [MakerTestDetails::createTest( |
65 | | - $this->getMakerInstance(MakeMigration::class), |
66 | | - [ |
67 | | - // confirm migration |
68 | | - 'y', |
69 | | - ]) |
70 | | - ->setFixtureFilesPath(__DIR__.'/../fixtures/MakeMigration') |
71 | | - ->configureDatabase(false) |
72 | | - ->addExtraDependencies('doctrine/orm:@stable') |
73 | | - // generate a migration first |
74 | | - ->addPreMakeCommand('php bin/console make:migration') |
75 | | - ->assert(function (string $output, string $directory) { |
76 | | - $this->assertStringContainsString('You have 1 available migrations to execute', $output); |
77 | | - $this->assertStringContainsString('Success', $output); |
78 | | - $this->assertCount(14, explode("\n", $output), 'Asserting that very specific output is shown - some should be hidden'); |
79 | | - var_dump($output); |
80 | | - }), |
81 | | - ]; |
| 65 | + // these tests are for DoctrineMigrationsBundle v3 only |
| 66 | + if (!class_exists(MigrationsDiffDoctrineCommand::class)) { |
| 67 | + yield 'migration_with_previous_migration_question' => [MakerTestDetails::createTest( |
| 68 | + $this->getMakerInstance(MakeMigration::class), |
| 69 | + [ |
| 70 | + // confirm migration |
| 71 | + 'y', |
| 72 | + ]) |
| 73 | + ->setFixtureFilesPath(__DIR__ . '/../fixtures/MakeMigration') |
| 74 | + ->configureDatabase(false) |
| 75 | + ->addExtraDependencies('doctrine/orm:@stable') |
| 76 | + // generate a migration first |
| 77 | + ->addPreMakeCommand('php bin/console make:migration') |
| 78 | + ->assert(function (string $output, string $directory) { |
| 79 | + $this->assertStringContainsString('You have 1 available migrations to execute', $output); |
| 80 | + $this->assertStringContainsString('Success', $output); |
| 81 | + $this->assertCount(14, explode("\n", $output), 'Asserting that very specific output is shown - some should be hidden'); |
| 82 | + }), |
| 83 | + ]; |
82 | 84 |
|
83 | | - yield 'migration_with_previous_migration_decline_question' => [MakerTestDetails::createTest( |
84 | | - $this->getMakerInstance(MakeMigration::class), |
85 | | - [ |
86 | | - // no to confirm |
87 | | - 'n', |
88 | | - ]) |
89 | | - ->setFixtureFilesPath(__DIR__.'/../fixtures/MakeMigration') |
90 | | - ->configureDatabase(false) |
91 | | - ->addExtraDependencies('doctrine/orm:@stable') |
92 | | - // generate a migration first |
93 | | - ->addPreMakeCommand('php bin/console make:migration') |
94 | | - ->assert(function (string $output, string $directory) { |
95 | | - $this->assertStringNotContainsString('Success', $output); |
96 | | - }), |
97 | | - ]; |
| 85 | + yield 'migration_with_previous_migration_decline_question' => [MakerTestDetails::createTest( |
| 86 | + $this->getMakerInstance(MakeMigration::class), |
| 87 | + [ |
| 88 | + // no to confirm |
| 89 | + 'n', |
| 90 | + ]) |
| 91 | + ->setFixtureFilesPath(__DIR__ . '/../fixtures/MakeMigration') |
| 92 | + ->configureDatabase(false) |
| 93 | + ->addExtraDependencies('doctrine/orm:@stable') |
| 94 | + // generate a migration first |
| 95 | + ->addPreMakeCommand('php bin/console make:migration') |
| 96 | + ->assert(function (string $output, string $directory) { |
| 97 | + $this->assertStringNotContainsString('Success', $output); |
| 98 | + }), |
| 99 | + ]; |
| 100 | + } |
98 | 101 | } |
99 | 102 | } |
0 commit comments