Skip to content

Commit

Permalink
Merge pull request #447 from symfony-cmf/symfony-5
Browse files Browse the repository at this point in the history
build with symfony 5
  • Loading branch information
dbu authored Apr 28, 2020
2 parents 513c269 + 84c965b commit e7e6eb3
Show file tree
Hide file tree
Showing 29 changed files with 81 additions and 63 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ phpunit.xml
composer.lock
vendor
tests/Fixtures/App/var/
.phpunit.result.cache
13 changes: 5 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
language: php

php:
- 7.1
- 7.2
- 7.3

Expand All @@ -29,20 +28,18 @@ cache:

env:
global:
- SYMFONY_PHPUNIT_VERSION=6
- SYMFONY_PHPUNIT_VERSION=8
- COMPOSER_MEMORY_LIMIT=-1
- SYMFONY_DEPRECATIONS_HELPER="max[self]=0"

matrix:
include:
- php: 7.1
env: COMPOSER_FLAGS="--prefer-lowest" SYMFONY_REQUIRE=3.4.* SYMFONY_DEPRECATIONS_HELPER=weak
- php: 7.4
env: SYMFONY_REQUIRE=3.4.*
- php: 7.4
env: SYMFONY_REQUIRE=4.3.*
- php: 7.2
env: COMPOSER_FLAGS="--prefer-lowest" SYMFONY_REQUIRE=4.4.* SYMFONY_DEPRECATIONS_HELPER=weak
- php: 7.4
env: SYMFONY_REQUIRE=4.4.*
- php: 7.4
env: SYMFONY_REQUIRE=5.0.*
fast_finish: true
allow_failures:

Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
Changelog
=========

2.4.0
-----

* Minimum PHP version is now 7.2
* Support Symfony 5. Minimum Symfony version is now 4.4.
* If you generate routes with the CMF route generator, see the CHANGELOG of the routing component as well!

2.3.0
-----

