Skip to content

Commit

Permalink
Allow Symfony 7, dropped support for 4.4 and bumped minimal version t…
Browse files Browse the repository at this point in the history
…o 5.4 (#324)

* Allow Symfony 7, dropped Symfony 4.4 and bumped to Syfmony 5.4

* Fix testsuite

* CI update for Symfony 7

* Dropped symfony/framework-extra-bundle usage

* Fix PHPUnit tests

* Reverted completely switching from annotation routes
  • Loading branch information
evertharmeling authored Jan 10, 2024
1 parent d09d9a1 commit 6c5d03d
Show file tree
Hide file tree
Showing 27 changed files with 309 additions and 213 deletions.
6 changes: 2 additions & 4 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,14 @@ jobs:
strategy:
matrix:
include:
- php-version: 7.1
symfony-version: 4.4.*
- php-version: 8.1
symfony-version: 4.4.*
- php-version: 7.2
symfony-version: 5.4.*
- php-version: 8.1
symfony-version: 5.4.*
- php-version: 8.1
symfony-version: 6.3.*
- php-version: 8.2
symfony-version: 7.0.*

steps:
- name: "Checkout"
Expand Down
15 changes: 7 additions & 8 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,20 @@
"issues": "https://github.com/prestaconcept/PrestaSitemapBundle/issues"
},
"require": {
"php": ">=7.1.3",
"php": ">=7.2.5|>=8.0.2",
"ext-simplexml": "*",
"symfony/console": "^4.4|^5.0|^6.0",
"symfony/framework-bundle": "^4.4|^5.0|^6.0"
"symfony/console": "^5.4|^6.0|^7.0",
"symfony/framework-bundle": "^5.4|^6.0|^7.0"
},
"require-dev": {
"doctrine/annotations": "^1.0",
"phpstan/phpstan": "^1.4",
"phpunit/phpunit": "^7.5|^8.0",
"sensio/framework-extra-bundle": "^5.5|^6.1",
"squizlabs/php_codesniffer": "^3.5",
"symfony/messenger": "^4.4|^5.0|^6.0",
"symfony/browser-kit": "^4.4|^5.0|^6.0",
"symfony/phpunit-bridge": "^4.4|^5.0|^6.0",
"symfony/yaml": "^4.4|^5.0|^6.0"
"symfony/messenger": "^5.4|^6.0|^7.0",
"symfony/browser-kit": "^5.4|^6.0|^7.0",
"symfony/phpunit-bridge": "^5.4|^6.0|^7.0",
"symfony/yaml": "^5.4|^6.0|^7.0"
},
"autoload": {
"psr-4": {
Expand Down
2 changes: 2 additions & 0 deletions src/Messenger/DumpSitemapMessageHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,13 @@

use Presta\SitemapBundle\Service\DumperInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Messenger\Attribute\AsMessageHandler;
use Symfony\Component\Routing\RouterInterface;

/**
* Message handler to handle DumpSitemapMessage asynchronously or synchronously in background
*/
#[AsMessageHandler]
class DumpSitemapMessageHandler
{
/**
Expand Down
11 changes: 0 additions & 11 deletions tests/Integration/config/4.4/framework.yaml

This file was deleted.

4 changes: 0 additions & 4 deletions tests/Integration/config/5.4/special/annotations.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,2 @@
framework:
annotations: true

sensio_framework_extra:
router:
annotations: true
15 changes: 15 additions & 0 deletions tests/Integration/config/6.4/framework.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
framework:
test: true
secret: '%env(APP_SECRET)%'
http_method_override: false
handle_all_throwables: true
session:
handler_id: null
cookie_secure: auto
cookie_samesite: lax
storage_factory_id: session.storage.factory.mock_file
php_errors:
log: true
router:
utf8: true
cache: null
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,8 @@ presta_sitemap:
default_section: static
dump_directory: "%kernel.project_dir%/public"
items_by_set: 10
alternate:
enabled: true
default_locale: en
locales: [en, fr]
i18n: symfony
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
controllers:
resource: ../../../src/Controller/
type: annotation
type: attribute
7 changes: 7 additions & 0 deletions tests/Integration/config/6.4/routes/translated.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
about:
path:
en: /about
fr: /a-propos
defaults: { _controller: \Presta\SitemapBundle\Tests\Integration\Controller\StaticController::about }
options:
sitemap: true
File renamed without changes.
15 changes: 15 additions & 0 deletions tests/Integration/config/7.0/framework.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
framework:
test: true
secret: '%env(APP_SECRET)%'
http_method_override: false
handle_all_throwables: true
session:
handler_id: null
cookie_secure: auto
cookie_samesite: lax
storage_factory_id: session.storage.factory.mock_file
php_errors:
log: true
router:
utf8: true
cache: null
6 changes: 6 additions & 0 deletions tests/Integration/config/7.0/messenger.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
framework:
messenger:
transports:
async: 'in-memory://'
routing:
'Presta\SitemapBundle\Messenger\DumpSitemapMessage': async
9 changes: 9 additions & 0 deletions tests/Integration/config/7.0/presta_sitemap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
presta_sitemap:
default_section: static
dump_directory: "%kernel.project_dir%/public"
items_by_set: 10
alternate:
enabled: true
default_locale: en
locales: [en, fr]
i18n: symfony
3 changes: 3 additions & 0 deletions tests/Integration/config/7.0/routes/controllers.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
controllers:
resource: ../../../src/Controller/
type: attribute
2 changes: 2 additions & 0 deletions tests/Integration/config/7.0/routes/presta_sitemap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
presta_sitemap:
resource: "@PrestaSitemapBundle/config/routing.yml"
7 changes: 7 additions & 0 deletions tests/Integration/config/7.0/routes/translated.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
about:
path:
en: /about
fr: /a-propos
defaults: { _controller: \Presta\SitemapBundle\Tests\Integration\Controller\StaticController::about }
options:
sitemap: true
14 changes: 14 additions & 0 deletions tests/Integration/config/7.0/routes/xml.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8" ?>

<routes xmlns="http://symfony.com/schema/routing"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/routing http://symfony.com/schema/routing/routing-1.0.xsd">

<route id="xml" path="/company">
<default key="_controller">Presta\SitemapBundle\Tests\Integration\Controller\StaticController::company</default>
<option key="sitemap">
{"priority":"0.7", "changefreq":"weekly", "section":"static"}
</option>
</route>

</routes>
6 changes: 6 additions & 0 deletions tests/Integration/config/7.0/routes/yaml.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
yaml:
path: /contact
defaults: { _controller: \Presta\SitemapBundle\Tests\Integration\Controller\StaticController::contact }
options:
sitemap:
section: static
10 changes: 2 additions & 8 deletions tests/Integration/src/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,9 @@ public function registerBundles(): iterable
{
yield new \Symfony\Bundle\FrameworkBundle\FrameworkBundle();
yield new \Presta\SitemapBundle\PrestaSitemapBundle();
if (\PHP_VERSION_ID < 80000) {
yield new \Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle();
}
}

public function boot()
public function boot(): void
{
/* force "var" dir to be removed the first time this kernel boot */
static $cleanVarDirectory = true;
Expand Down Expand Up @@ -123,12 +120,9 @@ public function registerBundles(): iterable
{
yield new \Symfony\Bundle\FrameworkBundle\FrameworkBundle();
yield new \Presta\SitemapBundle\PrestaSitemapBundle();
if (\PHP_VERSION_ID < 80000) {
yield new \Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle();
}
}

public function boot()
public function boot(): void
{
/* force "var" dir to be removed the first time this kernel boot */
static $cleanVarDirectory = true;
Expand Down
Loading

0 comments on commit 6c5d03d

Please sign in to comment.