Skip to content

Commit 8289aa2

Browse files
authored
Support Symfony 5 (#80)
* Add PHP 7.4 to test matrix * Tighten all dependencies * Apply deprecation fixes
1 parent ea92e00 commit 8289aa2

File tree

7 files changed

+51
-31
lines changed

7 files changed

+51
-31
lines changed

.travis.yml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,23 @@ matrix:
1212
- php: 7.3
1313
- php: 7.3
1414
env: COMPOSER_FLAGS="--prefer-lowest"
15+
- php: 7.4
16+
- php: 7.4
17+
env: COMPOSER_FLAGS="--prefer-lowest"
1518

1619
# Test Symfony versions
17-
- php: 7.3
18-
env: SYMFONY_VERSION=3.4.*
1920
- php: 7.3
2021
env: SYMFONY_VERSION=4.4.*
2122
- php: 7.3
23+
env: SYMFONY_VERSION=5.0.*
24+
- php: 7.3
25+
env: SYMFONY_VERSION=4.4.* REMOVE_PROXY_BRIDGE="yes" EXTRA_PHPUNIT_PARAMS="--group SymfonyBridgeProxyManagerDependency"
26+
- php: 7.4
27+
env: SYMFONY_VERSION=4.4.*
28+
- php: 7.4
29+
env: SYMFONY_VERSION=5.0.*
30+
- php: 7.4
2231
env: SYMFONY_VERSION=4.4.* REMOVE_PROXY_BRIDGE="yes" EXTRA_PHPUNIT_PARAMS="--group SymfonyBridgeProxyManagerDependency"
23-
allow_failures:
24-
- env: COMPOSER_FLAGS="--prefer-lowest"
2532

2633
env:
2734
global:

composer.json

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -27,21 +27,24 @@
2727
],
2828
"require": {
2929
"php": "^7.3",
30-
"simple-bus/message-bus": "~3.0",
31-
"symfony/config": "~3.3 || ~4.0",
32-
"symfony/dependency-injection": "~3.3 || ~4.0",
33-
"symfony/http-kernel": "~3.3 || ~4.0",
34-
"symfony/yaml": "~3.3 || ~4.0"
30+
"simple-bus/message-bus": "^3.0",
31+
"symfony/config": "^4.4 || ^5.0",
32+
"symfony/dependency-injection": "^4.4 || ^5.0",
33+
"symfony/http-kernel": "^4.4 || ^5.0",
34+
"symfony/yaml": "^4.4 || ^5.0"
3535
},
3636
"require-dev": {
37-
"doctrine/doctrine-bundle": "~1.0",
38-
"doctrine/orm": "~2.5",
39-
"phpunit/phpunit": "^5.7 || ^6.0",
40-
"simple-bus/doctrine-orm-bridge": "~5.0",
41-
"symfony/framework-bundle": "~3.3 || ~4.0",
42-
"symfony/monolog-bridge": "~3.3 || ~4.0",
43-
"symfony/monolog-bundle": "~2.3 || ~3.0",
44-
"symfony/proxy-manager-bridge": "~3.3 || ~4.0"
37+
"doctrine/doctrine-bundle": "^2.0",
38+
"doctrine/orm": "^2.7",
39+
"phpunit/phpunit": "^8.5",
40+
"simple-bus/doctrine-orm-bridge": "^5.0",
41+
"symfony/framework-bundle": "^4.4 || ^5.0",
42+
"symfony/monolog-bridge": "^4.4 || ^5.0",
43+
"symfony/monolog-bundle": "^3.4",
44+
"symfony/proxy-manager-bridge": "^4.4 || ^5.0"
45+
},
46+
"conflict": {
47+
"zendframework/zend-code": "<3.3.1"
4548
},
4649
"suggest": {
4750
"doctrine/doctrine-bundle": "For integration with Doctrine ORM",

tests/Functional/NestedCommandExecutionOrderConfigurationTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public function disabling_finishes_command_before_handling_next_middleware_keeps
7575
}
7676

7777
/** {@inheritdoc} */
78-
protected function tearDown()
78+
protected function tearDown(): void
7979
{
8080
parent::tearDown();
8181

tests/Functional/SmokeTest.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use Doctrine\ORM\EntityManager;
66
use Doctrine\ORM\Tools\SchemaTool;
7+
use LogicException;
78
use SimpleBus\SymfonyBridge\Tests\Functional\SmokeTest\Auto\AutoCommand1;
89
use SimpleBus\SymfonyBridge\Tests\Functional\SmokeTest\Auto\AutoCommand2;
910
use SimpleBus\SymfonyBridge\Tests\Functional\SmokeTest\Auto\AutoEvent1;
@@ -23,7 +24,7 @@ protected static function getKernelClass()
2324
return TestKernel::class;
2425
}
2526

