Skip to content

Commit a9f6124

Browse files
authored
Merge pull request #15 from alexander-schranz/feature/symfony-5-compatibility
Add compatibility for symfony 5 and specify required symfony packages
2 parents 6a6c52b + 8e6fadf commit a9f6124

12 files changed

+67
-14
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,6 @@ Tests/Resources/app/cache
22
Tests/Resources/app/logs
33
composer.lock
44
vendor
5+
.phpunit.result.cache
6+
Tests/Resources/App/var/cache
7+
Tests/Resources/App/var/logs

.travis.yml

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,36 +10,56 @@ matrix:
1010
php: 5.6
1111
env:
1212
- SYMFONY_VERSION=2.8.*
13+
- MONOLOG_VERSION=^1.0
1314

1415
- language: php
1516
php: 5.6
1617
env:
1718
- SYMFONY_VERSION=3.4.*
19+
- MONOLOG_VERSION=^1.0
1820

1921
- language: php
2022
php: 7.0
2123
env:
2224
- SYMFONY_VERSION=3.4.*
25+
- MONOLOG_VERSION=^1.0
2326

2427
- language: php
2528
php: 7.1
2629
env:
2730
- SYMFONY_VERSION=4.0.*
31+
- MONOLOG_VERSION=^1.0
2832

2933
- language: php
3034
php: 7.2
3135
env:
3236
- SYMFONY_VERSION=4.0.*
37+
- MONOLOG_VERSION=^1.0
3338

3439
- language: php
3540
php: 7.2
3641
env:
3742
- SYMFONY_VERSION=4.1.*
43+
- MONOLOG_VERSION=^1.0
44+
45+
- language: php
46+
php: 7.3
47+
env:
48+
- SYMFONY_VERSION=4.4.*
49+
- MONOLOG_VERSION=^1.0
50+
51+
- language: php
52+
php: 7.4
53+
env:
54+
- SYMFONY_VERSION=5.0.*
55+
- MONOLOG_VERSION=^2.0
3856

3957
before_script:
4058
- phpenv config-add travis.php.ini
4159
- composer self-update
42-
- composer require symfony/symfony:${SYMFONY_VERSION}
60+
- composer require monolog/monolog:${MONOLOG_VERSION} --no-update
61+
- composer require symfony/symfony:${SYMFONY_VERSION} --no-update
62+
- composer update -o
4363
- vendor/symfony-cmf/testing/bin/travis/phpcr_odm_doctrine_dbal.sh
4464

45-
script: vendor/bin/phpunit
65+
script: vendor/bin/simple-phpunit

Command/InitializeCommand.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,5 +43,7 @@ public function configure()
4343
public function execute(InputInterface $input, OutputInterface $output)
4444
{
4545
$this->factory->getMigrator()->initialize();
46+
47+
return 0;
4648
}
4749
}

Command/MigrateCommand.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,5 +82,7 @@ public function execute(InputInterface $input, OutputInterface $output)
8282
}
8383

8484
$migrator->migrate($to, $output);
85+
86+
return 0;
8587
}
8688
}

Command/StatusCommand.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@ public function execute(InputInterface $input, OutputInterface $output)
7777
} else {
7878
$output->writeln('<info>No migrations have been executed</info>');
7979
}
80+
81+
return 0;
8082
}
8183

8284
private function getDate($versionName)

DependencyInjection/Configuration.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,15 @@ class Configuration implements ConfigurationInterface
2323
*/
2424
public function getConfigTreeBuilder()
2525
{
26-
$treeBuilder = new TreeBuilder();
27-
$treeBuilder->root('phpcr_migrations')
26+
$treeBuilder = new TreeBuilder('phpcr_migrations');
27+
if (method_exists($treeBuilder, 'getRootNode')) {
28+
$root = $treeBuilder->getRootNode();
29+
} else {
30+
// BC layer for symfony/config 4.1 and older
31+
$root = $treeBuilder->root('phpcr_migrations');
32+
}
33+
34+
$root
2835
->children()
2936
->scalarNode('version_node_name')->defaultValue('jcr:versions')->end()
3037
->arrayNode('paths')

Tests/Functional/MigrateCommandTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public function testUpgradeTo()
3232
$tester = $this->executeCommand('phpcr_migrations.command.migrate', array('to' => '201401011300'));
3333
$display = $tester->getDisplay();
3434

35-
$this->assertContains('Upgrading 1 version', $display);
35+
$this->assertStringContainsString('Upgrading 1 version', $display);
3636

3737
$versionNodes = $this->session->getNode('/jcr:migrations')->getNodes();
3838
$this->assertCount(1, $versionNodes);
@@ -47,7 +47,7 @@ public function testUpgradeRevertTo()
4747
$tester = $this->executeCommand('phpcr_migrations.command.migrate', array('to' => '201501011200'));
4848
$display = $tester->getDisplay();
4949

50-
$this->assertContains('Reverting 3 version', $display);
50+
$this->assertStringContainsString('Reverting 3 version', $display);
5151

5252
$versionNodes = $this->session->getNode('/jcr:migrations')->getNodes();
5353
$this->assertCount(2, $versionNodes);

Tests/Functional/StatusCommandTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public function testShowAll()
2121
$tester = $this->executeCommand('phpcr_migrations.command.status', array());
2222
$display = $tester->getDisplay();
2323

24-
$this->assertContains('No migrations have been executed', $display);
24+
$this->assertStringContainsString('No migrations have been executed', $display);
2525
}
2626

2727
/**
@@ -33,6 +33,6 @@ public function testShowCurrentVersion()
3333
$tester = $this->executeCommand('phpcr_migrations.command.status', array());
3434
$display = $tester->getDisplay();
3535

36-
$this->assertContains('201501011500', $display);
36+
$this->assertStringContainsString('201501011500', $display);
3737
}
3838
}

Tests/Resources/App/AppKernel.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,12 @@ protected function prepareContainer(ContainerBuilder $container)
4646
parent::prepareContainer($container);
4747
$container->setParameter('cmf_testing.bundle_fqn', 'DTL\Bundle\PhpcrMigrations\PhpcrMigrationsBundle');
4848
}
49+
50+
protected function getKernelParameters()
51+
{
52+
$kernelParameters = parent::getKernelParameters();
53+
$kernelParameters['kernel.root_dir'] = $this->getKernelDir();
54+
55+
return $kernelParameters;
56+
}
4957
}

Tests/Resources/App/var/cache/AppDTL_Bundle_PhpcrMigrations_Tests_Resources_App_AppKernelPhpcrDebugContainer.php

Whitespace-only changes.

0 commit comments

Comments
 (0)