Skip to content

Commit ace45d8

Browse files
committed
Adjust for sf7 and new doctrine versions
* drop annotations * adjust security to symfony 7 * ignore database creation failure because doctrine dbal decided to be a stickler * drop symfony 5 support
1 parent 03456ab commit ace45d8

17 files changed

+107
-289
lines changed

.github/workflows/test-application.yaml

+14-29
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ on:
44
pull_request:
55
push:
66
branches:
7-
- 'master'
87
- '[0-9]+.x'
98
- '[0-9]+.[0-9]+'
109
- '[0-9]+.[0-9]+.x'
@@ -15,35 +14,22 @@ jobs:
1514
runs-on: ubuntu-20.04
1615

1716
env:
18-
SYMFONY_DEPRECATIONS_HELPER: ${{ matrix.symfony-deprecation-helper }}
17+
SYMFONY_DEPRECATIONS_HELPER: weak
1918
SYMFONY_REQUIRE: ${{ matrix.symfony-version }}
2019

2120
strategy:
22-
fail-fast: false
23-
matrix:
24-
symfony-version:
25-
- '*'
26-
include:
27-
- php-version: '7.1'
28-
dependencies: 'lowest'
29-
symfony-version: '^3.4'
30-
symfony-deprecation-helper: 'weak'
31-
32-
- php-version: '7.2'
33-
- php-version: '7.3'
34-
- php-version: '7.4'
35-
symfony-version: '^4.4'
36-
- php-version: '7.4'
37-
symfony-version: '5.0.*'
38-
- php-version: '8.0'
39-
- php-version: '8.0'
40-
symfony-version: '6.0.*'
41-
- php-version: '8.2'
42-
symfony-version: '7.0.*'
21+
fail-fast: false
22+
matrix:
23+
include:
24+
- php-version: '8.1'
25+
dependencies: 'lowest'
26+
- php-version: '8.1'
27+
- php-version: '8.2'
28+
- php-version: '8.3'
4329

4430
steps:
4531
- name: Checkout project
46-
uses: actions/checkout@v2
32+
uses: actions/checkout@v4
4733

4834
- name: Install and configure PHP
4935
uses: shivammathur/setup-php@v2
@@ -52,13 +38,12 @@ jobs:
5238
tools: 'composer:v2'
5339

5440
- name: Install Symfony Flex
55-
run: composer global require --no-progress --no-scripts --no-plugins symfony/flex
56-
57-
- name: Allow Symfony Flex Plugin
58-
run: composer global config --no-plugins allow-plugins.symfony/flex true
41+
run: |
42+
composer global require --no-progress --no-scripts --no-plugins symfony/flex
43+
composer global config --no-plugins allow-plugins.symfony/flex true
5944
6045
- name: Install dependencies with Composer
61-
uses: ramsey/composer-install@v1
46+
uses: ramsey/composer-install@v2
6247
with:
6348
dependency-versions: ${{ matrix.dependencies }}
6449
composer-options: --prefer-dist

CHANGELOG.md

+13
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,19 @@
11
Changelog
22
=========
33

4+
5.x
5+
===
6+
7+
5.0.0
8+
-----
9+
10+
* Support Symfony 7, drop support for Symfony < 6.4
11+
* The default framework configuration no longer enables validation attributes.
12+
* The phpcr-odm additional namespace is expected to use attributes rather than annotations.
13+
14+
4.x
15+
===
16+
417
4.4.2
518
-----
619

README.md

