diff --git a/tests/Integration/config/7.0/framework.yaml b/tests/Integration/config/7.0/framework.yaml new file mode 100644 index 0000000..3bf5e3f --- /dev/null +++ b/tests/Integration/config/7.0/framework.yaml @@ -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 diff --git a/tests/Integration/config/7.0/messenger.yaml b/tests/Integration/config/7.0/messenger.yaml new file mode 100644 index 0000000..715b4f7 --- /dev/null +++ b/tests/Integration/config/7.0/messenger.yaml @@ -0,0 +1,6 @@ +framework: + messenger: + transports: + async: 'in-memory://' + routing: + 'Presta\SitemapBundle\Messenger\DumpSitemapMessage': async diff --git a/tests/Integration/config/7.0/presta_sitemap.yaml b/tests/Integration/config/7.0/presta_sitemap.yaml new file mode 100644 index 0000000..f548ca0 --- /dev/null +++ b/tests/Integration/config/7.0/presta_sitemap.yaml @@ -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 diff --git a/tests/Integration/config/7.0/routes/annotations.yaml b/tests/Integration/config/7.0/routes/annotations.yaml new file mode 100644 index 0000000..21c201d --- /dev/null +++ b/tests/Integration/config/7.0/routes/annotations.yaml @@ -0,0 +1,3 @@ +controllers: + resource: ../../../src/Controller/ + type: attribute diff --git a/tests/Integration/config/7.0/routes/presta_sitemap.yaml b/tests/Integration/config/7.0/routes/presta_sitemap.yaml new file mode 100644 index 0000000..f039169 --- /dev/null +++ b/tests/Integration/config/7.0/routes/presta_sitemap.yaml @@ -0,0 +1,2 @@ +presta_sitemap: + resource: "@PrestaSitemapBundle/config/routing.yml" diff --git a/tests/Integration/config/7.0/routes/translated.yaml b/tests/Integration/config/7.0/routes/translated.yaml new file mode 100644 index 0000000..ada2f3d --- /dev/null +++ b/tests/Integration/config/7.0/routes/translated.yaml @@ -0,0 +1,7 @@ +about: + path: + en: /about + fr: /a-propos + defaults: { _controller: \Presta\SitemapBundle\Tests\Integration\Controller\StaticController::about } + options: + sitemap: true diff --git a/tests/Integration/config/7.0/routes/xml.xml b/tests/Integration/config/7.0/routes/xml.xml new file mode 100644 index 0000000..826980b --- /dev/null +++ b/tests/Integration/config/7.0/routes/xml.xml @@ -0,0 +1,14 @@ + + + + + + Presta\SitemapBundle\Tests\Integration\Controller\StaticController::company + + + + diff --git a/tests/Integration/config/7.0/routes/yaml.yaml b/tests/Integration/config/7.0/routes/yaml.yaml new file mode 100644 index 0000000..5e24a5f --- /dev/null +++ b/tests/Integration/config/7.0/routes/yaml.yaml @@ -0,0 +1,6 @@ +yaml: + path: /contact + defaults: { _controller: \Presta\SitemapBundle\Tests\Integration\Controller\StaticController::contact } + options: + sitemap: + section: static diff --git a/tests/Integration/src/Kernel.php b/tests/Integration/src/Kernel.php index f92f4f6..3cc74ef 100644 --- a/tests/Integration/src/Kernel.php +++ b/tests/Integration/src/Kernel.php @@ -62,7 +62,7 @@ public function registerBundles(): iterable yield new \Presta\SitemapBundle\PrestaSitemapBundle(); } - public function boot() + public function boot(): void { /* force "var" dir to be removed the first time this kernel boot */ static $cleanVarDirectory = true; @@ -119,7 +119,7 @@ public function registerBundles(): iterable yield new \Presta\SitemapBundle\PrestaSitemapBundle(); } - public function boot() + public function boot(): void { /* force "var" dir to be removed the first time this kernel boot */ static $cleanVarDirectory = true; diff --git a/tests/Integration/tests/SitemapTestCase.php b/tests/Integration/tests/SitemapTestCase.php index ea65136..f4bbeec 100644 --- a/tests/Integration/tests/SitemapTestCase.php +++ b/tests/Integration/tests/SitemapTestCase.php @@ -16,11 +16,11 @@ use SimpleXMLElement; use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; -use Symfony\Component\DependencyInjection\ContainerInterface; +use Symfony\Component\DependencyInjection\Container; abstract class SitemapTestCase extends WebTestCase { - protected static function getContainer(): ContainerInterface + protected static function getContainer(): Container { if (\method_exists(KernelTestCase::class, 'getContainer')) { return parent::getContainer(); @@ -180,7 +180,7 @@ private static function assertUrlHasImage(SimpleXMLElement $url, string $section $urlLoc = (string)$url->loc; Assert::assertCount( 1, - $images = $url->xpath( + $url->xpath( sprintf('//image:image[ image:loc[ text() = "%s" ] ]', $loc) ), 'Sitemap URL "' . $urlLoc . '" of section "' . $section . '" has image "' . $loc . '"' @@ -192,7 +192,7 @@ private static function assertUrlHasVideo(SimpleXMLElement $url, string $section $urlLoc = (string)$url->loc; Assert::assertCount( 1, - $videos = $url->xpath( + $url->xpath( sprintf('//video:video[ video:content_loc[ text() = "%s" ] ]', $loc) ), 'Sitemap URL "' . $urlLoc . '" of section "' . $section . '" has video "' . $loc . '"'