From 6b6e7ef7b01ab3f9364d5dcf3c3f36c04635d125 Mon Sep 17 00:00:00 2001 From: Oliver Kossin Date: Tue, 21 May 2024 14:46:16 +0200 Subject: [PATCH 01/40] Update Dependecies --- composer.json | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/composer.json b/composer.json index ba8ecad..f4c879a 100644 --- a/composer.json +++ b/composer.json @@ -4,13 +4,13 @@ "type": "sulu-bundle", "description": "Bundle that provides controllers and services for using Sulu as headless content management system", "require": { - "php": "^7.3 || ^8.0", - "sulu/sulu": "^2.4 || ^2.5@dev", - "symfony/config": "^4.4 || ^5.0 || ^6.0", - "symfony/dependency-injection": "^4.4 || ^5.0 || ^6.0", - "symfony/framework-bundle": "^4.4 || ^5.0 || ^6.0", - "symfony/http-foundation": "^4.4 || ^5.0 || ^6.0", - "symfony/http-kernel": "^4.4 || ^5.0 || ^6.0" + "php": "^8.2 || ^8.3", + "sulu/sulu": "^2.4 || ^2.5@dev || ^2.6@dev", + "symfony/config": "^5.4 || ^6.0 || ^7.0", + "symfony/dependency-injection": "^5.4 || ^6.0 || ^7.0", + "symfony/framework-bundle": "^5.4 || ^6.0 || ^7.0", + "symfony/http-foundation": "^5.4 || ^6.0 || ^7.0", + "symfony/http-kernel": "^5.4 || ^6.0 || ^7.0" }, "require-dev": { "coduo/php-matcher": "^5.0 || ^6.0", @@ -25,10 +25,10 @@ "phpstan/phpstan-phpunit": "^0.12", "phpstan/phpstan-symfony": "^0.12", "phpunit/phpunit": "^8.4", - "symfony/browser-kit": "^4.4 || ^5.0 || ^6.0", - "symfony/console": "^4.4 || ^5.0 || ^6.0", - "symfony/dotenv": "^4.4 || ^5.0 || ^6.0", - "symfony/error-handler": "^4.4 || ^5.0 || ^6.0", + "symfony/browser-kit": "^5.4 || ^6.0 || ^7.0", + "symfony/console": "^5.4 || ^6.0 || ^7.0", + "symfony/dotenv": "^5.4 || ^6.0 || ^7.0", + "symfony/error-handler": "^5.4 || ^6.0 || ^7.0", "symfony/monolog-bundle": "^3.1", "thecodingmachine/phpstan-strict-rules": "^0.12" }, From f16a0d5b16654a0fa5f7755969c52bf1cc274a16 Mon Sep 17 00:00:00 2001 From: Oliver Kossin Date: Tue, 21 May 2024 14:57:23 +0200 Subject: [PATCH 02/40] Set TreeBuilder Interface --- DependencyInjection/Configuration.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DependencyInjection/Configuration.php b/DependencyInjection/Configuration.php index 5f576ef..63b65ee 100644 --- a/DependencyInjection/Configuration.php +++ b/DependencyInjection/Configuration.php @@ -18,7 +18,7 @@ class Configuration implements ConfigurationInterface { - public function getConfigTreeBuilder() + public function getConfigTreeBuilder(): TreeBuilder { $treeBuilder = new TreeBuilder('sulu_headless'); $rootNode = $treeBuilder->getRootNode(); From d1db4bd0b700a2dcd4480a32ef4964d42ce3f6e8 Mon Sep 17 00:00:00 2001 From: Oliver Kossin Date: Tue, 21 May 2024 15:20:40 +0200 Subject: [PATCH 03/40] Update php versions in tests --- .github/workflows/test-application.yaml | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/.github/workflows/test-application.yaml b/.github/workflows/test-application.yaml index 5d53e44..0fb7c5c 100644 --- a/.github/workflows/test-application.yaml +++ b/.github/workflows/test-application.yaml @@ -21,15 +21,15 @@ jobs: fail-fast: false matrix: include: - - php-version: '7.3' + - php-version: '8.2' lint: false coverage: false dependency-versions: 'lowest' - tools: 'composer:v1' + tools: 'composer:v2' env: SYMFONY_DEPRECATIONS_HELPER: disabled - - php-version: '7.4' + - php-version: '8.2' lint: true coverage: true dependency-versions: 'highest' @@ -37,15 +37,7 @@ jobs: env: SYMFONY_DEPRECATIONS_HELPER: weak - - php-version: '8.0' - lint: false - coverage: false - dependency-versions: 'highest' - tools: 'composer:v2' - env: - SYMFONY_DEPRECATIONS_HELPER: weak - - - php-version: '8.1' + - php-version: '8.3' lint: false coverage: false dependency-versions: 'highest' From 939d737c35a62e91716c38d72684606cd5c7b86c Mon Sep 17 00:00:00 2001 From: Oliver Kossin Date: Tue, 21 May 2024 15:44:25 +0200 Subject: [PATCH 04/40] Update composer.json Co-authored-by: Alexander Schranz --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index f4c879a..e4ade3d 100644 --- a/composer.json +++ b/composer.json @@ -5,7 +5,7 @@ "description": "Bundle that provides controllers and services for using Sulu as headless content management system", "require": { "php": "^8.2 || ^8.3", - "sulu/sulu": "^2.4 || ^2.5@dev || ^2.6@dev", + "sulu/sulu": "^2.4 || ^2.5|| ^2.6@dev", "symfony/config": "^5.4 || ^6.0 || ^7.0", "symfony/dependency-injection": "^5.4 || ^6.0 || ^7.0", "symfony/framework-bundle": "^5.4 || ^6.0 || ^7.0", From 89b5c56fc09de07c20b49fbcac2ca17c21544a39 Mon Sep 17 00:00:00 2001 From: Oliver Kossin Date: Wed, 22 May 2024 11:30:09 +0200 Subject: [PATCH 05/40] Remove 5.0 support of php-matcher --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index e4ade3d..a1c0480 100644 --- a/composer.json +++ b/composer.json @@ -13,7 +13,7 @@ "symfony/http-kernel": "^5.4 || ^6.0 || ^7.0" }, "require-dev": { - "coduo/php-matcher": "^5.0 || ^6.0", + "coduo/php-matcher": "^6.0", "friendsofphp/php-cs-fixer": "^3.0", "handcraftedinthealps/code-coverage-checker": "^0.2.1", "handcraftedinthealps/zendsearch": "^2.0", From fbed77a65064f9b38130acc1a237a20a814a982c Mon Sep 17 00:00:00 2001 From: Oliver Kossin Date: Wed, 22 May 2024 13:00:20 +0200 Subject: [PATCH 06/40] Fix tests --- Tests/Functional/Controller/NavigationControllerTest.php | 1 + Tests/Functional/Controller/responses/navigation__get.json | 2 ++ .../Controller/responses/navigation__get_context_footer.json | 1 + .../Controller/responses/navigation__get_depth_2.json | 4 ++++ .../Controller/responses/navigation__get_depth_2_flat.json | 4 ++++ .../Controller/responses/navigation__get_excerpt.json | 2 ++ .../Functional/Controller/responses/navigation__get_uuid.json | 2 ++ 7 files changed, 16 insertions(+) diff --git a/Tests/Functional/Controller/NavigationControllerTest.php b/Tests/Functional/Controller/NavigationControllerTest.php index 95c1b55..c689273 100644 --- a/Tests/Functional/Controller/NavigationControllerTest.php +++ b/Tests/Functional/Controller/NavigationControllerTest.php @@ -173,6 +173,7 @@ public function testGetAction(array $filters, string $expectedPatternFile): void $this->websiteClient->request('GET', '/api/navigations/' . $context . '?' . \http_build_query($filters)); $response = $this->websiteClient->getResponse(); + $this->assertInstanceOf(Response::class, $response); $this->assertStringContainsString('public', (string) $response->headers->get('Cache-Control')); diff --git a/Tests/Functional/Controller/responses/navigation__get.json b/Tests/Functional/Controller/responses/navigation__get.json index d7554f1..444c446 100644 --- a/Tests/Functional/Controller/responses/navigation__get.json +++ b/Tests/Functional/Controller/responses/navigation__get.json @@ -17,6 +17,7 @@ "urls": { "de": "\/test-1" }, + "lastModified": null, "author": null, "authored": "@string@.isDateTime()", "changer": null, @@ -42,6 +43,7 @@ "urls": { "de": "\/test-2" }, + "lastModified": null, "author": null, "authored": "@string@.isDateTime()", "changer": null, diff --git a/Tests/Functional/Controller/responses/navigation__get_context_footer.json b/Tests/Functional/Controller/responses/navigation__get_context_footer.json index 1427482..7c4aa8b 100644 --- a/Tests/Functional/Controller/responses/navigation__get_context_footer.json +++ b/Tests/Functional/Controller/responses/navigation__get_context_footer.json @@ -17,6 +17,7 @@ "urls": { "de": "\/test-3" }, + "lastModified": null, "author": null, "authored": "@string@.isDateTime()", "changer": null, diff --git a/Tests/Functional/Controller/responses/navigation__get_depth_2.json b/Tests/Functional/Controller/responses/navigation__get_depth_2.json index c26ea65..3f51631 100644 --- a/Tests/Functional/Controller/responses/navigation__get_depth_2.json +++ b/Tests/Functional/Controller/responses/navigation__get_depth_2.json @@ -17,6 +17,7 @@ "urls": { "de": "\/test-1" }, + "lastModified": null, "author": null, "authored": "@string@.isDateTime()", "changer": null, @@ -41,6 +42,7 @@ "urls": { "de": "/test-1a" }, + "lastModified": null, "author": null, "authored": "@string@.isDateTime()", "changer": null, @@ -66,6 +68,7 @@ "urls": { "de": "/test-1b" }, + "lastModified": null, "author": null, "authored": "@string@.isDateTime()", "changer": null, @@ -93,6 +96,7 @@ "urls": { "de": "\/test-2" }, + "lastModified": null, "author": null, "authored": "@string@.isDateTime()", "changer": null, diff --git a/Tests/Functional/Controller/responses/navigation__get_depth_2_flat.json b/Tests/Functional/Controller/responses/navigation__get_depth_2_flat.json index d17f7e5..4d533a5 100644 --- a/Tests/Functional/Controller/responses/navigation__get_depth_2_flat.json +++ b/Tests/Functional/Controller/responses/navigation__get_depth_2_flat.json @@ -17,6 +17,7 @@ "urls": { "de": "\/test-1" }, + "lastModified": null, "author": null, "authored": "@string@.isDateTime()", "changer": null, @@ -42,6 +43,7 @@ "urls": { "de": "/test-1a" }, + "lastModified": null, "author": null, "authored": "@string@.isDateTime()", "changer": null, @@ -67,6 +69,7 @@ "urls": { "de": "\/test-2" }, + "lastModified": null, "author": null, "authored": "@string@.isDateTime()", "changer": null, @@ -92,6 +95,7 @@ "urls": { "de": "/test-1b" }, + "lastModified": null, "author": null, "authored": "@string@.isDateTime()", "changer": null, diff --git a/Tests/Functional/Controller/responses/navigation__get_excerpt.json b/Tests/Functional/Controller/responses/navigation__get_excerpt.json index 0d3aa60..d88ad65 100644 --- a/Tests/Functional/Controller/responses/navigation__get_excerpt.json +++ b/Tests/Functional/Controller/responses/navigation__get_excerpt.json @@ -21,6 +21,7 @@ "urls": { "de": "\/test-1" }, + "lastModified": null, "author": null, "authored": "@string@.isDateTime()", "order": 20, @@ -57,6 +58,7 @@ "urls": { "de": "\/test-2" }, + "lastModified": null, "author": null, "authored": "@string@.isDateTime()", "order": 30, diff --git a/Tests/Functional/Controller/responses/navigation__get_uuid.json b/Tests/Functional/Controller/responses/navigation__get_uuid.json index a4958d5..b694877 100644 --- a/Tests/Functional/Controller/responses/navigation__get_uuid.json +++ b/Tests/Functional/Controller/responses/navigation__get_uuid.json @@ -17,6 +17,7 @@ "urls": { "de": "/test-1a" }, + "lastModified": null, "author": null, "authored": "@string@.isDateTime()", "changer": null, @@ -42,6 +43,7 @@ "urls": { "de": "/test-1b" }, + "lastModified": null, "author": null, "authored": "@string@.isDateTime()", "changer": null, From 157ff4da7354b46aa339208739595a5db2cd15ed Mon Sep 17 00:00:00 2001 From: Oliver Kossin Date: Wed, 22 May 2024 13:35:50 +0200 Subject: [PATCH 07/40] Remove old php versions --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index a1c0480..9c62fb9 100644 --- a/composer.json +++ b/composer.json @@ -5,7 +5,7 @@ "description": "Bundle that provides controllers and services for using Sulu as headless content management system", "require": { "php": "^8.2 || ^8.3", - "sulu/sulu": "^2.4 || ^2.5|| ^2.6@dev", + "sulu/sulu": "^2.6@dev", "symfony/config": "^5.4 || ^6.0 || ^7.0", "symfony/dependency-injection": "^5.4 || ^6.0 || ^7.0", "symfony/framework-bundle": "^5.4 || ^6.0 || ^7.0", From 77d84e244329e1809cc0e35381108571e9314248 Mon Sep 17 00:00:00 2001 From: Oliver Kossin Date: Wed, 22 May 2024 14:18:08 +0200 Subject: [PATCH 08/40] Update PHPUnit --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 9c62fb9..25cb056 100644 --- a/composer.json +++ b/composer.json @@ -24,7 +24,7 @@ "phpstan/phpstan-doctrine": "^0.12", "phpstan/phpstan-phpunit": "^0.12", "phpstan/phpstan-symfony": "^0.12", - "phpunit/phpunit": "^8.4", + "phpunit/phpunit": "^9.5.20", "symfony/browser-kit": "^5.4 || ^6.0 || ^7.0", "symfony/console": "^5.4 || ^6.0 || ^7.0", "symfony/dotenv": "^5.4 || ^6.0 || ^7.0", From c6e1c233886b9be2d0423566f81423ce15aa33e2 Mon Sep 17 00:00:00 2001 From: Oliver Kossin Date: Wed, 22 May 2024 14:41:10 +0200 Subject: [PATCH 09/40] Update PHPStan --- composer.json | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/composer.json b/composer.json index 25cb056..ef1c76a 100644 --- a/composer.json +++ b/composer.json @@ -20,10 +20,11 @@ "jackalope/jackalope-doctrine-dbal": "^1.3.4", "jangregor/phpstan-prophecy": "^0.8", "phpspec/prophecy": "^1.8", - "phpstan/phpstan": "^0.12", - "phpstan/phpstan-doctrine": "^0.12", - "phpstan/phpstan-phpunit": "^0.12", - "phpstan/phpstan-symfony": "^0.12", + "phpstan/phpstan": "^1.0", + "phpstan/phpstan-doctrine": "^1.0", + "phpstan/phpstan-phpunit": "^1.0", + "phpstan/phpstan-symfony": "^1.0", + "phpstan/phpstan-webmozart-assert": "^1.0", "phpunit/phpunit": "^9.5.20", "symfony/browser-kit": "^5.4 || ^6.0 || ^7.0", "symfony/console": "^5.4 || ^6.0 || ^7.0", From f1187849928e9a18537ff0fa3d2c5ad05b987326 Mon Sep 17 00:00:00 2001 From: Oliver Kossin Date: Wed, 22 May 2024 14:43:09 +0200 Subject: [PATCH 10/40] update phpstan-prophecy --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index ef1c76a..441b8e9 100644 --- a/composer.json +++ b/composer.json @@ -18,7 +18,7 @@ "handcraftedinthealps/code-coverage-checker": "^0.2.1", "handcraftedinthealps/zendsearch": "^2.0", "jackalope/jackalope-doctrine-dbal": "^1.3.4", - "jangregor/phpstan-prophecy": "^0.8", + "jangregor/phpstan-prophecy": "^1.0", "phpspec/prophecy": "^1.8", "phpstan/phpstan": "^1.0", "phpstan/phpstan-doctrine": "^1.0", From b98bc885e27026490a681932752b0b38a1fb483f Mon Sep 17 00:00:00 2001 From: Oliver Kossin Date: Wed, 22 May 2024 14:45:20 +0200 Subject: [PATCH 11/40] update phpstan-strict-rules --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 441b8e9..f55f9b2 100644 --- a/composer.json +++ b/composer.json @@ -31,7 +31,7 @@ "symfony/dotenv": "^5.4 || ^6.0 || ^7.0", "symfony/error-handler": "^5.4 || ^6.0 || ^7.0", "symfony/monolog-bundle": "^3.1", - "thecodingmachine/phpstan-strict-rules": "^0.12" + "thecodingmachine/phpstan-strict-rules": "^1.0" }, "conflict": { "doctrine/orm": "< 2.6.3", From 42fe0664849d13df10124bdf04c902cdc16a5f6e Mon Sep 17 00:00:00 2001 From: Oliver Kossin Date: Wed, 22 May 2024 14:52:39 +0200 Subject: [PATCH 12/40] Fix lint --- Content/Serializer/MediaSerializer.php | 2 +- Content/StructureResolver.php | 2 +- phpstan-baseline.neon | 336 +++++++++++++++++++++++++ phpstan.neon | 1 + 4 files changed, 339 insertions(+), 2 deletions(-) create mode 100644 phpstan-baseline.neon diff --git a/Content/Serializer/MediaSerializer.php b/Content/Serializer/MediaSerializer.php index 19941e5..c4a502f 100644 --- a/Content/Serializer/MediaSerializer.php +++ b/Content/Serializer/MediaSerializer.php @@ -96,7 +96,7 @@ public function serialize(MediaInterface $media, string $locale, ?SerializationC $fileName = \pathinfo($fileName)['filename'] . '.' . $preferredExtension; // extension brackets cannot be added here because of the urlencoding - $fileName = \pathinfo($fileName)['filename'] . '.' . 'extension'; + $fileName = \pathinfo($fileName)['filename'] . '.extension'; $formatUri = $this->formatCache->getMediaUrl( $formatMediaApi->getId(), $fileName, diff --git a/Content/StructureResolver.php b/Content/StructureResolver.php index 4f8cfce..04cc8f3 100644 --- a/Content/StructureResolver.php +++ b/Content/StructureResolver.php @@ -126,7 +126,7 @@ public function resolveProperties( } // the '.' is used to separate the extension name from the property name. - if (false !== \strpos($sourceProperty, '.')) { + if (\str_contains($sourceProperty, '.')) { [$extensionName, $propertyName] = \explode('.', $sourceProperty); if (!isset($unresolvedExtensionData[$extensionName][$propertyName])) { diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon new file mode 100644 index 0000000..cafb206 --- /dev/null +++ b/phpstan-baseline.neon @@ -0,0 +1,336 @@ +parameters: + ignoreErrors: + - + message: "#^Parameter \\#1 \\$ids of method Sulu\\\\Bundle\\\\ContactBundle\\\\Contact\\\\AccountManager\\:\\:getByIds\\(\\) expects array, mixed given\\.$#" + count: 1 + path: Content/ContentTypeResolver/AccountSelectionResolver.php + + - + message: "#^Parameter \\#1 \\$ids of method Sulu\\\\Bundle\\\\CategoryBundle\\\\Category\\\\CategoryManagerInterface\\:\\:findByIds\\(\\) expects array, mixed given\\.$#" + count: 1 + path: Content/ContentTypeResolver/CategorySelectionResolver.php + + - + message: "#^Argument of an invalid type mixed supplied for foreach, only iterables are supported\\.$#" + count: 1 + path: Content/ContentTypeResolver/ContactAccountSelectionResolver.php + + - + message: "#^Parameter \\#1 \\$string of function substr expects string, mixed given\\.$#" + count: 2 + path: Content/ContentTypeResolver/ContactAccountSelectionResolver.php + + - + message: "#^Parameter \\#1 \\$string1 of function strncmp expects string, mixed given\\.$#" + count: 2 + path: Content/ContentTypeResolver/ContactAccountSelectionResolver.php + + - + message: "#^Parameter \\#1 \\$ids of method Sulu\\\\Bundle\\\\ContactBundle\\\\Contact\\\\ContactManager\\:\\:getByIds\\(\\) expects array, mixed given\\.$#" + count: 1 + path: Content/ContentTypeResolver/ContactSelectionResolver.php + + - + message: "#^Argument of an invalid type mixed supplied for foreach, only iterables are supported\\.$#" + count: 1 + path: Content/ContentTypeResolver/ImageMapResolver.php + + - + message: "#^Cannot access offset 'hotspots' on mixed\\.$#" + count: 1 + path: Content/ContentTypeResolver/ImageMapResolver.php + + - + message: "#^Cannot access offset 'imageId' on mixed\\.$#" + count: 1 + path: Content/ContentTypeResolver/ImageMapResolver.php + + - + message: "#^Cannot access offset 'type' on mixed\\.$#" + count: 1 + path: Content/ContentTypeResolver/ImageMapResolver.php + + - + message: "#^Cannot access offset string on mixed\\.$#" + count: 2 + path: Content/ContentTypeResolver/ImageMapResolver.php + + - + message: "#^Parameter \\#1 \\$id of method Sulu\\\\Bundle\\\\MediaBundle\\\\Media\\\\Manager\\\\MediaManagerInterface\\:\\:getById\\(\\) expects int, mixed given\\.$#" + count: 1 + path: Content/ContentTypeResolver/ImageMapResolver.php + + - + message: "#^Parameter \\#1 \\$index of method Sulu\\\\Component\\\\Content\\\\Compat\\\\PropertyInterface\\:\\:initProperties\\(\\) expects int, mixed given\\.$#" + count: 1 + path: Content/ContentTypeResolver/ImageMapResolver.php + + - + message: "#^Parameter \\#2 \\$typeName of method Sulu\\\\Component\\\\Content\\\\Compat\\\\PropertyInterface\\:\\:initProperties\\(\\) expects string, mixed given\\.$#" + count: 1 + path: Content/ContentTypeResolver/ImageMapResolver.php + + - + message: "#^Cannot access offset 'ids' on mixed\\.$#" + count: 1 + path: Content/ContentTypeResolver/MediaSelectionResolver.php + + - + message: "#^Method Sulu\\\\Bundle\\\\HeadlessBundle\\\\Content\\\\ContentTypeResolver\\\\MediaSelectionResolver\\:\\:resolveApiMedias\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: Content/ContentTypeResolver/MediaSelectionResolver.php + + - + message: "#^Parameter \\#1 \\$ids of method Sulu\\\\Bundle\\\\MediaBundle\\\\Media\\\\Manager\\\\MediaManagerInterface\\:\\:getByIds\\(\\) expects array, mixed given\\.$#" + count: 1 + path: Content/ContentTypeResolver/MediaSelectionResolver.php + + - + message: "#^Parameter \\#1 \\$value of function count expects array\\|Countable, mixed given\\.$#" + count: 1 + path: Content/ContentTypeResolver/MediaSelectionResolver.php + + - + message: "#^Parameter \\#2 \\.\\.\\.\\$arrays of function array_merge expects array, mixed given\\.$#" + count: 1 + path: Content/ContentTypeResolver/MediaSelectionResolver.php + + - + message: "#^Cannot use array destructuring on string\\.$#" + count: 1 + path: Content/ContentTypeResolver/PageSelectionResolver.php + + - + message: "#^Parameter \\#1 \\$keys of function array_fill_keys expects array, mixed given\\.$#" + count: 1 + path: Content/ContentTypeResolver/PageSelectionResolver.php + + - + message: "#^Cannot cast mixed to int\\.$#" + count: 1 + path: Content/ContentTypeResolver/SingleAccountSelectionResolver.php + + - + message: "#^Cannot cast mixed to int\\.$#" + count: 1 + path: Content/ContentTypeResolver/SingleCategorySelectionResolver.php + + - + message: "#^Parameter \\#1 \\$id of method Sulu\\\\Bundle\\\\ContactBundle\\\\Contact\\\\ContactManager\\:\\:getById\\(\\) expects int, mixed given\\.$#" + count: 1 + path: Content/ContentTypeResolver/SingleContactSelectionResolver.php + + - + message: "#^Cannot access offset 0 on mixed\\.$#" + count: 1 + path: Content/ContentTypeResolver/SingleMediaSelectionResolver.php + + - + message: "#^Parameter \\#2 \\$array of function array_key_exists expects array, mixed given\\.$#" + count: 1 + path: Content/ContentTypeResolver/SingleMediaSelectionResolver.php + + - + message: "#^Parameter \\#2 \\.\\.\\.\\$arrays of function array_merge expects array, mixed given\\.$#" + count: 1 + path: Content/ContentTypeResolver/SingleMediaSelectionResolver.php + + - + message: "#^Cannot access offset 0 on mixed\\.$#" + count: 1 + path: Content/ContentTypeResolver/SinglePageSelectionResolver.php + + - + message: "#^Cannot access offset 0 on mixed\\.$#" + count: 2 + path: Content/ContentTypeResolver/SingleSnippetSelectionResolver.php + + - + message: "#^Cannot cast mixed to int\\.$#" + count: 1 + path: Content/ContentTypeResolver/SmartContentResolver.php + + - + message: "#^Argument of an invalid type mixed supplied for foreach, only iterables are supported\\.$#" + count: 1 + path: Content/ContentTypeResolver/SnippetSelectionResolver.php + + - + message: "#^Parameter \\#1 \\$uuid of method Sulu\\\\Component\\\\Content\\\\Mapper\\\\ContentMapperInterface\\:\\:load\\(\\) expects string, mixed given\\.$#" + count: 2 + path: Content/ContentTypeResolver/SnippetSelectionResolver.php + + - + message: "#^Parameter \\#1 \\$content of method Sulu\\\\Bundle\\\\MarkupBundle\\\\Markup\\\\MarkupParserInterface\\:\\:parse\\(\\) expects string, mixed given\\.$#" + count: 1 + path: Content/ContentTypeResolver/TextEditorResolver.php + + - + message: "#^Parameter \\#1 \\$filters of method Sulu\\\\Component\\\\SmartContent\\\\DataProviderInterface\\:\\:resolveResourceItems\\(\\) expects array\\{dataSource\\?\\: int\\|string\\|null, sortMethod\\?\\: 'asc'\\|'desc', sortBy\\?\\: string, tags\\?\\: array\\, tagOperator\\?\\: 'and'\\|'or', types\\?\\: array\\, categories\\?\\: array\\, categoryOperator\\?\\: 'and'\\|'or', \\.\\.\\.\\}, array given\\.$#" + count: 1 + path: Content/DataProviderResolver/AccountDataProviderResolver.php + + - + message: "#^Parameter \\#1 \\$filters of method Sulu\\\\Component\\\\SmartContent\\\\DataProviderInterface\\:\\:resolveResourceItems\\(\\) expects array\\{dataSource\\?\\: int\\|string\\|null, sortMethod\\?\\: 'asc'\\|'desc', sortBy\\?\\: string, tags\\?\\: array\\, tagOperator\\?\\: 'and'\\|'or', types\\?\\: array\\, categories\\?\\: array\\, categoryOperator\\?\\: 'and'\\|'or', \\.\\.\\.\\}, array given\\.$#" + count: 1 + path: Content/DataProviderResolver/ContactDataProviderResolver.php + + - + message: "#^Method Sulu\\\\Bundle\\\\HeadlessBundle\\\\Content\\\\DataProviderResolver\\\\DataProviderResult\\:\\:__construct\\(\\) has parameter \\$items with no value type specified in iterable type array\\.$#" + count: 1 + path: Content/DataProviderResolver/DataProviderResult.php + + - + message: "#^Method Sulu\\\\Bundle\\\\HeadlessBundle\\\\Content\\\\DataProviderResolver\\\\DataProviderResult\\:\\:getItems\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: Content/DataProviderResolver/DataProviderResult.php + + - + message: "#^Property Sulu\\\\Bundle\\\\HeadlessBundle\\\\Content\\\\DataProviderResolver\\\\DataProviderResult\\:\\:\\$items type has no value type specified in iterable type array\\.$#" + count: 1 + path: Content/DataProviderResolver/DataProviderResult.php + + - + message: "#^Parameter \\#1 \\$filters of method Sulu\\\\Component\\\\Media\\\\SmartContent\\\\MediaDataProvider\\:\\:resolveResourceItems\\(\\) expects array\\{dataSource\\?\\: int\\|string\\|null, sortMethod\\?\\: 'asc'\\|'desc', sortBy\\?\\: string, tags\\?\\: array\\, tagOperator\\?\\: 'and'\\|'or', types\\?\\: array\\, categories\\?\\: array\\, categoryOperator\\?\\: 'and'\\|'or', \\.\\.\\.\\}, array given\\.$#" + count: 1 + path: Content/DataProviderResolver/MediaDataProviderResolver.php + + - + message: "#^Parameter \\#2 \\$locale of method Sulu\\\\Bundle\\\\HeadlessBundle\\\\Content\\\\Serializer\\\\MediaSerializerInterface\\:\\:serialize\\(\\) expects string, mixed given\\.$#" + count: 1 + path: Content/DataProviderResolver/MediaDataProviderResolver.php + + - + message: "#^Cannot use array destructuring on string\\.$#" + count: 1 + path: Content/DataProviderResolver/PageDataProviderResolver.php + + - + message: "#^PHPDoc tag @var above a method has no effect\\.$#" + count: 1 + path: Content/DataProviderResolver/PageDataProviderResolver.php + + - + message: "#^PHPDoc tag @var does not specify variable name\\.$#" + count: 1 + path: Content/DataProviderResolver/PageDataProviderResolver.php + + - + message: "#^Parameter \\#1 \\$filters of method Sulu\\\\Component\\\\Content\\\\SmartContent\\\\PageDataProvider\\:\\:resolveResourceItems\\(\\) expects array\\{dataSource\\?\\: int\\|string\\|null, sortMethod\\?\\: 'asc'\\|'desc', sortBy\\?\\: string, tags\\?\\: array\\, tagOperator\\?\\: 'and'\\|'or', types\\?\\: array\\, categories\\?\\: array\\, categoryOperator\\?\\: 'and'\\|'or', \\.\\.\\.\\}, array given\\.$#" + count: 1 + path: Content/DataProviderResolver/PageDataProviderResolver.php + + - + message: "#^Parameter \\#3 \\$locale of method Sulu\\\\Bundle\\\\HeadlessBundle\\\\Content\\\\StructureResolverInterface\\:\\:resolveProperties\\(\\) expects string, mixed given\\.$#" + count: 1 + path: Content/DataProviderResolver/PageDataProviderResolver.php + + - + message: "#^Parameter \\#3 \\$webspaceKey of method Sulu\\\\Bundle\\\\HeadlessBundle\\\\Content\\\\DataProviderResolver\\\\PageDataProviderResolver\\:\\:loadPageStructures\\(\\) expects string, mixed given\\.$#" + count: 1 + path: Content/DataProviderResolver/PageDataProviderResolver.php + + - + message: "#^Parameter \\#4 \\$locale of method Sulu\\\\Bundle\\\\HeadlessBundle\\\\Content\\\\DataProviderResolver\\\\PageDataProviderResolver\\:\\:loadPageStructures\\(\\) expects string, mixed given\\.$#" + count: 1 + path: Content/DataProviderResolver/PageDataProviderResolver.php + + - + message: "#^Cannot use array destructuring on string\\.$#" + count: 1 + path: Content/DataProviderResolver/SnippetDataProviderResolver.php + + - + message: "#^PHPDoc tag @var above a method has no effect\\.$#" + count: 1 + path: Content/DataProviderResolver/SnippetDataProviderResolver.php + + - + message: "#^PHPDoc tag @var does not specify variable name\\.$#" + count: 1 + path: Content/DataProviderResolver/SnippetDataProviderResolver.php + + - + message: "#^Parameter \\#1 \\$filters of method Sulu\\\\Component\\\\SmartContent\\\\DataProviderInterface\\:\\:resolveResourceItems\\(\\) expects array\\{dataSource\\?\\: int\\|string\\|null, sortMethod\\?\\: 'asc'\\|'desc', sortBy\\?\\: string, tags\\?\\: array\\, tagOperator\\?\\: 'and'\\|'or', types\\?\\: array\\, categories\\?\\: array\\, categoryOperator\\?\\: 'and'\\|'or', \\.\\.\\.\\}, array given\\.$#" + count: 1 + path: Content/DataProviderResolver/SnippetDataProviderResolver.php + + - + message: "#^Parameter \\#1 \\$id of method Sulu\\\\Bundle\\\\MediaBundle\\\\Media\\\\Manager\\\\MediaManagerInterface\\:\\:getById\\(\\) expects int, mixed given\\.$#" + count: 1 + path: Content/Serializer/AccountSerializer.php + + - + message: "#^Parameter \\#1 \\$id of method Sulu\\\\Bundle\\\\MediaBundle\\\\Media\\\\Manager\\\\MediaManagerInterface\\:\\:getById\\(\\) expects int, mixed given\\.$#" + count: 1 + path: Content/Serializer/ContactSerializer.php + + - + message: "#^Cannot access offset string on mixed\\.$#" + count: 2 + path: Content/StructureResolver.php + + - + message: "#^Argument of an invalid type mixed supplied for foreach, only iterables are supported\\.$#" + count: 2 + path: Controller/NavigationController.php + + - + message: "#^Cannot access offset 'children' on mixed\\.$#" + count: 2 + path: Controller/NavigationController.php + + - + message: "#^Cannot access offset 'excerpt' on mixed\\.$#" + count: 3 + path: Controller/NavigationController.php + + - + message: "#^Cannot access offset 'icon' on mixed\\.$#" + count: 2 + path: Controller/NavigationController.php + + - + message: "#^Cannot access offset 'images' on mixed\\.$#" + count: 2 + path: Controller/NavigationController.php + + - + message: "#^Cannot access offset mixed on mixed\\.$#" + count: 2 + path: Controller/NavigationController.php + + - + message: "#^Cannot call method getEntity\\(\\) on mixed\\.$#" + count: 2 + path: Controller/NavigationController.php + + - + message: "#^Parameter \\#1 \\$navigation of method Sulu\\\\Bundle\\\\HeadlessBundle\\\\Controller\\\\NavigationController\\:\\:serializeExcerptMedia\\(\\) expects array, mixed given\\.$#" + count: 1 + path: Controller/NavigationController.php + + - + message: "#^Parameter \\#2 \\.\\.\\.\\$arrays of function array_merge expects array, mixed given\\.$#" + count: 1 + path: EventSubscriber/NavigationInvalidationSubscriber.php + + - + message: "#^Parameter \\#3 \\.\\.\\.\\$arrays of function array_merge expects array, mixed given\\.$#" + count: 1 + path: EventSubscriber/NavigationInvalidationSubscriber.php + + - + message: "#^Property Sulu\\\\Bundle\\\\HeadlessBundle\\\\EventSubscriber\\\\NavigationInvalidationSubscriber\\:\\:\\$navigationContexts \\(array\\\\) does not accept array\\.$#" + count: 1 + path: EventSubscriber/NavigationInvalidationSubscriber.php + + - + message: "#^Cannot access property \\$message on mixed\\.$#" + count: 1 + path: Tests/Functional/Controller/SnippetAreaControllerTest.php + + - + message: "#^Parameter \\#2 \\$object of static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertObjectHasAttribute\\(\\) expects object, mixed given\\.$#" + count: 1 + path: Tests/Functional/Controller/SnippetAreaControllerTest.php diff --git a/phpstan.neon b/phpstan.neon index b26ea37..7d46ac8 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,4 +1,5 @@ includes: + - phpstan-baseline.neon - vendor/jangregor/phpstan-prophecy/extension.neon - vendor/phpstan/phpstan-doctrine/extension.neon - vendor/phpstan/phpstan-doctrine/rules.neon From d92c58813712297df398bc9863d9d9d66539d5aa Mon Sep 17 00:00:00 2001 From: Oliver Kossin Date: Tue, 28 May 2024 13:34:34 +0200 Subject: [PATCH 13/40] Change Tests for different Sulu Versions --- .../Controller/NavigationControllerTest.php | 19 ++- .../responses/legacy/navigation__get.json | 56 +++++++++ .../navigation__get_context_footer.json | 31 +++++ .../legacy/navigation__get_depth_2.json | 107 +++++++++++++++++ .../legacy/navigation__get_depth_2_flat.json | 106 +++++++++++++++++ .../legacy/navigation__get_excerpt.json | 110 ++++++++++++++++++ .../legacy/navigation__get_uuid.json | 56 +++++++++ composer.json | 2 +- 8 files changed, 480 insertions(+), 7 deletions(-) create mode 100644 Tests/Functional/Controller/responses/legacy/navigation__get.json create mode 100644 Tests/Functional/Controller/responses/legacy/navigation__get_context_footer.json create mode 100644 Tests/Functional/Controller/responses/legacy/navigation__get_depth_2.json create mode 100644 Tests/Functional/Controller/responses/legacy/navigation__get_depth_2_flat.json create mode 100644 Tests/Functional/Controller/responses/legacy/navigation__get_excerpt.json create mode 100644 Tests/Functional/Controller/responses/legacy/navigation__get_uuid.json diff --git a/Tests/Functional/Controller/NavigationControllerTest.php b/Tests/Functional/Controller/NavigationControllerTest.php index c689273..91fd8dc 100644 --- a/Tests/Functional/Controller/NavigationControllerTest.php +++ b/Tests/Functional/Controller/NavigationControllerTest.php @@ -112,23 +112,30 @@ protected function setUp(): void */ public function provideAttributes(): \Generator { + $path = ''; + /* Todo Can be removed after ending support of sulu 2.5 */ + if (\version_compare(\Composer\InstalledVersions::getVersion('sulu/sulu') ?? '999.999.999', '2.6.0', '<') + ) { + $path = '/legacy/'; + } + yield [ [], - 'navigation__get.json', + $path . 'navigation__get.json', ]; yield [ [ 'context' => 'footer', ], - 'navigation__get_context_footer.json', + $path . 'navigation__get_context_footer.json', ]; yield [ [ 'depth' => 2, ], - 'navigation__get_depth_2.json', + $path . 'navigation__get_depth_2.json', ]; yield [ @@ -136,21 +143,21 @@ public function provideAttributes(): \Generator 'depth' => 2, 'flat' => 'true', ], - 'navigation__get_depth_2_flat.json', + $path . 'navigation__get_depth_2_flat.json', ]; yield [ [ 'excerpt' => 'true', ], - 'navigation__get_excerpt.json', + $path . 'navigation__get_excerpt.json', ]; yield [ [ 'uuid' => true, ], - 'navigation__get_uuid.json', + $path . 'navigation__get_uuid.json', ]; } diff --git a/Tests/Functional/Controller/responses/legacy/navigation__get.json b/Tests/Functional/Controller/responses/legacy/navigation__get.json new file mode 100644 index 0000000..46c14c5 --- /dev/null +++ b/Tests/Functional/Controller/responses/legacy/navigation__get.json @@ -0,0 +1,56 @@ +{ + "_embedded": { + "items": [ + { + "id": "@uuid@", + "uuid": "@uuid@", + "nodeType": 1, + "publishedState": true, + "published": "@string@.isDateTime()", + "title": "Test 1", + "locale": "de", + "webspaceKey": "sulu_io", + "template": "default", + "parent": "@uuid@", + "url": "/test-1", + "path": "@string@.match(\"/test-1\").optional()", + "urls": { + "de": "/test-1" + }, + "author": null, + "authored": "@string@.isDateTime()", + "changer": null, + "changed": "@string@.isDateTime()", + "creator": null, + "created": "@string@.isDateTime()", + "order": 20, + "children": [] + }, + { + "id": "@uuid@", + "uuid": "@uuid@", + "nodeType": 1, + "publishedState": true, + "published": "@string@.isDateTime()", + "title": "Test 2", + "locale": "de", + "webspaceKey": "sulu_io", + "template": "default", + "parent": "@uuid@", + "path": "@string@.match(\"/test-2\").optional()", + "url": "/test-2", + "urls": { + "de": "/test-2" + }, + "author": null, + "authored": "@string@.isDateTime()", + "changer": null, + "changed": "@string@.isDateTime()", + "creator": null, + "created": "@string@.isDateTime()", + "order": 30, + "children": [] + } + ] + } +} diff --git a/Tests/Functional/Controller/responses/legacy/navigation__get_context_footer.json b/Tests/Functional/Controller/responses/legacy/navigation__get_context_footer.json new file mode 100644 index 0000000..dd98272 --- /dev/null +++ b/Tests/Functional/Controller/responses/legacy/navigation__get_context_footer.json @@ -0,0 +1,31 @@ +{ + "_embedded": { + "items": [ + { + "id": "@uuid@", + "uuid": "@uuid@", + "nodeType": 1, + "publishedState": true, + "published": "@string@.isDateTime()", + "title": "Test 3", + "locale": "de", + "webspaceKey": "sulu_io", + "template": "default", + "parent": "@uuid@", + "path": "@string@.match(\"/test-3\").optional()", + "url": "/test-3", + "urls": { + "de": "/test-3" + }, + "author": null, + "authored": "@string@.isDateTime()", + "changer": null, + "changed": "@string@.isDateTime()", + "creator": null, + "created": "@string@.isDateTime()", + "order": 40, + "children": [] + } + ] + } +} diff --git a/Tests/Functional/Controller/responses/legacy/navigation__get_depth_2.json b/Tests/Functional/Controller/responses/legacy/navigation__get_depth_2.json new file mode 100644 index 0000000..8f2c865 --- /dev/null +++ b/Tests/Functional/Controller/responses/legacy/navigation__get_depth_2.json @@ -0,0 +1,107 @@ +{ + "_embedded": { + "items": [ + { + "id": "@uuid@", + "uuid": "@uuid@", + "nodeType": 1, + "publishedState": true, + "published": "@string@.isDateTime()", + "title": "Test 1", + "locale": "de", + "webspaceKey": "sulu_io", + "template": "default", + "parent": "@uuid@", + "path": "@string@.match(\"/test-1\").optional()", + "url": "/test-1", + "urls": { + "de": "/test-1" + }, + "author": null, + "authored": "@string@.isDateTime()", + "changer": null, + "changed": "@string@.isDateTime()", + "creator": null, + "created": "@string@.isDateTime()", + "order": 20, + "children": [ + { + "id": "@uuid@", + "uuid": "@uuid@", + "nodeType": 1, + "publishedState": true, + "published": "@string@.isDateTime()", + "title": "Test 1A", + "locale": "de", + "webspaceKey": "sulu_io", + "template": "default", + "parent": "@uuid@", + "path": "@string@.match(\"/test-1/test-1a\").optional()", + "url": "/test-1a", + "urls": { + "de": "/test-1a" + }, + "author": null, + "authored": "@string@.isDateTime()", + "changer": null, + "changed": "@string@.isDateTime()", + "creator": null, + "created": "@string@.isDateTime()", + "order": 20, + "children": [] + }, + { + "id": "@uuid@", + "uuid": "@uuid@", + "nodeType": 1, + "publishedState": true, + "published": "@string@.isDateTime()", + "title": "Test 1B", + "locale": "de", + "webspaceKey": "sulu_io", + "template": "default", + "parent": "@uuid@", + "path": "@string@.match(\"/test-1/test-1b\").optional()", + "url": "/test-1b", + "urls": { + "de": "/test-1b" + }, + "author": null, + "authored": "@string@.isDateTime()", + "changer": null, + "changed": "@string@.isDateTime()", + "creator": null, + "created": "@string@.isDateTime()", + "order": 30, + "children": [] + } + ] + }, + { + "id": "@uuid@", + "uuid": "@uuid@", + "nodeType": 1, + "publishedState": true, + "published": "@string@.isDateTime()", + "title": "Test 2", + "locale": "de", + "webspaceKey": "sulu_io", + "template": "default", + "parent": "@uuid@", + "path": "@string@.match(\"/test-2\").optional()", + "url": "/test-2", + "urls": { + "de": "/test-2" + }, + "author": null, + "authored": "@string@.isDateTime()", + "changer": null, + "changed": "@string@.isDateTime()", + "creator": null, + "created": "@string@.isDateTime()", + "order": 30, + "children": [] + } + ] + } +} diff --git a/Tests/Functional/Controller/responses/legacy/navigation__get_depth_2_flat.json b/Tests/Functional/Controller/responses/legacy/navigation__get_depth_2_flat.json new file mode 100644 index 0000000..a532cc3 --- /dev/null +++ b/Tests/Functional/Controller/responses/legacy/navigation__get_depth_2_flat.json @@ -0,0 +1,106 @@ +{ + "_embedded": { + "items": [ + { + "id": "@uuid@", + "uuid": "@uuid@", + "nodeType": 1, + "publishedState": true, + "published": "@string@.isDateTime()", + "title": "Test 1", + "locale": "de", + "webspaceKey": "sulu_io", + "template": "default", + "parent": "@uuid@", + "path": "@string@.match(\"/test-1\").optional()", + "url": "/test-1", + "urls": { + "de": "/test-1" + }, + "author": null, + "authored": "@string@.isDateTime()", + "changer": null, + "changed": "@string@.isDateTime()", + "creator": null, + "created": "@string@.isDateTime()", + "order": 20, + "children": [] + }, + { + "id": "@uuid@", + "uuid": "@uuid@", + "nodeType": 1, + "publishedState": true, + "published": "@string@.isDateTime()", + "title": "Test 1A", + "locale": "de", + "webspaceKey": "sulu_io", + "template": "default", + "parent": "@uuid@", + "path": "@string@.match(\"/test-1/test-1a\").optional()", + "url": "/test-1a", + "urls": { + "de": "/test-1a" + }, + "author": null, + "authored": "@string@.isDateTime()", + "changer": null, + "changed": "@string@.isDateTime()", + "creator": null, + "created": "@string@.isDateTime()", + "order": 20, + "children": [] + }, + { + "id": "@uuid@", + "uuid": "@uuid@", + "nodeType": 1, + "publishedState": true, + "published": "@string@.isDateTime()", + "title": "Test 2", + "locale": "de", + "webspaceKey": "sulu_io", + "template": "default", + "parent": "@uuid@", + "path": "@string@.match(\"/test-2\").optional()", + "url": "/test-2", + "urls": { + "de": "/test-2" + }, + "author": null, + "authored": "@string@.isDateTime()", + "changer": null, + "changed": "@string@.isDateTime()", + "creator": null, + "created": "@string@.isDateTime()", + "order": 30, + "children": [] + }, + { + "id": "@uuid@", + "uuid": "@uuid@", + "nodeType": 1, + "publishedState": true, + "published": "@string@.isDateTime()", + "title": "Test 1B", + "locale": "de", + "webspaceKey": "sulu_io", + "template": "default", + "parent": "@uuid@", + "path": "@string@.match(\"/test-1/test-1b\").optional()", + "url": "/test-1b", + "urls": { + "de": "/test-1b" + }, + "author": null, + "authored": "@string@.isDateTime()", + "changer": null, + "changed": "@string@.isDateTime()", + "creator": null, + "created": "@string@.isDateTime()", + "order": 30, + "children": [] + } + ] + } +} diff --git a/Tests/Functional/Controller/responses/legacy/navigation__get_excerpt.json b/Tests/Functional/Controller/responses/legacy/navigation__get_excerpt.json new file mode 100644 index 0000000..b174231 --- /dev/null +++ b/Tests/Functional/Controller/responses/legacy/navigation__get_excerpt.json @@ -0,0 +1,110 @@ +{ + "_embedded": { + "items": [ + { + "id": "@uuid@", + "uuid": "@uuid@", + "nodeType": 1, + "changed": "@string@.isDateTime()", + "changer": null, + "created": "@string@.isDateTime()", + "publishedState": true, + "published": "@string@.isDateTime()", + "creator": null, + "title": "Test 1", + "locale": "de", + "webspaceKey": "sulu_io", + "template": "default", + "parent": "@uuid@", + "path": "@string@.match(\"/test-1\").optional()", + "url": "/test-1", + "urls": { + "de": "/test-1" + }, + "author": null, + "authored": "@string@.isDateTime()", + "order": 20, + "excerpt": { + "title": "", + "more": "", + "description": "", + "categories": [], + "audience_targeting_groups": [], + "tags": [], + "segments": "@array@.isEmpty().optional()", + "icon": [], + "images": [] + }, + "children": [] + }, + { + "id": "@uuid@", + "uuid": "@uuid@", + "nodeType": 1, + "changed": "@string@.isDateTime()", + "changer": null, + "created": "@string@.isDateTime()", + "publishedState": true, + "published": "@string@.isDateTime()", + "creator": null, + "title": "Test 2", + "locale": "de", + "webspaceKey": "sulu_io", + "template": "default", + "parent": "@uuid@", + "path": "@string@.match(\"/test-2\").optional()", + "url": "/test-2", + "urls": { + "de": "/test-2" + }, + "author": null, + "authored": "@string@.isDateTime()", + "order": 30, + "excerpt": { + "title": "", + "more": "", + "description": "", + "categories": [], + "audience_targeting_groups": [], + "tags": [], + "segments": "@array@.isEmpty().optional()", + "icon": [ + { + "id": "@integer@", + "locale": "de", + "collection": "@integer@", + "size": "@integer@", + "mimeType": "image/png", + "title": "Test Image", + "description": "", + "version": 1, + "subVersion": 0, + "name": "test-image.png", + "type": { + "name": "image", + "id": 2 + }, + "isImage": true, + "isVideo": false, + "isAudio": false, + "isDocument": false, + "publishLanguages": [], + "contentLanguages": [], + "tags": [], + "url": "@string@", + "changed": "@string@.isDateTime()", + "created": "@string@.isDateTime()", + "properties": [], + "categories": [], + "targetGroups": [], + "formatUri": "@string@.matchRegex('/^\\/uploads\\/media\\/{format}\\/\\d{2}\\/\\d+-test-image\\.{extension}\\?v=1-0$/')", + "formatPreferredExtension": "png" + } + ], + "images": [] + }, + "children": [] + } + ] + } +} diff --git a/Tests/Functional/Controller/responses/legacy/navigation__get_uuid.json b/Tests/Functional/Controller/responses/legacy/navigation__get_uuid.json new file mode 100644 index 0000000..a4958d5 --- /dev/null +++ b/Tests/Functional/Controller/responses/legacy/navigation__get_uuid.json @@ -0,0 +1,56 @@ +{ + "_embedded": { + "items": [ + { + "id": "@uuid@", + "uuid": "@uuid@", + "nodeType": 1, + "publishedState": true, + "published": "@string@.isDateTime()", + "title": "Test 1A", + "locale": "de", + "webspaceKey": "sulu_io", + "template": "default", + "parent": "@uuid@", + "path": "@string@.match(\"/test-1/test-1a\").optional()", + "url": "/test-1a", + "urls": { + "de": "/test-1a" + }, + "author": null, + "authored": "@string@.isDateTime()", + "changer": null, + "changed": "@string@.isDateTime()", + "creator": null, + "created": "@string@.isDateTime()", + "order": 20, + "children": [] + }, + { + "id": "@uuid@", + "uuid": "@uuid@", + "nodeType": 1, + "publishedState": true, + "published": "@string@.isDateTime()", + "title": "Test 1B", + "locale": "de", + "webspaceKey": "sulu_io", + "template": "default", + "parent": "@uuid@", + "path": "@string@.match(\"/test-1/test-1b\").optional()", + "url": "/test-1b", + "urls": { + "de": "/test-1b" + }, + "author": null, + "authored": "@string@.isDateTime()", + "changer": null, + "changed": "@string@.isDateTime()", + "creator": null, + "created": "@string@.isDateTime()", + "order": 30, + "children": [] + } + ] + } +} diff --git a/composer.json b/composer.json index f55f9b2..6945cc1 100644 --- a/composer.json +++ b/composer.json @@ -5,7 +5,7 @@ "description": "Bundle that provides controllers and services for using Sulu as headless content management system", "require": { "php": "^8.2 || ^8.3", - "sulu/sulu": "^2.6@dev", + "sulu/sulu": "^2.5 || ^2.6@dev", "symfony/config": "^5.4 || ^6.0 || ^7.0", "symfony/dependency-injection": "^5.4 || ^6.0 || ^7.0", "symfony/framework-bundle": "^5.4 || ^6.0 || ^7.0", From 5e5e3982d22081f1ebd55fd69c1f6569c295ebcb Mon Sep 17 00:00:00 2001 From: Oliver Kossin Date: Tue, 28 May 2024 13:51:51 +0200 Subject: [PATCH 14/40] Add min release for php matcher --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 6945cc1..35bdcb8 100644 --- a/composer.json +++ b/composer.json @@ -13,7 +13,7 @@ "symfony/http-kernel": "^5.4 || ^6.0 || ^7.0" }, "require-dev": { - "coduo/php-matcher": "^6.0", + "coduo/php-matcher": "^6.0.14", "friendsofphp/php-cs-fixer": "^3.0", "handcraftedinthealps/code-coverage-checker": "^0.2.1", "handcraftedinthealps/zendsearch": "^2.0", From fb023ac37038c95c93c7cb310454c8bdb597329c Mon Sep 17 00:00:00 2001 From: Oliver Kossin Date: Tue, 28 May 2024 13:56:25 +0200 Subject: [PATCH 15/40] set php matcher to 6.0.15 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 35bdcb8..3f10c1d 100644 --- a/composer.json +++ b/composer.json @@ -13,7 +13,7 @@ "symfony/http-kernel": "^5.4 || ^6.0 || ^7.0" }, "require-dev": { - "coduo/php-matcher": "^6.0.14", + "coduo/php-matcher": "^6.0.15", "friendsofphp/php-cs-fixer": "^3.0", "handcraftedinthealps/code-coverage-checker": "^0.2.1", "handcraftedinthealps/zendsearch": "^2.0", From f273908ea574de2e9701931adbae6a59eb1ee0a0 Mon Sep 17 00:00:00 2001 From: Oliver Kossin Date: Tue, 28 May 2024 14:14:58 +0200 Subject: [PATCH 16/40] test again --- Tests/Functional/Controller/SearchControllerTest.php | 1 + 1 file changed, 1 insertion(+) diff --git a/Tests/Functional/Controller/SearchControllerTest.php b/Tests/Functional/Controller/SearchControllerTest.php index 3bf74b7..db0d60f 100644 --- a/Tests/Functional/Controller/SearchControllerTest.php +++ b/Tests/Functional/Controller/SearchControllerTest.php @@ -86,6 +86,7 @@ public function testGetAction(string $query, array $indices, string $expectedPat { $this->websiteClient->request('GET', '/api/search?q=' . $query . '&indices=' . \implode(',', $indices)); + $response = $this->websiteClient->getResponse(); $this->assertInstanceOf(Response::class, $response); From 849c5d824885e45d35bf0dc09a32c97a93409fd1 Mon Sep 17 00:00:00 2001 From: Oliver Kossin Date: Tue, 28 May 2024 14:20:20 +0200 Subject: [PATCH 17/40] Set Min version to 13 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 3f10c1d..71f54bb 100644 --- a/composer.json +++ b/composer.json @@ -13,7 +13,7 @@ "symfony/http-kernel": "^5.4 || ^6.0 || ^7.0" }, "require-dev": { - "coduo/php-matcher": "^6.0.15", + "coduo/php-matcher": "^6.0.13", "friendsofphp/php-cs-fixer": "^3.0", "handcraftedinthealps/code-coverage-checker": "^0.2.1", "handcraftedinthealps/zendsearch": "^2.0", From a9e4c42ae16fd22b8c224a6959bfcfa966ca6d07 Mon Sep 17 00:00:00 2001 From: Oliver Kossin Date: Tue, 28 May 2024 14:22:38 +0200 Subject: [PATCH 18/40] Remove empty line --- Tests/Functional/Controller/SearchControllerTest.php | 1 - 1 file changed, 1 deletion(-) diff --git a/Tests/Functional/Controller/SearchControllerTest.php b/Tests/Functional/Controller/SearchControllerTest.php index db0d60f..558437b 100644 --- a/Tests/Functional/Controller/SearchControllerTest.php +++ b/Tests/Functional/Controller/SearchControllerTest.php @@ -85,7 +85,6 @@ public function provideAttributes(): \Generator public function testGetAction(string $query, array $indices, string $expectedPatternFile): void { $this->websiteClient->request('GET', '/api/search?q=' . $query . '&indices=' . \implode(',', $indices)); - $response = $this->websiteClient->getResponse(); $this->assertInstanceOf(Response::class, $response); From b63bf87f7f4965c57e1eb91abb57be079086d4c6 Mon Sep 17 00:00:00 2001 From: Oliver Kossin Date: Tue, 28 May 2024 14:27:06 +0200 Subject: [PATCH 19/40] Run CS fixer --- Tests/Functional/Controller/SearchControllerTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tests/Functional/Controller/SearchControllerTest.php b/Tests/Functional/Controller/SearchControllerTest.php index 558437b..3bf74b7 100644 --- a/Tests/Functional/Controller/SearchControllerTest.php +++ b/Tests/Functional/Controller/SearchControllerTest.php @@ -85,7 +85,7 @@ public function provideAttributes(): \Generator public function testGetAction(string $query, array $indices, string $expectedPatternFile): void { $this->websiteClient->request('GET', '/api/search?q=' . $query . '&indices=' . \implode(',', $indices)); - + $response = $this->websiteClient->getResponse(); $this->assertInstanceOf(Response::class, $response); From 3d7f9f46faca4c71821dbfdf03e2cb4b16816a88 Mon Sep 17 00:00:00 2001 From: Oliver Kossin Date: Tue, 28 May 2024 14:34:57 +0200 Subject: [PATCH 20/40] try higher phpunit version --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 71f54bb..79e4abf 100644 --- a/composer.json +++ b/composer.json @@ -25,7 +25,7 @@ "phpstan/phpstan-phpunit": "^1.0", "phpstan/phpstan-symfony": "^1.0", "phpstan/phpstan-webmozart-assert": "^1.0", - "phpunit/phpunit": "^9.5.20", + "phpunit/phpunit": "^9.6", "symfony/browser-kit": "^5.4 || ^6.0 || ^7.0", "symfony/console": "^5.4 || ^6.0 || ^7.0", "symfony/dotenv": "^5.4 || ^6.0 || ^7.0", From ca4e74399251bde6db92904e90128cf813afdc2b Mon Sep 17 00:00:00 2001 From: Oliver Kossin Date: Tue, 28 May 2024 14:37:47 +0200 Subject: [PATCH 21/40] Update phpunit --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 79e4abf..3a1f99a 100644 --- a/composer.json +++ b/composer.json @@ -25,7 +25,7 @@ "phpstan/phpstan-phpunit": "^1.0", "phpstan/phpstan-symfony": "^1.0", "phpstan/phpstan-webmozart-assert": "^1.0", - "phpunit/phpunit": "^9.6", + "phpunit/phpunit": "^9.6.19", "symfony/browser-kit": "^5.4 || ^6.0 || ^7.0", "symfony/console": "^5.4 || ^6.0 || ^7.0", "symfony/dotenv": "^5.4 || ^6.0 || ^7.0", From cb781351f357e2718567a48c2b860cd65ab31267 Mon Sep 17 00:00:00 2001 From: Oliver Kossin Date: Tue, 28 May 2024 18:53:17 +0200 Subject: [PATCH 22/40] try massiv search 2.9.1 --- composer.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 3a1f99a..8d58da2 100644 --- a/composer.json +++ b/composer.json @@ -31,7 +31,8 @@ "symfony/dotenv": "^5.4 || ^6.0 || ^7.0", "symfony/error-handler": "^5.4 || ^6.0 || ^7.0", "symfony/monolog-bundle": "^3.1", - "thecodingmachine/phpstan-strict-rules": "^1.0" + "thecodingmachine/phpstan-strict-rules": "^1.0", + "massive/search-bundle": "^2.9.1" }, "conflict": { "doctrine/orm": "< 2.6.3", From 9874ca427e4c277a74e4d453f33d8406500c401f Mon Sep 17 00:00:00 2001 From: Oliver Kossin Date: Thu, 30 May 2024 08:46:38 +0200 Subject: [PATCH 23/40] Change Tests and minimum to php 8 --- .github/workflows/test-application.yaml | 128 +++++++++++++----------- composer.json | 2 +- 2 files changed, 73 insertions(+), 57 deletions(-) diff --git a/.github/workflows/test-application.yaml b/.github/workflows/test-application.yaml index 0fb7c5c..d18f0c8 100644 --- a/.github/workflows/test-application.yaml +++ b/.github/workflows/test-application.yaml @@ -21,29 +21,45 @@ jobs: fail-fast: false matrix: include: - - php-version: '8.2' - lint: false - coverage: false - dependency-versions: 'lowest' - tools: 'composer:v2' - env: - SYMFONY_DEPRECATIONS_HELPER: disabled - - - php-version: '8.2' - lint: true - coverage: true - dependency-versions: 'highest' - tools: 'composer:v2' - env: - SYMFONY_DEPRECATIONS_HELPER: weak - - - php-version: '8.3' - lint: false - coverage: false - dependency-versions: 'highest' - tools: 'composer:v2' - env: - SYMFONY_DEPRECATIONS_HELPER: weak + - php-version: '8.0' + lint: false + coverage: false + dependency-versions: 'lowest' + tools: 'composer:v2' + env: + SYMFONY_DEPRECATIONS_HELPER: disabled + + - php-version: '8.1' + lint: true + coverage: true + dependency-versions: 'highest' + tools: 'composer:v2' + env: + SYMFONY_DEPRECATIONS_HELPER: weak + + - php-version: '8.1' + lint: true + coverage: true + dependency-versions: 'highest' + tools: 'composer:v2' + env: + SYMFONY_DEPRECATIONS_HELPER: weak + + - php-version: '8.2' + lint: true + coverage: true + dependency-versions: 'highest' + tools: 'composer:v2' + env: + SYMFONY_DEPRECATIONS_HELPER: weak + + - php-version: '8.3' + lint: false + coverage: false + dependency-versions: 'highest' + tools: 'composer:v2' + env: + SYMFONY_DEPRECATIONS_HELPER: weak services: mysql: @@ -55,36 +71,36 @@ jobs: options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=5 steps: - - name: Checkout project - uses: actions/checkout@v2 - - - name: Install and configure PHP - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ matrix.php-version }} - extensions: ctype, iconv, mysql - coverage: pcov - tools: ${{ matrix.tools }} - - - name: Install composer dependencies - uses: ramsey/composer-install@v1 - with: - dependency-versions: ${{ matrix.dependency-versions }} - composer-options: ${{ matrix.composer-options }} - - - name: Bootstrap test environment - run: composer bootstrap-test-environment - - - name: Lint code - if: ${{ matrix.lint }} - run: composer lint - - - name: Execute unit test cases - run: composer test -- Tests/Unit --coverage-php var/coverage.php --coverage-html coverage-report --log-junit var/junit.xml - - - name: Execute functional test cases - run: composer test -- Tests/Functional --log-junit var/junit.xml - - - name: Check code coverage - if: ${{ matrix.coverage }} - run: php vendor/bin/code-coverage-checker "var/coverage.php" "line" "95" "Content" + - name: Checkout project + uses: actions/checkout@v2 + + - name: Install and configure PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php-version }} + extensions: ctype, iconv, mysql + coverage: pcov + tools: ${{ matrix.tools }} + + - name: Install composer dependencies + uses: ramsey/composer-install@v1 + with: + dependency-versions: ${{ matrix.dependency-versions }} + composer-options: ${{ matrix.composer-options }} + + - name: Bootstrap test environment + run: composer bootstrap-test-environment + + - name: Lint code + if: ${{ matrix.lint }} + run: composer lint + + - name: Execute unit test cases + run: composer test -- Tests/Unit --coverage-php var/coverage.php --coverage-html coverage-report --log-junit var/junit.xml + + - name: Execute functional test cases + run: composer test -- Tests/Functional --log-junit var/junit.xml + + - name: Check code coverage + if: ${{ matrix.coverage }} + run: php vendor/bin/code-coverage-checker "var/coverage.php" "line" "95" "Content" diff --git a/composer.json b/composer.json index 8d58da2..dafa277 100644 --- a/composer.json +++ b/composer.json @@ -4,7 +4,7 @@ "type": "sulu-bundle", "description": "Bundle that provides controllers and services for using Sulu as headless content management system", "require": { - "php": "^8.2 || ^8.3", + "php": "^8.0", "sulu/sulu": "^2.5 || ^2.6@dev", "symfony/config": "^5.4 || ^6.0 || ^7.0", "symfony/dependency-injection": "^5.4 || ^6.0 || ^7.0", From 10de12654c10b3627b908383ebf4eac06560e9d1 Mon Sep 17 00:00:00 2001 From: Oliver Kossin Date: Thu, 30 May 2024 08:48:22 +0200 Subject: [PATCH 24/40] Fix version typo --- .github/workflows/test-application.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-application.yaml b/.github/workflows/test-application.yaml index d18f0c8..a2078fc 100644 --- a/.github/workflows/test-application.yaml +++ b/.github/workflows/test-application.yaml @@ -29,7 +29,7 @@ jobs: env: SYMFONY_DEPRECATIONS_HELPER: disabled - - php-version: '8.1' + - php-version: '8.0' lint: true coverage: true dependency-versions: 'highest' From 9fc87f369c2721ec0e14e3acb0fe09ec88cbda77 Mon Sep 17 00:00:00 2001 From: Oliver Kossin Date: Thu, 30 May 2024 08:51:07 +0200 Subject: [PATCH 25/40] Allow lower phper matcher --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index dafa277..d033025 100644 --- a/composer.json +++ b/composer.json @@ -13,7 +13,7 @@ "symfony/http-kernel": "^5.4 || ^6.0 || ^7.0" }, "require-dev": { - "coduo/php-matcher": "^6.0.13", + "coduo/php-matcher": "^5.0|| ^6.0.13", "friendsofphp/php-cs-fixer": "^3.0", "handcraftedinthealps/code-coverage-checker": "^0.2.1", "handcraftedinthealps/zendsearch": "^2.0", From ce5fbb40a164836e434c52e286de06be05404280 Mon Sep 17 00:00:00 2001 From: Oliver Kossin Date: Thu, 30 May 2024 09:00:50 +0200 Subject: [PATCH 26/40] downgrade phpunit --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index d033025..7975a5b 100644 --- a/composer.json +++ b/composer.json @@ -25,7 +25,7 @@ "phpstan/phpstan-phpunit": "^1.0", "phpstan/phpstan-symfony": "^1.0", "phpstan/phpstan-webmozart-assert": "^1.0", - "phpunit/phpunit": "^9.6.19", + "phpunit/phpunit": "^8.4||^9.6.19", "symfony/browser-kit": "^5.4 || ^6.0 || ^7.0", "symfony/console": "^5.4 || ^6.0 || ^7.0", "symfony/dotenv": "^5.4 || ^6.0 || ^7.0", From 119b13665f4aec89f69b326d27cb63b1d2f7a874 Mon Sep 17 00:00:00 2001 From: Oliver Kossin Date: Thu, 30 May 2024 09:06:18 +0200 Subject: [PATCH 27/40] try special php version --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 7975a5b..6f8012e 100644 --- a/composer.json +++ b/composer.json @@ -25,7 +25,7 @@ "phpstan/phpstan-phpunit": "^1.0", "phpstan/phpstan-symfony": "^1.0", "phpstan/phpstan-webmozart-assert": "^1.0", - "phpunit/phpunit": "^8.4||^9.6.19", + "phpunit/phpunit": "^9.5.1", "symfony/browser-kit": "^5.4 || ^6.0 || ^7.0", "symfony/console": "^5.4 || ^6.0 || ^7.0", "symfony/dotenv": "^5.4 || ^6.0 || ^7.0", From 378dc46e96f6d594ba2f41f89f785462d85baea4 Mon Sep 17 00:00:00 2001 From: Oliver Kossin Date: Thu, 30 May 2024 09:14:30 +0200 Subject: [PATCH 28/40] try php 9.6 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 6f8012e..d0fa6d4 100644 --- a/composer.json +++ b/composer.json @@ -25,7 +25,7 @@ "phpstan/phpstan-phpunit": "^1.0", "phpstan/phpstan-symfony": "^1.0", "phpstan/phpstan-webmozart-assert": "^1.0", - "phpunit/phpunit": "^9.5.1", + "phpunit/phpunit": "^9.6.1", "symfony/browser-kit": "^5.4 || ^6.0 || ^7.0", "symfony/console": "^5.4 || ^6.0 || ^7.0", "symfony/dotenv": "^5.4 || ^6.0 || ^7.0", From fccc294f3e2a47fa409bc5e735b70e4341deac39 Mon Sep 17 00:00:00 2001 From: Oliver Kossin Date: Mon, 10 Jun 2024 13:39:46 +0200 Subject: [PATCH 29/40] Add Symfony 7 support --- DependencyInjection/Configuration.php | 2 +- composer.json | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/DependencyInjection/Configuration.php b/DependencyInjection/Configuration.php index 5f576ef..63b65ee 100644 --- a/DependencyInjection/Configuration.php +++ b/DependencyInjection/Configuration.php @@ -18,7 +18,7 @@ class Configuration implements ConfigurationInterface { - public function getConfigTreeBuilder() + public function getConfigTreeBuilder(): TreeBuilder { $treeBuilder = new TreeBuilder('sulu_headless'); $rootNode = $treeBuilder->getRootNode(); diff --git a/composer.json b/composer.json index 221ea29..7396a8b 100644 --- a/composer.json +++ b/composer.json @@ -6,11 +6,11 @@ "require": { "php": "^7.3 || ^8.0", "sulu/sulu": "^2.4 || ^2.5@dev", - "symfony/config": "^4.4 || ^5.0 || ^6.0", - "symfony/dependency-injection": "^4.4 || ^5.0 || ^6.0", - "symfony/framework-bundle": "^4.4 || ^5.0 || ^6.0", - "symfony/http-foundation": "^4.4 || ^5.0 || ^6.0", - "symfony/http-kernel": "^4.4 || ^5.0 || ^6.0" + "symfony/config": "^4.4 || ^5.0 || ^6.0 || ^7.0", + "symfony/dependency-injection": "^4.4 || ^5.0 || ^6.0 || ^7.0", + "symfony/framework-bundle": "^4.4 || ^5.0 || ^6.0 || ^7.0", + "symfony/http-foundation": "^4.4 || ^5.0 || ^6.0 || ^7.0", + "symfony/http-kernel": "^4.4 || ^5.0 || ^6.0 || ^7.0" }, "require-dev": { "coduo/php-matcher": "^5.0 || ^6.0", @@ -26,10 +26,10 @@ "phpstan/phpstan-phpunit": "^1.0", "phpstan/phpstan-symfony": "^1.0", "phpunit/phpunit": "^9.6", - "symfony/browser-kit": "^4.4 || ^5.0 || ^6.0", - "symfony/console": "^4.4 || ^5.0 || ^6.0", - "symfony/dotenv": "^4.4 || ^5.0 || ^6.0", - "symfony/error-handler": "^4.4 || ^5.0 || ^6.0", + "symfony/browser-kit": "^4.4 || ^5.0 || ^6.0 || ^7.0", + "symfony/console": "^4.4 || ^5.0 || ^6.0 || ^7.0", + "symfony/dotenv": "^4.4 || ^5.0 || ^6.0 || ^7.0", + "symfony/error-handler": "^4.4 || ^5.0 || ^6.0 || ^7.0", "symfony/monolog-bundle": "^3.1", "thecodingmachine/phpstan-strict-rules": "^1.0" }, From 52bd36db8edf803efb833bc8d8a51c2dab64874d Mon Sep 17 00:00:00 2001 From: Alexander Schranz Date: Mon, 10 Jun 2024 13:45:10 +0200 Subject: [PATCH 30/40] Test against Symfony 7 compatibility --- .github/workflows/test-application.yaml | 2 ++ composer.json | 8 +++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test-application.yaml b/.github/workflows/test-application.yaml index 486fa18..10c4537 100644 --- a/.github/workflows/test-application.yaml +++ b/.github/workflows/test-application.yaml @@ -13,6 +13,7 @@ jobs: runs-on: ubuntu-latest env: + COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }} DATABASE_URL: mysql://root:root@127.0.0.1:3306/su_headless_test?serverVersion=5.7 DATABASE_CHARSET: utf8mb4 DATABASE_COLLATE: utf8mb4_unicode_ci @@ -111,6 +112,7 @@ jobs: runs-on: ubuntu-latest env: + COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }} DATABASE_URL: mysql://root:root@127.0.0.1:3306/su_headless_test?serverVersion=5.7 DATABASE_CHARSET: utf8mb4 DATABASE_COLLATE: utf8mb4_unicode_ci diff --git a/composer.json b/composer.json index 7396a8b..76564b1 100644 --- a/composer.json +++ b/composer.json @@ -3,9 +3,15 @@ "license": "MIT", "type": "sulu-bundle", "description": "Bundle that provides controllers and services for using Sulu as headless content management system", + "repositories": [ + { + "type": "vcs", + "url": "git@github.com:alexander-schranz/sulu.git" + } + ], "require": { "php": "^7.3 || ^8.0", - "sulu/sulu": "^2.4 || ^2.5@dev", + "sulu/sulu": "^2.4 || ^2.5@dev || dev-feature/symfony-7-support as 2.6.3", "symfony/config": "^4.4 || ^5.0 || ^6.0 || ^7.0", "symfony/dependency-injection": "^4.4 || ^5.0 || ^6.0 || ^7.0", "symfony/framework-bundle": "^4.4 || ^5.0 || ^6.0 || ^7.0", From e3701ee6df12a7ccac9a57da179b8bf332c8a46b Mon Sep 17 00:00:00 2001 From: Alexander Schranz Date: Mon, 10 Jun 2024 13:50:10 +0200 Subject: [PATCH 31/40] Test Symfony 7 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 76564b1..9644230 100644 --- a/composer.json +++ b/composer.json @@ -11,7 +11,7 @@ ], "require": { "php": "^7.3 || ^8.0", - "sulu/sulu": "^2.4 || ^2.5@dev || dev-feature/symfony-7-support as 2.6.3", + "sulu/sulu": "dev-feature/symfony-7-support as 2.6.3", "symfony/config": "^4.4 || ^5.0 || ^6.0 || ^7.0", "symfony/dependency-injection": "^4.4 || ^5.0 || ^6.0 || ^7.0", "symfony/framework-bundle": "^4.4 || ^5.0 || ^6.0 || ^7.0", From 059da6871598545ab93aa1dd12f2a5a692aaa12e Mon Sep 17 00:00:00 2001 From: Alexander Schranz Date: Mon, 10 Jun 2024 14:27:37 +0200 Subject: [PATCH 32/40] Fix test for dev branch --- Tests/Functional/Controller/NavigationControllerTest.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Tests/Functional/Controller/NavigationControllerTest.php b/Tests/Functional/Controller/NavigationControllerTest.php index 45557d7..1032292 100644 --- a/Tests/Functional/Controller/NavigationControllerTest.php +++ b/Tests/Functional/Controller/NavigationControllerTest.php @@ -113,8 +113,12 @@ protected function setUp(): void public function provideAttributes(): \Generator { $path = ''; + + $suluSuluVersion = \Composer\InstalledVersions::getVersion('sulu/sulu'); + /* Todo Can be removed after ending support of sulu 2.5 */ - if (\version_compare(\Composer\InstalledVersions::getVersion('sulu/sulu') ?? '999.999.999', '2.6.0', '<') + if (\version_compare($suluSuluVersion ?? '999.999.999', '2.6.0', '<') + && 0 !== \strpos($suluSuluVersion, 'dev-') ) { $path = '/legacy/'; } From 0da65f94d27919a7b0700753af03994824bf00a1 Mon Sep 17 00:00:00 2001 From: Alexander Schranz Date: Mon, 10 Jun 2024 14:32:05 +0200 Subject: [PATCH 33/40] Test 8.2 and 8.3 PHP against Symfony 7 rest against stable branches --- .github/workflows/test-application.yaml | 4 ++++ Tests/Functional/Controller/NavigationControllerTest.php | 3 ++- composer.json | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-application.yaml b/.github/workflows/test-application.yaml index 10c4537..52f829e 100644 --- a/.github/workflows/test-application.yaml +++ b/.github/workflows/test-application.yaml @@ -88,6 +88,10 @@ jobs: - name: Remove not required test tooling run: composer remove "*php-cs-fixer*" "*phpstan*" --no-update --dev + - name: Install Symfony 7 dev branch # TODO remove + if: ${{ matrix.php-version == '8.2' || matrix.php-version == '8.3' }} + run: composer require sulu/sulu:"dev-feature/symfony-7-support as 2.6.3" --no-update + - name: Install composer dependencies uses: ramsey/composer-install@v3 with: diff --git a/Tests/Functional/Controller/NavigationControllerTest.php b/Tests/Functional/Controller/NavigationControllerTest.php index 1032292..f8f3f9f 100644 --- a/Tests/Functional/Controller/NavigationControllerTest.php +++ b/Tests/Functional/Controller/NavigationControllerTest.php @@ -117,7 +117,8 @@ public function provideAttributes(): \Generator $suluSuluVersion = \Composer\InstalledVersions::getVersion('sulu/sulu'); /* Todo Can be removed after ending support of sulu 2.5 */ - if (\version_compare($suluSuluVersion ?? '999.999.999', '2.6.0', '<') + if ($suluSuluVersion + && \version_compare($suluSuluVersion, '2.6.0', '<') && 0 !== \strpos($suluSuluVersion, 'dev-') ) { $path = '/legacy/'; diff --git a/composer.json b/composer.json index 9644230..9d519cd 100644 --- a/composer.json +++ b/composer.json @@ -11,7 +11,7 @@ ], "require": { "php": "^7.3 || ^8.0", - "sulu/sulu": "dev-feature/symfony-7-support as 2.6.3", + "sulu/sulu": "^2.4 || ^2.5@dev", "symfony/config": "^4.4 || ^5.0 || ^6.0 || ^7.0", "symfony/dependency-injection": "^4.4 || ^5.0 || ^6.0 || ^7.0", "symfony/framework-bundle": "^4.4 || ^5.0 || ^6.0 || ^7.0", From 84b5bf689d90b0e27c6e0d46e72cc9b81a655ea0 Mon Sep 17 00:00:00 2001 From: Alexander Schranz Date: Mon, 10 Jun 2024 14:34:00 +0200 Subject: [PATCH 34/40] Fix failing Symfony 6.0 tests by require atleast 5.4 or 6.3 --- composer.json | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/composer.json b/composer.json index 9d519cd..c1c6af2 100644 --- a/composer.json +++ b/composer.json @@ -12,11 +12,11 @@ "require": { "php": "^7.3 || ^8.0", "sulu/sulu": "^2.4 || ^2.5@dev", - "symfony/config": "^4.4 || ^5.0 || ^6.0 || ^7.0", - "symfony/dependency-injection": "^4.4 || ^5.0 || ^6.0 || ^7.0", - "symfony/framework-bundle": "^4.4 || ^5.0 || ^6.0 || ^7.0", - "symfony/http-foundation": "^4.4 || ^5.0 || ^6.0 || ^7.0", - "symfony/http-kernel": "^4.4 || ^5.0 || ^6.0 || ^7.0" + "symfony/config": "^4.4 || ^5.4 || ^6.3 || ^7.0", + "symfony/dependency-injection": "^4.4 || ^5.4 || ^6.3 || ^7.0", + "symfony/framework-bundle": "^4.4 || ^5.4 || ^6.3 || ^7.0", + "symfony/http-foundation": "^4.4 || ^5.4 || ^6.3 || ^7.0", + "symfony/http-kernel": "^4.4 || ^5.4 || ^6.3 || ^7.0" }, "require-dev": { "coduo/php-matcher": "^5.0 || ^6.0", @@ -32,10 +32,10 @@ "phpstan/phpstan-phpunit": "^1.0", "phpstan/phpstan-symfony": "^1.0", "phpunit/phpunit": "^9.6", - "symfony/browser-kit": "^4.4 || ^5.0 || ^6.0 || ^7.0", - "symfony/console": "^4.4 || ^5.0 || ^6.0 || ^7.0", - "symfony/dotenv": "^4.4 || ^5.0 || ^6.0 || ^7.0", - "symfony/error-handler": "^4.4 || ^5.0 || ^6.0 || ^7.0", + "symfony/browser-kit": "^4.4 || ^5.4 || ^6.3 || ^7.0", + "symfony/console": "^4.4 || ^5.4 || ^6.3 || ^7.0", + "symfony/dotenv": "^4.4 || ^5.4 || ^6.3 || ^7.0", + "symfony/error-handler": "^4.4 || ^5.4 || ^6.3 || ^7.0", "symfony/monolog-bundle": "^3.1", "thecodingmachine/phpstan-strict-rules": "^1.0" }, From 588eafd35d3343fcd19900dab292a2cd4039f172 Mon Sep 17 00:00:00 2001 From: Alexander Schranz Date: Mon, 10 Jun 2024 14:38:10 +0200 Subject: [PATCH 35/40] Fix PHP 8.0 compatibility for tests to avoid mixed versions there --- composer.json | 1 + 1 file changed, 1 insertion(+) diff --git a/composer.json b/composer.json index c1c6af2..87283f9 100644 --- a/composer.json +++ b/composer.json @@ -36,6 +36,7 @@ "symfony/console": "^4.4 || ^5.4 || ^6.3 || ^7.0", "symfony/dotenv": "^4.4 || ^5.4 || ^6.3 || ^7.0", "symfony/error-handler": "^4.4 || ^5.4 || ^6.3 || ^7.0", + "symfony/security-bundle": "^4.4 || ^5.4 || ^6.3 || ^7.0", "symfony/monolog-bundle": "^3.1", "thecodingmachine/phpstan-strict-rules": "^1.0" }, From 7d14e437bab6894670ba43f3f0ef8379b34eb15d Mon Sep 17 00:00:00 2001 From: Alexander Schranz Date: Mon, 10 Jun 2024 16:20:43 +0200 Subject: [PATCH 36/40] Remove not required security bundle requirement --- composer.json | 1 - 1 file changed, 1 deletion(-) diff --git a/composer.json b/composer.json index 87283f9..c1c6af2 100644 --- a/composer.json +++ b/composer.json @@ -36,7 +36,6 @@ "symfony/console": "^4.4 || ^5.4 || ^6.3 || ^7.0", "symfony/dotenv": "^4.4 || ^5.4 || ^6.3 || ^7.0", "symfony/error-handler": "^4.4 || ^5.4 || ^6.3 || ^7.0", - "symfony/security-bundle": "^4.4 || ^5.4 || ^6.3 || ^7.0", "symfony/monolog-bundle": "^3.1", "thecodingmachine/phpstan-strict-rules": "^1.0" }, From 6e3bd279ae485abe68cd3a8938047aed35fb9d0a Mon Sep 17 00:00:00 2001 From: Alexander Schranz Date: Thu, 27 Jun 2024 17:16:33 +0200 Subject: [PATCH 37/40] Remove fork --- composer.json | 6 ------ 1 file changed, 6 deletions(-) diff --git a/composer.json b/composer.json index c1c6af2..7afc6d4 100644 --- a/composer.json +++ b/composer.json @@ -3,12 +3,6 @@ "license": "MIT", "type": "sulu-bundle", "description": "Bundle that provides controllers and services for using Sulu as headless content management system", - "repositories": [ - { - "type": "vcs", - "url": "git@github.com:alexander-schranz/sulu.git" - } - ], "require": { "php": "^7.3 || ^8.0", "sulu/sulu": "^2.4 || ^2.5@dev", From 6c378d7bcf47621f186e892cbf13ec64745736cc Mon Sep 17 00:00:00 2001 From: Alexander Schranz Date: Fri, 28 Jun 2024 10:24:13 +0200 Subject: [PATCH 38/40] Remove fork branch installation --- .github/workflows/test-application.yaml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/test-application.yaml b/.github/workflows/test-application.yaml index 52f829e..10c4537 100644 --- a/.github/workflows/test-application.yaml +++ b/.github/workflows/test-application.yaml @@ -88,10 +88,6 @@ jobs: - name: Remove not required test tooling run: composer remove "*php-cs-fixer*" "*phpstan*" --no-update --dev - - name: Install Symfony 7 dev branch # TODO remove - if: ${{ matrix.php-version == '8.2' || matrix.php-version == '8.3' }} - run: composer require sulu/sulu:"dev-feature/symfony-7-support as 2.6.3" --no-update - - name: Install composer dependencies uses: ramsey/composer-install@v3 with: From 958213b8b6a8e6903b4c93742c2c1272237236e7 Mon Sep 17 00:00:00 2001 From: Alexander Schranz Date: Tue, 2 Jul 2024 13:34:06 +0200 Subject: [PATCH 39/40] Upgrade jackalope for symfony/console 7.0 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 7afc6d4..096ac13 100644 --- a/composer.json +++ b/composer.json @@ -16,7 +16,7 @@ "coduo/php-matcher": "^5.0 || ^6.0", "handcraftedinthealps/code-coverage-checker": "^0.2.1", "handcraftedinthealps/zendsearch": "^2.0", - "jackalope/jackalope-doctrine-dbal": "^1.3.4", + "jackalope/jackalope-doctrine-dbal": "^1.3.4 || ^2.0", "jangregor/phpstan-prophecy": "^1.0", "php-cs-fixer/shim": "^3.0", "phpspec/prophecy": "^1.8", From ba3f34cd4f13813cee9c48394b4f3f8bbe7e574c Mon Sep 17 00:00:00 2001 From: Alexander Schranz Date: Wed, 3 Jul 2024 09:57:01 +0200 Subject: [PATCH 40/40] Fix PHP 7.3 compatibility --- Content/StructureResolver.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Content/StructureResolver.php b/Content/StructureResolver.php index 04cc8f3..4f8cfce 100644 --- a/Content/StructureResolver.php +++ b/Content/StructureResolver.php @@ -126,7 +126,7 @@ public function resolveProperties( } // the '.' is used to separate the extension name from the property name. - if (\str_contains($sourceProperty, '.')) { + if (false !== \strpos($sourceProperty, '.')) { [$extensionName, $propertyName] = \explode('.', $sourceProperty); if (!isset($unresolvedExtensionData[$extensionName][$propertyName])) {