Skip to content
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

Symfony 7 compatibillity #631

Merged
merged 5 commits into from
Jan 7, 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
20 changes: 11 additions & 9 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,23 @@ jobs:
strategy:
fail-fast: false
matrix:
php-version: ['7.4', '8.0', '8.1', '8.2']
# Symfony 6.3 requires PHP >= 8.0, it will be installed on PHP >= 8.0
# Symfony 7.0 requires PHP >= 8.2, it will be installed on PHP >= 8.2
php-version: ['8.1', '8.2']
composer-flags: ['']
symfony-version: ['^5.4']
symfony-version: ['^6.4']
include:
- php-version: 7.4
symfony-version: "^4.4"
symfony-version: "^5.4"
composer-flags: "--prefer-lowest"
- php-version: 7.4
symfony-version: "^4.4"
- php-version: 8.0
symfony-version: "^4.4"
- php-version: 8.1
symfony-version: "^6.2"
symfony-version: "^5.4"
- php-version: 8.1
kl3sk marked this conversation as resolved.
Show resolved Hide resolved
symfony-version: "^6.4"
- php-version: 8.2
symfony-version: "^6.4"
- php-version: 8.2
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please add a testrun for php 8.3 as well?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feel free to add it in a new PR.

symfony-version: "^6.2"
symfony-version: "^7.0"

