Skip to content

Commit 389449f

Browse files
authored
Merge pull request #488 from symfony-cmf/sf7
Sf7
2 parents e90e861 + 82fd21f commit 389449f

18 files changed

+127
-218
lines changed

.github/workflows/test-application.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,16 @@ jobs:
2121
fail-fast: false
2222
matrix:
2323
include:
24-
- php-version: '8.0'
24+
- php-version: '8.1'
2525
dependencies: 'lowest'
26-
- php-version: '8.0'
27-
symfony-version: '6.0.*'
2826
- php-version: '8.1'
29-
symfony-version: '6.0.*'
27+
- php-version: '8.2'
28+
- php-version: '8.3'
29+
symfony-version: '7.0.*'
3030

3131
steps:
3232
- name: Checkout project
33-
uses: actions/checkout@v2
33+
uses: actions/checkout@v4
3434

3535
- name: Install and configure PHP
3636
uses: shivammathur/setup-php@v2
@@ -45,7 +45,7 @@ jobs:
4545
composer global require --no-progress --no-scripts --no-plugins symfony/flex
4646
4747
- name: Install dependencies with Composer
48-
uses: ramsey/composer-install@v1
48+
uses: ramsey/composer-install@v2
4949
with:
5050
dependency-versions: ${{ matrix.dependencies }}
5151
composer-options: --prefer-dist

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
Changelog
22
=========
33

4+
3.1.0
5+
-----
6+
7+
* Symfony 7 support
8+
* Doctrine ORM 3 support
9+
If you use the ORM route entity, you need to migrate your database configuration as the array fields needed to be changed to the `json` type (because `array` has been removed)
10+
411
3.0.2
512
-----
613

