diff --git a/.travis.yml b/.travis.yml index 52954c8e3..a14142b89 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,7 +18,9 @@ matrix: fast_finish: true include: - php: 7.1.33 + env: MAKER_TEST_VERSION=stable - php: 7.3 + env: MAKER_TEST_VERSION=stable-dev - php: 7.3 env: MAKER_TEST_VERSION=dev allow_failures: diff --git a/src/Test/MakerTestEnvironment.php b/src/Test/MakerTestEnvironment.php index 2d5b2cffe..179bfd182 100644 --- a/src/Test/MakerTestEnvironment.php +++ b/src/Test/MakerTestEnvironment.php @@ -319,14 +319,20 @@ private function buildFlexSkeleton() $this->cachePath )->run(); - $rootPath = str_replace('\\', '\\\\', realpath(__DIR__.'/../..')); - - // dev deps already will allow dev deps, but we should prefer stable if (false !== strpos($targetVersion, 'dev')) { - MakerTestProcess::create('composer config prefer-stable true', $this->flexPath) + // make sure that dev versions allow dev deps + // for the current stable minor of Symfony, by default, + // minimum-stability is NOT dev, even when getting the -dev version + // of symfony/skeleton + MakerTestProcess::create('composer config minimum-stability dev', $this->flexPath) + ->run(); + + MakerTestProcess::create(['composer', 'update'], $this->flexPath) ->run(); } + $rootPath = str_replace('\\', '\\\\', realpath(__DIR__.'/../..')); + // processes any changes needed to the Flex project $replacements = [ [ @@ -429,7 +435,7 @@ private function determineMissingDependencies(): array private function getTargetFlexVersion(): string { if (null === $this->targetFlexVersion) { - $targetVersion = $_SERVER['MAKER_TEST_VERSION'] ?? 'stable'; + $targetVersion = $_SERVER['MAKER_TEST_VERSION'] ?? 'stable-dev'; if ('stable' === $targetVersion) { $this->targetFlexVersion = ''; diff --git a/src/Test/MakerTestProcess.php b/src/Test/MakerTestProcess.php index ba56b9406..adcec946a 100644 --- a/src/Test/MakerTestProcess.php +++ b/src/Test/MakerTestProcess.php @@ -24,7 +24,7 @@ final class MakerTestProcess private function __construct($commandLine, $cwd, array $envVars, $timeout) { - $this->process = method_exists(Process::class, 'fromShellCommandline') + $this->process = \is_string($commandLine) ? Process::fromShellCommandline($commandLine, $cwd, null, null, $timeout) : new Process($commandLine, $cwd, null, null, $timeout); diff --git a/tests/Maker/MakeMigrationTest.php b/tests/Maker/MakeMigrationTest.php index 5b707c4c8..c37fef9c3 100644 --- a/tests/Maker/MakeMigrationTest.php +++ b/tests/Maker/MakeMigrationTest.php @@ -28,19 +28,22 @@ public function getTestDetails() // doctrine-migrations-bundle only requires doctrine-bundle, which // only requires doctrine/dbal. But we're testing with the ORM, // so let's install it - ->addExtraDependencies('doctrine/orm') + ->addExtraDependencies('doctrine/orm:@stable') ->assert(function (string $output, string $directory) { $this->assertStringContainsString('Success', $output); + // support for Migrations 3 (/migrations) and earlier + $migrationsDirectoryPath = file_exists($directory.'/migrations') ? 'migrations' : 'src/Migrations'; + $finder = new Finder(); - $finder->in($directory.'/src/Migrations') + $finder->in($directory.'/'.$migrationsDirectoryPath) ->name('*.php'); $this->assertCount(1, $finder); // see that the exact filename is in the output $iterator = $finder->getIterator(); $iterator->rewind(); - $this->assertStringContainsString(sprintf('"src/Migrations/%s"', $iterator->current()->getFilename()), $output); + $this->assertStringContainsString(sprintf('"%s/%s"', $migrationsDirectoryPath, $iterator->current()->getFilename()), $output); }), ]; @@ -50,7 +53,7 @@ public function getTestDetails() ->setFixtureFilesPath(__DIR__.'/../fixtures/MakeMigration') ->configureDatabase() // sync the database, so no changes are needed - ->addExtraDependencies('doctrine/orm') + ->addExtraDependencies('doctrine/orm:@stable') ->assert(function (string $output, string $directory) { $this->assertNotContains('Success', $output);