8000 Support Symfony 7 by dbu · Pull Request #215 · symfony-cmf/Testing · GitHub
[go: up one dir, main page]

Skip to content

Support Symfony 7 #215

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 14 additions & 27 deletions .github/workflows/test-application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ on:
pull_request:
push:
branches:
- 'master'
- '[0-9]+.x'
- '[0-9]+.[0-9]+'
- '[0-9]+.[0-9]+.x'
Expand All @@ -15,33 +14,22 @@ jobs:
runs-on: ubuntu-20.04

env:
SYMFONY_DEPRECATIONS_HELPER: ${{ matrix.symfony-deprecation-helper }}
SYMFONY_DEPRECATIONS_HELPER: weak
SYMFONY_REQUIRE: ${{ matrix.symfony-version }}

strategy:
fail-fast: false
matrix:
symfony-version:
- '*'
include:
- php-version: '7.1'
dependencies: 'lowest'
symfony-version: '^3.4'
symfony-deprecation-helper: 'weak'

- php-version: '7.2'
- php-version: '7.3'
- php-version: '7.4'
symfony-version: '^4.4'
- php-version: '7.4'
symfony-version: '5.0.*'
- php-version: '8.0'
- php-version: '8.0'
symfony-version: '6.0.*'
fail-fast: false
matrix:
include:
- php-version: '8.1'
dependencies: 'lowest'
- php-version: '8.1'
- php-version: '8.2'
- php-version: '8.3'

steps:
- name: Checkout project
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Install and configure PHP
uses: shivammathur/setup-php@v2
Expand All @@ -50,13 +38,12 @@ jobs:
tools: 'composer:v2'

- name: Install Symfony Flex
run: composer global require --no-progress --no-scripts --no-plugins symfony/flex

- name: Allow Symfony Flex Plugin
run: composer global config --no-plugins allow-plugins.symfony/flex true
run: |
composer global require --no-progress --no-scripts --no-plugins symfony/flex
composer global config --no-plugins allow-plugins.symfony/flex true

- name: Install dependencies with Composer
uses: ramsey/composer-install@v1
uses: ramsey/composer-install@v2
with:
dependency-versions: ${{ matrix.dependencies }}
composer-options: --prefer-dist
Expand Down
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
Changelog
=========

5.x
===

5.0.0
-----

* Support Symfony 7, drop support for Symfony < 6.4
* The default framework configuration no longer enables validation attributes.
* The phpcr-odm additional namespace is expected to use attributes rather than annotations.

4.x
===

4.4.2
-----

Expand Down
14 changes: 2 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

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

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

For the install guide and reference, see:

