Skip to content

Commit 51c48ca

Browse files
committed
minor #648 using stable-dev in tests to get latest fixes from Symfony (weaverryan)
This PR was squashed before being merged into the 1.0-dev branch. Discussion ---------- using stable-dev in tests to get latest fixes from Symfony This avoids a behavior change in symfony/console@6f533d9...d2c9f77 from symfony/symfony#37286 I'll create a PR to revert this after merge, which we will merge once the issue is resolved. Commits ------- 1309c01 updating test in one other spot ccfd248 forcing stable ORM in tests 6b512b8 making migration test work in all versions b5a5a11 phpcs 6af124a Guaranteeing that dev versions will get dev dependencies fd89d5d Forcing "stable" for 7.1 73f9ecc updating test for new version of migrations 0334718 Using stable-dev as default version in tests
2 parents 9191aec + 1309c01 commit 51c48ca

File tree

4 files changed

+21
-10
lines changed

4 files changed

+21
-10
lines changed

.travis.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ matrix:
1818
fast_finish: true
1919
include:
2020
- php: 7.1.33
21+
env: MAKER_TEST_VERSION=stable
2122
- php: 7.3
23+
env: MAKER_TEST_VERSION=stable-dev
2224
- php: 7.3
2325
env: MAKER_TEST_VERSION=dev
2426
allow_failures:

src/Test/MakerTestEnvironment.php

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -319,14 +319,20 @@ private function buildFlexSkeleton()
319319
$this->cachePath
320320
)->run();
321321

322-
$rootPath = str_replace('\\', '\\\\', realpath(__DIR__.'/../..'));
323-
324-
// dev deps already will allow dev deps, but we should prefer stable
325322
if (false !== strpos($targetVersion, 'dev')) {
326-
MakerTestProcess::create('composer config prefer-stable true', $this->flexPath)
323+
// make sure that dev versions allow dev deps
324+
// for the current stable minor of Symfony, by default,
325+
// minimum-stability is NOT dev, even when getting the -dev version
326+
// of symfony/skeleton
327+
MakerTestProcess::create('composer config minimum-stability dev', $this->flexPath)
328+
->run();
329+
330+
MakerTestProcess::create(['composer', 'update'], $this->flexPath)
327331
->run();
328332
}
329333

334+
$rootPath = str_replace('\\', '\\\\', realpath(__DIR__.'/../..'));
335+
330336
// processes any changes needed to the Flex project
331337
$replacements = [
332338
[
@@ -429,7 +435,7 @@ private function determineMissingDependencies(): array
429435
private function getTargetFlexVersion(): string
430436
{
431437
if (null === $this->targetFlexVersion) {
432-
$targetVersion = $_SERVER['MAKER_TEST_VERSION'] ?? 'stable';
438+
$targetVersion = $_SERVER['MAKER_TEST_VERSION'] ?? 'stable-dev';
433439

434440
if ('stable' === $targetVersion) {
435441
$this->targetFlexVersion = '';

src/Test/MakerTestProcess.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ final class MakerTestProcess
2424

2525
private function __construct($commandLine, $cwd, array $envVars, $timeout)
2626
{
27-
$this->process = method_exists(Process::class, 'fromShellCommandline')
27+
$this->process = \is_string($commandLine)
2828
? Process::fromShellCommandline($commandLine, $cwd, null, null, $timeout)
2929
: new Process($commandLine, $cwd, null, null, $timeout);
3030

tests/Maker/MakeMigrationTest.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,19 +28,22 @@ public function getTestDetails()
2828
// doctrine-migrations-bundle only requires doctrine-bundle, which
2929
// only requires doctrine/dbal. But we're testing with the ORM,
3030
// so let's install it
31-
->addExtraDependencies('doctrine/orm')
31+
->addExtraDependencies('doctrine/orm:@stable')
3232
->assert(function (string $output, string $directory) {
3333
$this->assertStringContainsString('Success', $output);
3434

35+
// support for Migrations 3 (/migrations) and earlier
36+
$migrationsDirectoryPath = file_exists($directory.'/migrations') ? 'migrations' : 'src/Migrations';
37+
3538
$finder = new Finder();
36-
$finder->in($directory.'/src/Migrations')
39+
$finder->in($directory.'/'.$migrationsDirectoryPath)
3740
->name('*.php');
3841
$this->assertCount(1, $finder);
3942

4043
// see that the exact filename is in the output
4144
$iterator = $finder->getIterator();
4245
$iterator->rewind();
43-
$this->assertStringContainsString(sprintf('"src/Migrations/%s"', $iterator->current()->getFilename()), $output);
46+
$this->assertStringContainsString(sprintf('"%s/%s"', $migrationsDirectoryPath, $iterator->current()->getFilename()), $output);
4447
}),
4548
];
4649

@@ -50,7 +53,7 @@ public function getTestDetails()
5053
->setFixtureFilesPath(__DIR__.'/../fixtures/MakeMigration')
5154
->configureDatabase()
5255
// sync the database, so no changes are needed
53-
->addExtraDependencies('doctrine/orm')
56+
->addExtraDependencies('doctrine/orm:@stable')
5457
->assert(function (string $output, string $directory) {
5558
$this->assertNotContains('Success', $output);
5659

0 commit comments

Comments
 (0)