Expand Down
27 changes: 17 additions & 10 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,29 @@
}
],
"require": {
"php": "^7.1",
"symfony-cmf/routing": "^2.1.0",
"symfony/framework-bundle": "^3.4 || ^4.3",
"php": "^7.2",
"symfony-cmf/routing": "dev-master",
"symfony/framework-bundle": "^4.4 || ^5.0",
"twig/twig": "^2.4.4 || ^3.0"
},
"require-dev": {
"jackalope/jackalope-doctrine-dbal": "^1.3",
"doctrine/phpcr-odm": "^1.4|^2.0",
"symfony/phpunit-bridge": "^4.2.2",
"matthiasnoback/symfony-dependency-injection-test": "^2.3.1",
"matthiasnoback/symfony-config-test": "^3.1.1",
"symfony/phpunit-bridge": "^5.0",
"matthiasnoback/symfony-dependency-injection-test": "^4.1.0",
"matthiasnoback/symfony-config-test": "^4.1.0",
"doctrine/orm": "^2.5",
"symfony-cmf/testing": "^3@dev",
"symfony-cmf/testing": "dev-master",
"doctrine/data-fixtures": "^1.0.0",
"symfony/form": "^3.4 || ^4.3",
"symfony/translation": "^3.4 || ^4.3",
"symfony/validator": "^3.4 || ^4.3"
"symfony/form": "^4.4 || ^5.0",
"symfony/translation": "^4.4 || ^5.0",
"symfony/validator": "^4.4 || ^5.0",
"symfony/security-bundle": "^4.4 || ^5.0",
"doctrine/doctrine-bundle": "^2.0",
"symfony/twig-bundle": "^4.4 || ^5.0",
"symfony/monolog-bundle": "^3.5",
"doctrine/phpcr-bundle": "^2.1",
"symfony/serializer": "^4.4 || ^5.0"
},
"suggest": {
"doctrine/phpcr-odm": "To enable support for the PHPCR ODM documents (^1.4)",
Expand Down
1 change: 0 additions & 1 deletion tests/Fixtures/App/config/config.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
framework:
serializer: ~
templating: false
2 changes: 1 addition & 1 deletion tests/Functional/Controller/RedirectControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class RedirectControllerTest extends BaseTestCase
*/
protected $controller;

public function setUp()
public function setUp(): void
{
parent::setUp();
$this->db('PHPCR')->createTestNode();
Expand Down
2 changes: 1 addition & 1 deletion tests/Functional/Doctrine/Orm/RedirectRouteTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class RedirectRouteTest extends OrmTestCase

private $controller;

public function setUp()
public function setUp(): void
{
parent::setUp();
$this->clearDb(Route::class);
Expand Down
2 changes: 1 addition & 1 deletion tests/Functional/Doctrine/Orm/RouteProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class RouteProviderTest extends OrmTestCase
{
private $repository;

public function setUp()
public function setUp(): void
{
parent::setUp();
$this->clearDb(Route::class);
Expand Down
2 changes: 1 addition & 1 deletion tests/Functional/Doctrine/Phpcr/RedirectRouteTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class RedirectRouteTest extends BaseTestCase
{
const ROUTE_ROOT = '/test/redirectroute';

public function setUp()
public function setUp(): void
{
parent::setUp();
$this->db('PHPCR')->createTestNode();
Expand Down
2 changes: 1 addition & 1 deletion tests/Functional/Doctrine/Phpcr/RouteProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class RouteProviderTest extends BaseTestCase
/** @var RouteProvider */
private $repository;

public function setUp()
public function setUp(): void
{
parent::setUp();
$this->db('PHPCR')->createTestNode();
Expand Down
2 changes: 1 addition & 1 deletion tests/Functional/Doctrine/Phpcr/RouteTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class RouteTest extends BaseTestCase
{
const ROUTE_ROOT = '/test/routing';

public function setUp()
public function setUp(): void
{
parent::setUp();
$this->db('PHPCR')->createTestNode();
Expand Down
2 changes: 1 addition & 1 deletion tests/Functional/Routing/DynamicRouterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class DynamicRouterTest extends BaseTestCase

const ROUTE_ROOT = '/test/routing';

public function setUp()
public function setUp(): void
{
parent::setUp();

Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/DependencyInjection/CmfRoutingExtensionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

class CmfRoutingExtensionTest extends AbstractExtensionTestCase
{
protected function getContainerExtensions()
protected function getContainerExtensions(): array
{
return [
new CmfRoutingExtension(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

class SetRouterPassTest extends AbstractCompilerPassTestCase
{
protected function registerCompilerPass(ContainerBuilder $container)
protected function registerCompilerPass(ContainerBuilder $container): void
{
$container->addCompilerPass(new SetRouterPass());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

class TemplatingValidatorPassTest extends AbstractCompilerPassTestCase
{
public function setUp()
public function setUp(): void
{
if (!\class_exists(EngineInterface::class)) {
$this->markTestSkipped();
Expand All @@ -31,7 +31,7 @@ public function setUp()
$this->registerValidatorService();
}

protected function registerCompilerPass(ContainerBuilder $container)
protected function registerCompilerPass(ContainerBuilder $container): void
{
$container->addCompilerPass(new TemplatingValidatorPass());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

class ValidationPassTest extends AbstractCompilerPassTestCase
{
protected function registerCompilerPass(ContainerBuilder $container)
protected function registerCompilerPass(ContainerBuilder $container): void
{
$container->addCompilerPass(new ValidationPass());
}
Expand Down
6 changes: 4 additions & 2 deletions tests/Unit/DependencyInjection/ConfigurationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,17 @@
use Matthias\SymfonyDependencyInjectionTest\PhpUnit\AbstractExtensionConfigurationTestCase;
use Symfony\Cmf\Bundle\RoutingBundle\DependencyInjection\CmfRoutingExtension;
use Symfony\Cmf\Bundle\RoutingBundle\DependencyInjection\Configuration;
use Symfony\Component\Config\Definition\ConfigurationInterface;
use Symfony\Component\DependencyInjection\Extension\ExtensionInterface;

class ConfigurationTest extends AbstractExtensionConfigurationTestCase
{
protected function getContainerExtension()
protected function getContainerExtension(): ExtensionInterface
{
return new CmfRoutingExtension();
}

protected function getConfiguration()
protected function getConfiguration(): ConfigurationInterface
{
return new Configuration();
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/DependencyInjection/XmlSchemaTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class XmlSchemaTest extends XmlSchemaTestCase

protected $schemaPath;

public function setUp()
public function setUp(): void
{
$this->fixturesPath = __DIR__.'/../../Fixtures/fixtures/config/';
$this->schemaPath = __DIR__.'/../../../src/Resources/config/schema/routing-1.0.xsd';
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/Doctrine/Orm/ContentRepositoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class ContentRepositoryTest extends TestCase

private $objectRepository;

public function setUp()
public function setUp(): void
{
$this->document = new \stdClass();
$this->objectManager = $this->createMock(ObjectManager::class);
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/Doctrine/Orm/RouteProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class RouteProviderTest extends TestCase
*/
private $candidatesMock;

public function setUp()
public function setUp(): void
{
$this->routeMock = $this->createMock(Route::class);
$this->route2Mock = $this->createMock(Route::class);
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/Doctrine/Phpcr/ContentRepositoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class ContentRepositoryTest extends TestCase

private $managerRegistry;

public function setUp()
public function setUp(): void
{
$this->document = new \stdClass();
$this->document2 = new \stdClass();
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/Doctrine/Phpcr/IdPrefixListenerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class IdPrefixListenerTest extends TestCase
*/
protected $routeMock;

public function setUp()
public function setUp(): void
{
$this->candidatesMock = $this->createMock(PrefixCandidates::class);
$this->candidatesMock
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/Doctrine/Phpcr/LocaleListenerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class LocaleListenerTest extends TestCase
*/
protected $routeMock;

public function setUp()
public function setUp(): void
{
$this->candidatesMock = $this->createMock(PrefixCandidates::class);

Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/Doctrine/Phpcr/RouteProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class RouteProviderTest extends TestCase
*/
protected $route2Mock;

public function setUp()
public function setUp(): void
{
$this->routeMock = $this->createMock(Route::class);
$this->route2Mock = $this->createMock(Route::class);
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/Doctrine/Phpcr/RouteTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class RouteTest extends TestCase

private $childRoute1;

public function setUp()
public function setUp(): void
{
$this->route = new Route();

Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/Form/Type/RouteTypeTypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class RouteTypeTypeTest extends TestCase
*/
private $type;

public function setUp()
public function setUp(): void
{
$this->type = new RouteTypeType();
}
Expand Down
27 changes: 23 additions & 4 deletions tests/Unit/Routing/DynamicRouterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Symfony\Component\Routing\Matcher\UrlMatcherInterface;
use Symfony\Component\Routing\RequestContext;
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface as ContractsEventDispatcherInterface;

class DynamicRouterTest extends TestCase
{
Expand Down Expand Up @@ -62,7 +63,7 @@ class DynamicRouterTest extends TestCase
*/
private $eventDispatcher;

public function setUp()
public function setUp(): void
{
$this->matcher = $this->createMock(UrlMatcherInterface::class);
$this->matcher->expects($this->once())
Expand Down Expand Up @@ -95,9 +96,15 @@ private function assertRequestAttributes($request)
*/
public function testMatch()
{
$dispatchParams = [Events::PRE_DYNAMIC_MATCH, $this->equalTo(new RouterMatchEvent())];
if ($this->eventDispatcher instanceof ContractsEventDispatcherInterface) {
// New Symfony 4.3 EventDispatcher signature
$dispatchParams = [$this->equalTo(new RouterMatchEvent()), Events::PRE_DYNAMIC_MATCH];
}

$this->eventDispatcher->expects($this->once())
->method('dispatch')
->with(Events::PRE_DYNAMIC_MATCH, $this->equalTo(new RouterMatchEvent()))
->with(...$dispatchParams)
;

$parameters = $this->router->match('/foo');
Expand All @@ -108,9 +115,15 @@ public function testMatch()

public function testMatchRequest()
{
$dispatchParams = [Events::PRE_DYNAMIC_MATCH_REQUEST, $this->equalTo(new RouterMatchEvent($this->request))];
if ($this->eventDispatcher instanceof ContractsEventDispatcherInterface) {
// New Symfony 4.3 EventDispatcher signature
$dispatchParams = [$this->equalTo(new RouterMatchEvent($this->request)), Events::PRE_DYNAMIC_MATCH_REQUEST];
}

$this->eventDispatcher->expects($this->once())
->method('dispatch')
->with(Events::PRE_DYNAMIC_MATCH_REQUEST, $this->equalTo(new RouterMatchEvent($this->request)))
->with(...$dispatchParams)
;

$parameters = $this->router->matchRequest($this->request);
Expand All @@ -126,9 +139,15 @@ public function testMatchNoRequest()
{
$this->router->setRequestStack(new RequestStack());

$dispatchParams = [Events::PRE_DYNAMIC_MATCH, $this->equalTo(new RouterMatchEvent())];
if ($this->eventDispatcher instanceof ContractsEventDispatcherInterface) {
// New Symfony 4.3 EventDispatcher signature
$dispatchParams = [$this->equalTo(new RouterMatchEvent()), Events::PRE_DYNAMIC_MATCH];
}

$this->eventDispatcher->expects($this->once())
->method('dispatch')
->with(Events::PRE_DYNAMIC_MATCH, $this->equalTo(new RouterMatchEvent()))
->with(...$dispatchParams)
;

$this->expectException(ResourceNotFoundException::class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ protected function mockEngine()
return $this->createMock(EngineInterface::class);
}

protected function setUp()
protected function setUp(): void
{
if (!\class_exists(EngineInterface::class)) {
$this->markTestSkipped();
Expand Down
Loading

0 comments on commit e7e6eb3

Please sign in to comment.