26-
protected function tearDown()
27+
protected function tearDown(): void
2728
{
2829
parent::tearDown();
2930

@@ -54,12 +55,12 @@ public function it_handles_a_command_then_dispatches_events_for_all_modified_ent
5455

5556
// it has logged some things
5657
$loggedMessages = file_get_contents($container->getParameter('log_file'));
57-
$this->assertContains('command_bus.DEBUG: Started handling a message', $loggedMessages);
58-
$this->assertContains('command_bus.DEBUG: Finished handling a message', $loggedMessages);
59-
$this->assertContains('event_bus.DEBUG: Started handling a message', $loggedMessages);
60-
$this->assertContains('event_bus.DEBUG: Finished handling a message', $loggedMessages);
61-
$this->assertContains('event_bus.DEBUG: Started notifying a subscriber', $loggedMessages);
62-
$this->assertContains('event_bus.DEBUG: Finished notifying a subscriber', $loggedMessages);
58+
$this->assertStringContainsString('command_bus.DEBUG: Started handling a message', $loggedMessages);
59+
$this->assertStringContainsString('command_bus.DEBUG: Finished handling a message', $loggedMessages);
60+
$this->assertStringContainsString('event_bus.DEBUG: Started handling a message', $loggedMessages);
61+
$this->assertStringContainsString('event_bus.DEBUG: Finished handling a message', $loggedMessages);
62+
$this->assertStringContainsString('event_bus.DEBUG: Started notifying a subscriber', $loggedMessages);
63+
$this->assertStringContainsString('event_bus.DEBUG: Finished notifying a subscriber', $loggedMessages);
6364
}
6465

6566
/**
@@ -136,14 +137,13 @@ public function it_can_auto_register_command_handlers_using_public_method()
136137

137138
/**
138139
* @test
139-
*
140140
* @group SymfonyBridgeProxyManagerDependency
141-
*
142-
* @expectedException \LogicException
143-
* @expectedExceptionMessage In order to use bundle "DoctrineOrmBridgeBundle" you need to require "symfony/proxy-manager-bridge" package.
144141
*/
145142
public function fails_because_of_mising_dependency()
146143
{
144+
$this->expectException(LogicException::class);
145+
$this->expectExceptionMessage('In order to use bundle "DoctrineOrmBridgeBundle" you need to require "symfony/proxy-manager-bridge" package.');
146+
147147
self::bootKernel(['environment' => 'config2']);
148148
}
149149

tests/Functional/SmokeTest/TestKernel.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
use SimpleBus\SymfonyBridge\SimpleBusCommandBusBundle;
77
use SimpleBus\SymfonyBridge\DoctrineOrmBridgeBundle;
88
use SimpleBus\SymfonyBridge\SimpleBusEventBusBundle;
9+
use Symfony\Bundle\FrameworkBundle\FrameworkBundle;
910
use Symfony\Bundle\MonologBundle\MonologBundle;
1011
use Symfony\Component\Config\Loader\LoaderInterface;
1112
use Symfony\Component\HttpKernel\Kernel;
@@ -24,6 +25,7 @@ public function __construct($environment, $debug)
2425
public function registerBundles()
2526
{
2627
return array(
28+
new FrameworkBundle(),
2729
new DoctrineBundle(),
2830
new SimpleBusCommandBusBundle(),
2931
new SimpleBusEventBusBundle(),
@@ -47,6 +49,11 @@ public function getLogDir()
4749
return $this->tempDir . '/logs';
4850
}
4951

52+
public function getProjectDir()
53+
{
54+
return __DIR__;
55+
}
56+
5057
protected function getContainerClass()
5158
{
5259
return parent::getContainerClass() . sha1(__NAMESPACE__);

tests/Functional/SmokeTest/config.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ services:
22
annotation_reader:
33
class: Doctrine\Common\Annotations\AnnotationReader
44

5+
framework:
6+
secret: 'secret'
7+
58
doctrine:
69
dbal:
710
driver: pdo_sqlite
@@ -14,7 +17,7 @@ doctrine:
1417
mappings:
1518
test:
1619
type: annotation
17-
dir: "%kernel.root_dir%/Entity/"
20+
dir: "%kernel.project_dir%/Entity/"
1821
prefix: SimpleBus\SymfonyBridge\Tests\Functional\SmokeTest\Entity
1922
alias: Test
2023
is_bundle: false

tests/SymfonyBundle/DependencyInjection/Compiler/ConfigureMiddlewaresTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class ConfigureMiddlewaresTest extends TestCase
2727
*/
2828
private $mainBusDefinition;
2929

30-
protected function setUp()
30+
protected function setUp(): void
3131
{
3232
$this->container = new ContainerBuilder();
3333
$this->mainBusDefinition = new Definition('stdClass');

0 commit comments

Comments
 (0)