steps:
- name: Checkout
Expand Down
28 changes: 14 additions & 14 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,27 +15,27 @@
}
],
"require": {
"php": "^7.4 || ^8.0",
"php": "^7.4 || ^8.0 || ^8.1 || ^8.2",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please revert "^7.4 || ^8.0" is fine

"phpunit/phpunit": "^9.6 || ^10.0",
"symfony/browser-kit": "^4.4 || ^5.1 || ^6.0",
"symfony/framework-bundle": "^4.4 || ^5.1 || ^6.0"
"symfony/browser-kit": "^5.4 || ^6.4 || ^7.0",
"symfony/framework-bundle": "^5.4 || ^6.4 || ^7.0"
},
"require-dev": {
"ext-json": "*",
"doctrine/annotations": "^1.3 || ^2.0",
"doctrine/doctrine-bundle": "^2.1",
"doctrine/doctrine-bundle": "^2.11",
"doctrine/orm": "^2.7",
"monolog/monolog": "~1.11",
"symfony/css-selector": "^4.4 || ^5.1 || ^6.0",
"symfony/doctrine-bridge": "^4.4 || ^5.1 || ^6.0",
"symfony/form": "^4.4 || ^5.1 || ^6.0",
"symfony/http-kernel": "^4.4 || ^5.1 || ^6.0",
"monolog/monolog": "^1.25.1 || ^2.0 || ^3.0",
"symfony/css-selector": "^5.4 || ^6.4 || ^7.0",
"symfony/doctrine-bridge": "^5.4 || ^6.4 || ^7.0",
"symfony/form": "^5.4 || ^6.4 || ^7.0",
"symfony/http-kernel": "^5.4 || ^6.4 || ^7.0",
"symfony/monolog-bundle": "^3.4",
"symfony/security-bundle": "^4.4 || ^5.1 || ^6.0",
"symfony/twig-bundle": "^4.4 || ^5.1 || ^6.0",
"symfony/validator": "^4.4 || ^5.1 || ^6.0",
"symfony/yaml": "^4.4 || ^5.1 || ^6.0",
"twig/twig": "^2.0 || ^3.0"
"symfony/security-bundle": "^5.4 || ^6.4 || ^7.0",
"symfony/twig-bundle": "^5.4 || ^6.4 || ^7.0",
"symfony/validator": "^5.4 || ^6.4 || ^7.0",
"symfony/yaml": "^5.4 || ^6.4 || ^7.0",
"twig/twig": "^2.0 || ^3.8"
},
"conflict": {
"symfony/framework-bundle": "4.3.0"
Expand Down
6 changes: 5 additions & 1 deletion tests/App/AppKernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,11 @@ public function registerBundles(): array

public function registerContainerConfiguration(LoaderInterface $loader): void
{
$loader->load(__DIR__.'/config.yml');
if (phpversion() >= '8.1') {
$loader->load(__DIR__.'/config_php8.yml');
} else {
$loader->load(__DIR__.'/config.yml');
}

if (Kernel::MAJOR_VERSION >= 5) {
$loader->load(__DIR__.'/security_5.yml');
Expand Down
13 changes: 13 additions & 0 deletions tests/App/Entity/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@
* @ORM\Entity()
* @ORM\Table("liip_user")
*/
#[
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you change this, to the following, and see if this fix some errors? On Php 7.4 run.

#[ORM\Entity()]
#[ORM\Table(name: "liip_user")]

ORM\Entity(),
ORM\Table(name: "liip_user"),
]
class User implements UserInterface
{
// Properties which will be serialized have to be "protected"
Expand All @@ -32,48 +36,57 @@ class User implements UserInterface
* @ORM\Id()
* @ORM\Column(type="integer")
*/
#[ORM\Id]
#[ORM\Column(type: "integer")]
protected $id;

/**
* @var string
* @ORM\Column(type="string", length=255)
*/
#[ORM\Column(type: "string", length: 255)]
protected $name;

/**
* @var string
* @ORM\Column(type="string", length=255)
*/
#[ORM\Column(type: "string", length: 255)]
private $email;

/**
* @var string
* @ORM\Column(type="string", length=255)
*/
#[ORM\Column(type: "string", length: 255)]
protected $password;

/**
* @var string
* @ORM\Column(type="string", length=255)
*/
#[ORM\Column(type: "string", length: 255)]
protected $salt;

/**
* @var string
* @ORM\Column(type="string", length=255)
*/
#[ORM\Column(type: "string", length: 255)]
private $algorithm;

/**
* @var bool
* @ORM\Column(type="boolean")
*/
#[ORM\Column(type: "boolean")]
private $enabled;

/**
* @var string
* @ORM\Column(type="string", length=255, nullable=true)
*/
#[ORM\Column(type: "string", length: 255, nullable: true)]
private $confirmationToken;

public function __construct()
Expand Down
82 changes: 82 additions & 0 deletions tests/App/config_php8.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# http://www.whitewashing.de/2012/02/25/symfony2_controller_testing.html

# Tests/App/config.yml
framework:
secret: secret
test: true
router: { resource: "%kernel.project_dir%/routing.yml" }
form: true
csrf_protection: true
property_access: ~
profiler:
collect: false

monolog:
handlers:
main:
type: fingers_crossed
action_level: error
handler: nested
nested:
type: stream
path: "%kernel.logs_dir%/%kernel.environment%.log"
level: debug

liip_functional_test: ~

doctrine:
dbal:
driver: pdo_sqlite
path: "%kernel.cache_dir%/test.db"
charset: UTF8
orm:
default_entity_manager: default
entity_managers:
default:
connection: default
mappings:
LiipFunctionalTestBundle:
type: attribute
dir: "%kernel.project_dir%/Entity"
prefix: 'Liip\Acme\Tests\App\Entity'

security:
providers:
chain_provider:
chain:
providers: [in_memory, main]
in_memory:
memory:
users:
foobar:
password: "12341234"
roles: 'ROLE_USER'
main:
entity: { class: Liip\Acme\Tests\App\Entity\User, property: id }
firewalls:
secured_area:
pattern: ^/admin
http_basic:
realm: "Admin Area"
provider: chain_provider
access_control:
- { path: ^/admin, roles: IS_AUTHENTICATED_FULLY }
- { path: ^/, roles: IS_AUTHENTICATED_ANONYMOUSLY }

services:
_defaults:
autowire: true
autoconfigure: true
Liip\Acme\Tests\App\Command\TestCommand:
tags: ['console.command']
Liip\Acme\Tests\App\Command\TestInteractiveCommand:
tags: ['console.command']
Liip\Acme\Tests\App\Command\TestStatusCodeCommand:
tags: ['console.command']
Liip\Acme\Tests\App\Controller\DefaultController:
tags: ['controller.service_arguments']

Symfony\Component\DependencyInjection\ContainerInterface: '@service_container'

twig:
default_path: '%kernel.project_dir%/Resources/views/'
Loading