Skip to content

Commit

Permalink
#9 Update to allow PHP versions higher than 8.1 / Pimcore 11.* (#10)
Browse files Browse the repository at this point in the history
Co-authored-by: Luka Dschaak <[email protected]>
  • Loading branch information
mike4git and lukadschaak authored Apr 24, 2024
1 parent d3ed037 commit c284205
Show file tree
Hide file tree
Showing 9 changed files with 34 additions and 26 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/qa.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
- name: PHP Setup
uses: shivammathur/setup-php@v2
with:
php-version: 8.1
php-version: 8.2

- name: Validate composer.json
run: composer validate --ansi --strict
Expand Down
12 changes: 10 additions & 2 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,13 @@ jobs:
matrix:
include:
- php-version: "8.1"
dependencies: "lowest"
dependencies: "lowest" # Pimcore 10.5.0
- php-version: "8.1"
dependencies: "highest"
dependencies: "highest" # Pimcore 11.*
- php-version: "8.2"
dependencies: "lowest" # Pimcore 10.5.0
- php-version: "8.2"
dependencies: "highest" # Pimcore 11.*

env:
MYSQL_HOST: 127.0.0.1
Expand Down Expand Up @@ -61,5 +65,9 @@ jobs:
with:
dependency-versions: ${{ matrix.dependencies }}

- name: Add Pimcore Admin UI
run: composer require --dev pimcore/admin-ui-classic-bundle --no-interaction
if: matrix.dependencies == 'highest'

- name: Execute tests
run: composer tests
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
}
],
"require": {
"php": "~8.1.0",
"pimcore/pimcore": "^10.5"
"php": "~8.1.0 || ~8.2.0",
"pimcore/pimcore": "^10.5 || ^11.0"
},
"require-dev": {
"ergebnis/composer-normalize": "^2.42",
Expand All @@ -25,7 +25,7 @@
"phpstan/phpstan-phpunit": "^1.1",
"phpstan/phpstan-symfony": "^1.2",
"phpunit/phpunit": "^9.5",
"teamneusta/pimcore-testing-framework": "^0.11"
"teamneusta/pimcore-testing-framework": "^0.12"
},
"conflict": {
"presta/sitemap-bundle": "<3.2",
Expand Down
5 changes: 4 additions & 1 deletion config/services.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
services:

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

Neusta\Pimcore\FixtureBundle\Command\LoadFixturesCommand:
arguments:
$container: '@Symfony\Component\DependencyInjection\ContainerInterface'
$container: '@service_container'
$eventDispatcher: '@event_dispatcher'
$fixtureClass: !abstract defined in extension
tags:
Expand Down
15 changes: 0 additions & 15 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,6 @@ parameters:
count: 1
path: src/Command/LoadFixturesCommand.php

-
message: "#^Method Neusta\\\\Pimcore\\\\FixtureBundle\\\\Helper\\\\AssetHelper\\:\\:createAssetFolder\\(\\) should return Pimcore\\\\Model\\\\Asset\\\\Folder but returns Pimcore\\\\Model\\\\Asset\\\\Folder\\|Pimcore\\\\Model\\\\DataObject\\\\Folder\\|Pimcore\\\\Model\\\\Document\\\\Folder\\.$#"
count: 1
path: src/Helper/AssetHelper.php

-
message: "#^Cannot call method getId\\(\\) on Pimcore\\\\Model\\\\DataObject\\\\Classificationstore\\\\GroupConfig\\|null\\.$#"
count: 1
Expand Down Expand Up @@ -44,13 +39,3 @@ parameters:
message: "#^Parameter \\#4 \\$storeId of static method Neusta\\\\Pimcore\\\\FixtureBundle\\\\Helper\\\\ClassificationstoreHelper\\:\\:createKeyConfig\\(\\) expects int, int\\|null given\\.$#"
count: 1
path: src/Helper/ClassificationstoreHelper.php

-
message: "#^Method Neusta\\\\Pimcore\\\\FixtureBundle\\\\Helper\\\\DataObjectHelper\\:\\:createFolderByPath\\(\\) should return Pimcore\\\\Model\\\\DataObject\\\\Folder but returns Pimcore\\\\Model\\\\Asset\\\\Folder\\|Pimcore\\\\Model\\\\DataObject\\\\Folder\\|Pimcore\\\\Model\\\\Document\\\\Folder\\.$#"
count: 1
path: src/Helper/DataObjectHelper.php

-
message: "#^Method Neusta\\\\Pimcore\\\\FixtureBundle\\\\Helper\\\\DocumentHelper\\:\\:createFolderByPath\\(\\) should return Pimcore\\\\Model\\\\Document\\\\Folder but returns Pimcore\\\\Model\\\\Asset\\\\Folder\\|Pimcore\\\\Model\\\\DataObject\\\\Folder\\|Pimcore\\\\Model\\\\Document\\\\Folder\\.$#"
count: 1
path: src/Helper/DocumentHelper.php
6 changes: 5 additions & 1 deletion src/Helper/AssetHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ public function __construct(private readonly string $prefix)

public function createAssetFolder(string $path = ''): Asset\Folder
{
return Service::createFolderByPath('/' . trim($this->prefix, '/') . '/' . ltrim($path, '/'));
$assetFolder = Service::createFolderByPath('/' . trim($this->prefix, '/') . '/' . ltrim($path, '/'));
if ($assetFolder instanceof Asset\Folder) {
return $assetFolder;
}
throw new \Exception(sprintf('No asset folder with path %s could be created.', $path));
}
}
6 changes: 5 additions & 1 deletion src/Helper/DataObjectHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ public function __construct(private readonly string $prefix)

public function createFolderByPath(string $path = ''): DataObject\Folder
{
return DataObject\Service::createFolderByPath($this->getFullPathByPath($path));
$dataObjectFolder = DataObject\Service::createFolderByPath($this->getFullPathByPath($path));
if ($dataObjectFolder instanceof DataObject\Folder) {
return $dataObjectFolder;
}
throw new \Exception(sprintf('No data object folder with path %s could be created.', $path));
}

public function getFullPathByPath(string $path): string
Expand Down
6 changes: 5 additions & 1 deletion src/Helper/DocumentHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ public function __construct(private readonly string $prefix)

public function createFolderByPath(string $path, string $locale = ''): Document\Folder
{
return Document\Service::createFolderByPath($this->getFullPathByPath($path, $locale));
$documentFolder = Document\Service::createFolderByPath($this->getFullPathByPath($path, $locale));
if ($documentFolder instanceof Document\Folder) {
return $documentFolder;
}
throw new \Exception(sprintf('No document folder with path %s could be created.', $path));
}

public function getFullPathByPath(string $path, string $locale = ''): string
Expand Down
2 changes: 1 addition & 1 deletion tests/app/TestKernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

final class TestKernel extends Neusta\Pimcore\TestingFramework\Kernel\TestKernel
{
public function registerBundlesToCollection(BundleCollection $collection)
public function registerBundlesToCollection(BundleCollection $collection): void
{
$collection->addBundle(NeustaPimcoreFixtureBundle::class);
}
Expand Down

0 comments on commit c284205

Please sign in to comment.