Skip to content

Commit efa9538

Browse files
committed
skipping tests before DoctrineMigraationsBundle 3
1 parent bfda162 commit efa9538

File tree

1 file changed

+36
-33
lines changed

1 file changed

+36
-33
lines changed

tests/Maker/MakeMigrationTest.php

Lines changed: 36 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\Bundle\MakerBundle\Tests\Maker;
1313

14+
use Doctrine\Bundle\MigrationsBundle\Command\MigrationsDiffDoctrineCommand;
1415
use Symfony\Bundle\MakerBundle\Maker\MakeMigration;
1516
use Symfony\Bundle\MakerBundle\Test\MakerTestCase;
1617
use Symfony\Bundle\MakerBundle\Test\MakerTestDetails;
@@ -61,39 +62,41 @@ public function getTestDetails()
6162
}),
6263
];
6364

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+
];
8284

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+
}
98101
}
99102
}

0 commit comments

Comments
 (0)