composer.json

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -15,28 +15,28 @@
1515
}
1616
],
1717
"require": {
18-
"php": "^8.0",
19-
"symfony-cmf/routing": "^3.0",
20-
"symfony/framework-bundle": "^6.0"
18+
"php": "^8.1",
19+
"symfony-cmf/routing": "^3.0.3",
20+
"symfony/framework-bundle": "^6.4 || ^7.0"
2121
},
2222
"require-dev": {
23-
"jackalope/jackalope-doctrine-dbal": "^1.3",
24-
"doctrine/phpcr-odm": "^1.4|^2.0",
25-
"symfony/phpunit-bridge": "^6.0",
26-
"matthiasnoback/symfony-dependency-injection-test": "^4.1.0",
27-
"matthiasnoback/symfony-config-test": "^4.1.0",
28-
"doctrine/orm": "^2.9",
29-
"symfony-cmf/testing": "dev-master as 4.2.0",
3023
"doctrine/data-fixtures": "^1.0.0",
31-
"symfony/form": "^6.0",
32-
"symfony/translation": "^6.0",
33-
"symfony/validator": "^6.0",
34-
"symfony/security-bundle": "^6.0",
35-
"doctrine/doctrine-bundle": "^2.0",
36-
"symfony/twig-bundle": "^6.0",
24+
"doctrine/doctrine-bundle": "^2.8",
25+
"doctrine/orm": "^2.9 || ^3.0",
26+
"doctrine/phpcr-bundle": "^3.0",
27+
"doctrine/phpcr-odm": "^2.0",
28+
"jackalope/jackalope-doctrine-dbal": "^2.0",
29+
"matthiasnoback/symfony-dependency-injection-test": "^4.1.0 || ^5.1.0",
30+
"matthiasnoback/symfony-config-test": "^4.1.0 || ^5.1.0",
31+
"symfony/phpunit-bridge": "^7.0.3",
32+
"symfony/form": "^6.4 || ^7.0",
3733
"symfony/monolog-bundle": "^3.5",
38-
"doctrine/phpcr-bundle": "^2.3",
39-
"symfony/serializer": "^6.0",
34+
"symfony/security-bundle": "^6.4 || ^7.0",
35+
"symfony/serializer": "^6.4 || ^7.0",
36+
"symfony/translation": "^6.4 || ^7.0",
37+
"symfony/validator": "^6.4 || ^7.0",
38+
"symfony/twig-bundle": "^6.4 || ^7.0",
39+
"symfony-cmf/testing": "dev-fix-test-kernel as 5.0.2",
4040
"twig/twig": "^2.4.4 || ^3.0"
4141
},
4242
"suggest": {
@@ -45,10 +45,10 @@
4545
"doctrine/orm": "To enable support for the ORM entities (^2.5)"
4646
},
4747
"conflict": {
48-
"doctrine/phpcr-odm": "<1.4",
4948
"doctrine/common": "<3.1.1",
5049
"doctrine/persistence": "<1.3.0",
51-
"phpunit/phpunit": "<6"
50+
"symfony/doctrine-bridge": "<6.4.0",
51+
"symfony/security-core": "<6.4.0"
5252
},
5353
"autoload": {
5454
"psr-4": {

phpunit.xml.dist

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,33 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
3-
<!-- http://www.phpunit.de/manual/current/en/appendixes.configuration.html -->
42
<phpunit
53
colors="true"
64
bootstrap="vendor/symfony-cmf/testing/bootstrap/bootstrap.php"
5+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
6+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"
77
>
8-
98
<testsuites>
109
<testsuite name="unit tests">
1110
<directory>./tests/Unit</directory>
1211
</testsuite>
13-
1412
<testsuite name="functional tests with phpcr">
1513
<directory>./tests/Functional</directory>
1614
<exclude>./tests/Functional/Doctrine/Orm</exclude>
1715
</testsuite>
18-
1916
<testsuite name="functional tests with orm">
2017
<directory>./tests/Functional/Doctrine/Orm</directory>
2118
</testsuite>
2219
</testsuites>
2320

24-
<filter>
25-
<whitelist addUncoveredFilesFromWhitelist="true">
21+
<coverage includeUncoveredFiles="true">
22+
<include>
2623
<directory>src/</directory>
27-
<exclude>
28-
<directory>Resources/</directory>
29-
</exclude>
30-
</whitelist>
31-
</filter>
24+
</include>
25+
<exclude>
26+
<directory>src/Resources/</directory>
27+
</exclude>
28+
</coverage>
3229

3330
<php>
34-
<env name="KERNEL_CLASS" value="\Symfony\Cmf\Bundle\RoutingBundle\Tests\Fixtures\App\Kernel" />
31+
<env name="KERNEL_CLASS" value="\Symfony\Cmf\Bundle\RoutingBundle\Tests\Fixtures\App\Kernel"/>
3532
</php>
3633
</phpunit>

src/Doctrine/Orm/RedirectRoute.php

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,11 @@
1717
* {@inheritdoc}
1818
*
1919
* Provides a redirect route stored in the Doctrine ORM and used as content for generic route to provide redirects
20+
*
21+
* @property int $id
2022
*/
2123
class RedirectRoute extends RedirectRouteModel
2224
{
23-
/**
24-
* Unique id of this route.
25-
*
26-
* @var int
27-
*/
28-
protected $id;
29-
3025
protected string $serialisedParameters;
3126

3227
/**

src/Resources/config/doctrine-base/Symfony.Component.Routing.Route.orm.xml

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

55
<mapped-superclass name="Symfony\Component\Routing\Route">
66
<field name="host" type="string"/>
7-
<field name="schemes" type="array"/>
8-
<field name="methods" type="array"/>
9-
<field name="defaults" type="array"/>
10-
<field name="requirements" type="array"/>
11-
<field name="options" type="array"/>
7+
<field name="schemes" type="json"/>
8+
<field name="methods" type="json"/>
9+
<field name="defaults" type="json"/>
10+
<field name="requirements" type="json"/>
11+
<field name="options" type="json"/>
1212
<field name="condition" column="`condition`" type="string"/>
1313
</mapped-superclass>
1414

tests/Fixtures/App/Document/Content.php

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,31 +11,21 @@
1111

1212
namespace Symfony\Cmf\Bundle\RoutingBundle\Tests\Fixtures\App\Document;
1313

14-
use Doctrine\ODM\PHPCR\Mapping\Annotations as PHPCRODM;
14+
use Doctrine\ODM\PHPCR\Mapping\Attributes as PHPCRODM;
1515

16-
/**
17-
* @PHPCRODM\Document(referenceable=true)
18-
*/
16+
#[PHPCRODM\Document(referenceable: true)]
1917
class Content
2018
{
21-
/**
22-
* @PHPCRODM\Id
23-
*/
19+
#[PHPCRODM\Id()]
2420
private $id;
2521

26-
/**
27-
* @PHPCRODM\ParentDocument
28-
*/
22+
#[PHPCRODM\ParentDocument]
2923
private $parent;
3024

31-
/**
32-
* @PHPCRODM\NodeName
33-
*/
25+
#[PHPCRODM\NodeName]
3426
private $name;
3527

36-
/**
37-
* @PHPCRODM\Field(type="string")
38-
*/
28+
#[PHPCRODM\Field(type: 'string')]
3929
private $title;
4030

4131
public function setId($id)

tests/Fixtures/App/Kernel.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
class Kernel extends TestKernel
1919
{
20-
public function configure()
20+
public function configure(): void
2121
{
2222
$this->requireBundleSet('default');
2323

@@ -39,7 +39,7 @@ public function configure()
3939
}
4040
}
4141

42-
public function registerContainerConfiguration(LoaderInterface $loader)
42+
public function registerContainerConfiguration(LoaderInterface $loader): void
4343
{
4444
$loader->load(__DIR__.'/config/config_'.$this->environment.'.php');
4545
}

tests/Fixtures/App/config/config.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11
framework:
2-
serializer:
3-
enable_annotations: false
2+
serializer: ~
43
property_access: ~
5-
annotations: ~

tests/Functional/Doctrine/Orm/RedirectRouteTest.php

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,25 +14,21 @@
1414
use Symfony\Cmf\Bundle\RoutingBundle\Controller\RedirectController;
1515
use Symfony\Cmf\Bundle\RoutingBundle\Doctrine\Orm\RedirectRoute;
1616
use Symfony\Cmf\Bundle\RoutingBundle\Doctrine\Orm\Route;
17-
use Symfony\Component\HttpFoundation\RedirectResponse;
1817

1918
class RedirectRouteTest extends OrmTestCase
2019
{
21-
private $repository;
22-
23-
private $controller;
20+
private RedirectController $controller;
2421

2522
public function setUp(): void
2623
{
2724
parent::setUp();
2825
$this->clearDb(Route::class);
2926
$this->clearDb(RedirectRoute::class);
3027

31-
$this->repository = $this->getContainer()->get('cmf_routing.route_provider');
3228
$this->controller = new RedirectController($this->getContainer()->get('router'));
3329
}
3430

35-
public function testRedirectDoctrine()
31+
public function testRedirectDoctrine(): void
3632
{
3733
$route = $this->createRoute('route1', '/test');
3834

@@ -52,7 +48,6 @@ public function testRedirectDoctrine()
5248

5349
$response = $this->controller->redirectAction($redirectRoute->getContent());
5450

55-
$this->assertInstanceOf(RedirectResponse::class, $response);
5651
$this->assertSame(301, $response->getStatusCode());
5752
$this->assertSame('http://localhost/test', $response->getTargetUrl());
5853
}

tests/Functional/Doctrine/Phpcr/RouteProviderTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ public function testGetRouteCollectionForRequestFormat()
113113
*/
114114
public function testGetRouteCollectionForRequestNonPhpcrUrl()
115115
{
116-
$routes = $this->repository->getRouteCollectionForRequest(Request::create('http:///'));
116+
$routes = $this->repository->getRouteCollectionForRequest(Request::create('http://localhost/'));
117117
$this->assertInstanceOf(RouteCollection::class, $routes);
118118
$this->assertCount(1, $routes);
119119

tests/Unit/Doctrine/Orm/RouteProviderTest.php

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -201,38 +201,17 @@ public function testGetRoutesByNames(): void
201201
];
202202

203203
$this->objectRepositoryMock
204-
->expects($this->at(0))
205204
->method('findOneBy')
206-
->with(['name' => $paths[0]])
207-
->willReturn($this->routeMock)
208-
;
209-
$this->objectRepositoryMock
210-
->expects($this->at(1))
211-
->method('findOneBy')
212-
->with(['name' => $paths[1]])
213205
->willReturn($this->routeMock)
214206
;
215207

216208
$paths[] = '/no-candidate';
217209

218210
$candidatesMock = $this->createMock(CandidatesInterface::class);
219211
$candidatesMock
220-
->expects($this->at(0))
221212
->method('isCandidate')
222-
->with($paths[0])
223-
->willReturn(true)
224-
;
225-
$candidatesMock
226-
->expects($this->at(1))
227-
->method('isCandidate')
228-
->with($paths[1])
229-
->willReturn(true)
230-
;
231-
$candidatesMock
232-
->expects($this->at(2))
233-
->method('isCandidate')
234-
->with($paths[2])
235-
->willReturn(false)
213+
->withConsecutive([$paths[0]], [$paths[1]], [$paths[2]])
214+
->willReturnOnConsecutiveCalls(true, true, false)
236215
;
237216

238217
$routeProvider = new RouteProvider($this->managerRegistryMock, $candidatesMock, 'Route');

0 commit comments

Comments
 (0)