* [symfony-cmf/testing Documentation](https://symfony.com/doc/master/cmf/components/testing/index.html)

See also:

* [All Symfony CMF documentation](https://symfony.com/doc/master/cmf/index.html) - complete Symfony CMF reference
* [Symfony CMF Website](https://cmf.symfony.com/) - introduction, live demo, support and community links
* [symfony-cmf/testing Documentation](https://github.com/symfony-cmf/symfony-cmf-docs/blob/master/components/testing.rst)

## Support

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

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

Unit and/or functional tests exist for this package. See the
[Testing documentation](https://symfony.com/doc/master/cmf/components/testing.html)
for a guide to running the tests.

Thanks to
[everyone who has contributed](contributors) already.

Expand Down
2 changes: 1 addition & 1 deletion bin/make/functional_tests_orm.mk
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ functional_tests_orm:
@echo
@echo '+++ create ORM database +++'
@${CONSOLE} doctrine:schema:drop --env=orm --force
@${CONSOLE} doctrine:database:create --env=orm
@${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"
@${CONSOLE} doctrine:schema:create --env=orm
@echo '+++ run ORM functional tests +++'
ifeq ($(HAS_XDEBUG), 0)
Expand Down
18 changes: 0 additions & 18 deletions bootstrap/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,24 +21,6 @@
exit(1);
}

use Doctrine\Common\Annotations\AnnotationRegistry;

if (method_exists(AnnotationRegistry::class, 'registerLoader')) {
AnnotationRegistry::registerLoader(function ($class) use ($loader) {
$loader->loadClass($class);

// this was class_exists($class, false) i.e. do not autoload.
// this is required so that custom annotations (e.g. TreeUiBundle
// annotations) are autoloaded - but they should be found by the
// composer loader above.
//
// This probably slows things down.
//
// @todo: Fix me.
return class_exists($class);
});
}

if (!defined('CMF_TEST_ROOT_DIR')) {
define('CMF_TEST_ROOT_DIR', realpath(__DIR__.'/..'));
}
Expand Down
30 changes: 14 additions & 16 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,25 @@
}
],
"require": {
"php": "^7.1|^8.0",
"php": "^8.1",
"doctrine/data-fixtures": "^1.2",
"symfony/browser-kit": "^3.4.26 || ^4.3.8 || ^5.0 || ^6.0"
"symfony/browser-kit": "^6.4 || ^7.0"
},
"require-dev": {
"doctrine/doctrine-bundle": "^1.8 || ^2.0",
"doctrine/phpcr-bundle": "^1.3 || ^2.0.0",
"symfony/console": "^3.4.26 || ^4.3.8 || ^5.0 || ^6.0",
"symfony/dependency-injection": "^3.4.26 || ^4.3.8 || ^5.0 || ^6.0",
"symfony/doctrine-bridge": "^3.4.26 || ^4.3.8 || ^5.0 || ^6.0",
"symfony/framework-bundle": "^3.4.26 || ^4.3.8 || ^5.0 || ^6.0",
"symfony/http-kernel": "^3.4.26 || ^4.3.8 || ^5.0 || ^6.0",
"doctrine/phpcr-bundle": "^3.0",
"symfony/console": "^6.4 || ^7.0",
"symfony/dependency-injection": "^6.4 || ^7.0",
"symfony/doctrine-bridge": "^6.4 || ^7.0",
"symfony/framework-bundle": "^6.4 || ^7.0",
"symfony/http-kernel": "^6.4 || ^7.0",
"symfony/monolog-bundle": "^3.5",
"symfony/security-bundle": "^3.4.26 || ^4.3.8 || ^5.0 || ^6.0",
"symfony/twig-bundle": "^3.4.26 || ^4.3.8 || ^5.0 || ^6.0",
"symfony/phpunit-bridge": "^5.4"
"symfony/security-bundle": "^6.4 || ^7.0",
"symfony/twig-bundle": "^6.4 || ^7.0",
"symfony/phpunit-bridge": "^7.0.3"
},
"conflict": {
"doctrine/phpcr-bundle": "<3.0"
},
"autoload": {
"psr-4": {
Expand All @@ -41,10 +44,5 @@
"allow-plugins": {
"composer/package-versions-deprecated": true
}
},
"extra": {
"branch-alias": {
"dev-master": "4.x-dev"
}
}
}
19 changes: 9 additions & 10 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>

<!-- http://www.phpunit.de/manual/current/en/appendixes.configuration.html -->
<phpunit
colors="true"
bootstrap="tests/bootstrap.php"
colors="true"
bootstrap="tests/bootstrap.php"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"
>

<testsuites>
<testsuite name="unit tests">
<directory>./tests</directory>
</testsuite>
</testsuites>
<testsuites>
<testsuite name="unit tests">
<directory>./tests</directory>
</testsuite>
</testsuites>

<listeners>
<listener class="Symfony\Bridge\PhpUnit\SymfonyTestsListener" />
</listeners>

</phpunit>
23 changes: 0 additions & 23 deletions resources/.travis.yml

This file was deleted.

19 changes: 4 additions & 15 deletions resources/config/dist/framework.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,36 +9,25 @@
* file that was distributed with this source code.
*/

$routerPath = '%kernel.root_dir%/config/routing.php';
if ($container->hasParameter('kernel.project_dir')) {
$routerPath = '%kernel.project_dir%/config/routing.php';
}

$config = [
'secret' => 'test',
'test' => null,
'form' => true,
'validation' => [
'enabled' => true,
'enable_annotations' => true,
],
'router' => [
'resource' => $routerPath,
'resource' => '%kernel.project_dir%/config/routing.php',
],
'default_locale' => 'en',
'translator' => [
'fallback' => 'en',
],
'session' => [
'storage_factory_id' => 'session.storage.factory.mock_file',
],
];

if (interface_exists(\Symfony\Component\HttpFoundation\Session\Storage\SessionStorageFactoryInterface::class)) {
// Symfony 5.3+
$config = array_merge($config, ['session' => ['storage_factory_id' => 'session.storage.factory.mock_file']]);
} else {
// Symfony <5.3
$config = array_merge($config, ['session' => ['storage_id' => 'session.storage.filesystem']]);
}

$container->loadFromExtension('framework', $config);

$container->loadFromExtension('twig', [
Expand Down
2 changes: 1 addition & 1 deletion resources/config/dist/phpcr_odm.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@

if (file_exists($phpcrOdmDocDir)) {
$config['odm']['mappings']['test_additional'] = [
'type' => 'annotation',
'type' => 'attribute',
'prefix' => $phpcrOdmDocPrefix,
'dir' => $phpcrOdmDocDir,
'is_bundle' => false,
Expand Down
11 changes: 1 addition & 10 deletions resources/config/dist/security.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@
*/

$config = [
'encoders' => [
'Symfony\Component\Security\Core\User\User' => 'plaintext',
],
'role_hierarchy' => [
'ROLE_ADMIN' => 'ROLE_USER',
'ROLE_SUPER_ADMIN' => ['ROLE_USER', 'ROLE_ADMIN', 'ROLE_ALLOWED_TO_SWITCH'],
Expand Down Expand Up @@ -40,13 +37,7 @@
],
];

if (class_exists(\Symfony\Component\Security\Core\Authentication\Provider\AnonymousAuthenticationProvider::class)) {
// Symfony <=5.4
$config = array_merge($config, ['firewall' => ['main' => ['anonymous' => null]]]);
}

if (interface_exists(\Symfony\Component\PasswordHasher\PasswordHasherInterface::class)) {
unset($config['encoders']);
if (class_exists(\Symfony\Component\Security\Core\Security::class)) {
$config = array_merge($config, [
'enable_authenticator_manager' => true,
'password_hashers' => ['Symfony\Component\Security\Core\User\User' => 'plaintext'],
Expand Down
Loading
0