+2-12
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
[![Total Downloads](https://poser.pugx.org/symfony-cmf/testing/downloads)](https://packagist.org/packages/symfony-cmf/testing)
88
[![Monthly Downloads](https://poser.pugx.org/symfony-cmf/testing/d/monthly)](https://packagist.org/packages/symfony-cmf/testing)
9-
[![Daily Downloads](https://poser.pugx.org/symfony-cmf/testing/d/daily)](https://packagist.org/packages/symfony-cmf/testing)
109

1110
This package is part of the [Symfony Content Management Framework (CMF)](https://cmf.symfony.com/) and licensed
1211
under the [MIT License](LICENSE).
@@ -18,12 +17,7 @@ the context of the CMF.
1817

1918
For the install guide and reference, see:
2019

21-
* [symfony-cmf/testing Documentation](https://symfony.com/doc/master/cmf/components/testing/index.html)
22-
23-
See also:
24-
25-
* [All Symfony CMF documentation](https://symfony.com/doc/master/cmf/index.html) - complete Symfony CMF reference
26-
* [Symfony CMF Website](https://cmf.symfony.com/) - introduction, live demo, support and community links
20+
* [symfony-cmf/testing Documentation](https://github.com/symfony-cmf/symfony-cmf-docs/blob/master/components/testing.rst)
2721

2822
## Support
2923

@@ -32,13 +26,9 @@ For general support and questions, please use [StackOverflow](https://stackoverf
3226
## Contributing
3327

3428
Pull requests are welcome. Please see our
35-
[CONTRIBUTING](https://github.com/symfony-cmf/blob/master/CONTRIBUTING.md)
29+
[CONTRIBUTING](https://github.com/symfony-cmf/testing/blob/5.x/CONTRIBUTING.md)
3630
guide.
3731

38-
Unit and/or functional tests exist for this package. See the
39-
[Testing documentation](https://symfony.com/doc/master/cmf/components/testing.html)
40-
for a guide to running the tests.
41-
4232
Thanks to
4333
[everyone who has contributed](contributors) already.
4434

bin/make/functional_tests_orm.mk

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ functional_tests_orm:
44
@echo
55
@echo '+++ create ORM database +++'
66
@${CONSOLE} doctrine:schema:drop --env=orm --force
7-
@${CONSOLE} doctrine:database:create --env=orm
7+
@${CONSOLE} doctrine:database:create --env=orm || echo "Failed to create database. If this is sqlite, this is normal. Otherwise there will be an error with schema creation"
88
@${CONSOLE} doctrine:schema:create --env=orm
99
@echo '+++ run ORM functional tests +++'
1010
ifeq ($(HAS_XDEBUG), 0)

bootstrap/bootstrap.php

-18
Original file line numberDiff line numberDiff line change
@@ -21,24 +21,6 @@
2121
exit(1);
2222
}
2323

24-
use Doctrine\Common\Annotations\AnnotationRegistry;
25-
26-
if (method_exists(AnnotationRegistry::class, 'registerLoader')) {
27-
AnnotationRegistry::registerLoader(function ($class) use ($loader) {
28-
$loader->loadClass($class);
29-
30-
// this was class_exists($class, false) i.e. do not autoload.
31-
// this is required so that custom annotations (e.g. TreeUiBundle
32-
// annotations) are autoloaded - but they should be found by the
33-
// composer loader above.
34-
//
35-
// This probably slows things down.
36-
//
37-
// @todo: Fix me.
38-
return class_exists($class);
39-
});
40-
}
41-
4224
if (!defined('CMF_TEST_ROOT_DIR')) {
4325
define('CMF_TEST_ROOT_DIR', realpath(__DIR__.'/..'));
4426
}

composer.json

+14-16
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,25 @@
99
}
1010
],
1111
"require": {
12-
"php": "^7.1|^8.0",
12+
"php": "^8.1",
1313
"doctrine/data-fixtures": "^1.2",
14-
"symfony/browser-kit": "^3.4.26 || ^4.3.8 || ^5.0 || ^6.0 || ^7.0"
14+
"symfony/browser-kit": "^6.4 || ^7.0"
1515
},
1616
"require-dev": {
1717
"doctrine/doctrine-bundle": "^1.8 || ^2.0",
18-
"doctrine/phpcr-bundle": "^1.3 || ^2.0.0 || ^3.0@beta",
19-
"symfony/console": "^3.4.26 || ^4.3.8 || ^5.0 || ^6.0 || ^7.0",
20-
"symfony/dependency-injection": "^3.4.26 || ^4.3.8 || ^5.0 || ^6.0 || ^7.0",
21-
"symfony/doctrine-bridge": "^3.4.26 || ^4.3.8 || ^5.0 || ^6.0 || ^7.0",
22-
"symfony/framework-bundle": "^3.4.26 || ^4.3.8 || ^5.0 || ^6.0 || ^7.0",
23-
"symfony/http-kernel": "^3.4.26 || ^4.3.8 || ^5.0 || ^6.0 || ^7.0",
18+
"doctrine/phpcr-bundle": "^3.0",
19+
"symfony/console": "^6.4 || ^7.0",
20+
"symfony/dependency-injection": "^6.4 || ^7.0",
21+
"symfony/doctrine-bridge": "^6.4 || ^7.0",
22+
"symfony/framework-bundle": "^6.4 || ^7.0",
23+
"symfony/http-kernel": "^6.4 || ^7.0",
2424
"symfony/monolog-bundle": "^3.5",
25-
"symfony/security-bundle": "^3.4.26 || ^4.3.8 || ^5.0 || ^6.0 || ^7.0",
26-
"symfony/twig-bundle": "^3.4.26 || ^4.3.8 || ^5.0 || ^6.0 || ^7.0",
27-
"symfony/phpunit-bridge": "^5.4"
25+
"symfony/security-bundle": "^6.4 || ^7.0",
26+
"symfony/twig-bundle": "^6.4 || ^7.0",
27+
"symfony/phpunit-bridge": "^7.0.3"
28+
},
29+
"conflict": {
30+
"doctrine/phpcr-bundle": "<3.0"
2831
},
2932
"autoload": {
3033
"psr-4": {
@@ -41,10 +44,5 @@
4144
"allow-plugins": {
4245
"composer/package-versions-deprecated": true
4346
}
44-
},
45-
"extra": {
46-
"branch-alias": {
47-
"dev-master": "4.x-dev"
48-
}
4947
}
5048
}

phpunit.xml.dist

+9-10
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
3-
<!-- http://www.phpunit.de/manual/current/en/appendixes.configuration.html -->
42
<phpunit
5-
colors="true"
6-
bootstrap="tests/bootstrap.php"
3+
colors="true"
4+
bootstrap="tests/bootstrap.php"
5+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
6+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"
77
>
88

9-
<testsuites>
10-
<testsuite name="unit tests">
11-
<directory>./tests</directory>
12-
</testsuite>
13-
</testsuites>
9+
<testsuites>
10+
<testsuite name="unit tests">
11+
<directory>./tests</directory>
12+
</testsuite>
13+
</testsuites>
1414

1515
<listeners>
1616
<listener class="Symfony\Bridge\PhpUnit\SymfonyTestsListener" />
1717
</listeners>
18-
1918
</phpunit>

resources/.travis.yml

-23
This file was deleted.

resources/config/dist/framework.php

+4-15
Original file line numberDiff line numberDiff line change
@@ -9,36 +9,25 @@
99
* file that was distributed with this source code.
1010
*/
1111

12-
$routerPath = '%kernel.root_dir%/config/routing.php';
13-
if ($container->hasParameter('kernel.project_dir')) {
14-
$routerPath = '%kernel.project_dir%/config/routing.php';
15-
}
16-
1712
$config = [
1813
'secret' => 'test',
1914
'test' => null,
2015
'form' => true,
2116
'validation' => [
2217
'enabled' => true,
23-
'enable_annotations' => true,
2418
],
2519
'router' => [
26-
'resource' => $routerPath,
20+
'resource' => '%kernel.project_dir%/config/routing.php',
2721
],
2822
'default_locale' => 'en',
2923
'translator' => [
3024
'fallback' => 'en',
3125
],
26+
'session' => [
27+
'storage_factory_id' => 'session.storage.factory.mock_file',
28+
],
3229
];
3330

34-
if (interface_exists(\Symfony\Component\HttpFoundation\Session\Storage\SessionStorageFactoryInterface::class)) {
35-
// Symfony 5.3+
36-
$config = array_merge($config, ['session' => ['storage_factory_id' => 'session.storage.factory.mock_file']]);
37-
} else {
38-
// Symfony <5.3
39-
$config = array_merge($config, ['session' => ['storage_id' => 'session.storage.filesystem']]);
40-
}
41-
4231
$container->loadFromExtension('framework', $config);
4332

4433
$container->loadFromExtension('twig', [

resources/config/dist/phpcr_odm.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939

4040
if (file_exists($phpcrOdmDocDir)) {
4141
$config['odm']['mappings']['test_additional'] = [
42-
'type' => 'annotation',
42+
'type' => 'attribute',
4343
'prefix' => $phpcrOdmDocPrefix,
4444
'dir' => $phpcrOdmDocDir,
4545
'is_bundle' => false,

resources/config/dist/security.php

+1-10
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@
1010
*/
1111

1212
$config = [
13-
'encoders' => [
14-
'Symfony\Component\Security\Core\User\User' => 'plaintext',
15-
],
1613
'role_hierarchy' => [
1714
'ROLE_ADMIN' => 'ROLE_USER',
1815
'ROLE_SUPER_ADMIN' => ['ROLE_USER', 'ROLE_ADMIN', 'ROLE_ALLOWED_TO_SWITCH'],
@@ -40,13 +37,7 @@
4037
],
4138
];
4239

43-
if (class_exists(\Symfony\Component\Security\Core\Authentication\Provider\AnonymousAuthenticationProvider::class)) {
44-
// Symfony <=5.4
45-
$config = array_merge($config, ['firewall' => ['main' => ['anonymous' => null]]]);
46-
}
47-
48-
if (interface_exists(\Symfony\Component\PasswordHasher\PasswordHasherInterface::class)) {
49-
unset($config['encoders']);
40+
if (class_exists(\Symfony\Component\Security\Core\Security::class)) {
5041
$config = array_merge($config, [
5142
'enable_authenticator_manager' => true,
5243
'password_hashers' => ['Symfony\Component\Security\Core\User\User' => 'plaintext'],

0 commit comments

Comments
 (0)