diff --git a/.github/workflows/qa.yaml b/.github/workflows/qa.yaml index 0e70098..77951b2 100644 --- a/.github/workflows/qa.yaml +++ b/.github/workflows/qa.yaml @@ -22,7 +22,7 @@ jobs: - name: PHP Setup uses: shivammathur/setup-php@v2 with: - php-version: 8.2 + php-version: 8.3 - name: Validate composer.json run: composer validate --strict diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 084dfab..705ce12 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -25,6 +25,8 @@ jobs: dependencies: "highest" # Pimcore 11.* - php-version: "8.2" dependencies: "highest" # Pimcore 11.* + - php-version: "8.3" + dependencies: "highest" # Pimcore 11.* steps: - name: Git Checkout diff --git a/compose.yaml b/compose.yaml index 28d168d..60ecb31 100644 --- a/compose.yaml +++ b/compose.yaml @@ -1,6 +1,6 @@ services: database: - image: mariadb:10.11.4 + image: mariadb:10.11.10 command: ["mysqld", "--character-set-server=utf8mb4", "--collation-server=utf8mb4_unicode_ci"] environment: MYSQL_ALLOW_EMPTY_PASSWORD: yes @@ -16,11 +16,11 @@ services: timeout: 10s php: - image: pimcore/pimcore:php8.2-latest + image: pimcore/pimcore:php8.3-latest volumes: - ./:/var/www/html/ environment: - MYSQL_SERVER_VERSION: mariadb-10.11.4 + MYSQL_SERVER_VERSION: 10.11.10-MariaDB depends_on: database: condition: service_healthy diff --git a/composer.json b/composer.json index 87bf15a..31965a4 100644 --- a/composer.json +++ b/composer.json @@ -18,7 +18,7 @@ } }, "require": { - "php": "~8.1.0 || ~8.2.0", + "php": "~8.1.0 || ~8.2.0 || ~8.3.0", "pimcore/pimcore": "^10.5 || ^11.0", "symfony/config": "^5.3 || ^6.0", "symfony/console": "^5.3 || ^6.0", @@ -36,7 +36,7 @@ "phpstan/phpstan-phpunit": "^1.1", "phpstan/phpstan-symfony": "^1.2", "phpunit/phpunit": "^9.5", - "teamneusta/pimcore-testing-framework": "^0.11.0" + "teamneusta/pimcore-testing-framework": "^0.12.0" }, "conflict": { "presta/sitemap-bundle": "<3.1", diff --git a/phpstan.neon b/phpstan.neon index 1f52c1b..d109b9d 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -7,5 +7,3 @@ parameters: bootstrapFiles: - vendor/pimcore/pimcore/stubs/dynamic-constants.php - - checkGenericClassInNonGenericObjectType: false diff --git a/src/Controller/PresentationController.php b/src/Controller/PresentationController.php index f5c503c..c6f8599 100644 --- a/src/Controller/PresentationController.php +++ b/src/Controller/PresentationController.php @@ -4,6 +4,7 @@ use Neusta\Pimcore\PresentationBundle\Renderer\PresentationRenderer; use Pimcore\Controller\FrontendController; +use Pimcore\Model\Document\PageSnippet; use Symfony\Component\HttpFoundation\Response; class PresentationController extends FrontendController @@ -12,10 +13,18 @@ public function __construct(private readonly PresentationRenderer $presentationR { } + /** + * @throws \RuntimeException + */ public function presentationAction(): Response { + if (!$this->document instanceof PageSnippet) { + throw new \RuntimeException('Presentation slides can only be used with PageSnippets'); + } + $slidesMarkup = $this->presentationRenderer->renderPresentation($this->document); + return $this->render('@NeustaPimcorePresentation/Presentation/presentation.html.twig', [ - 'slidesMarkup' => $this->presentationRenderer->renderPresentation($this->document), + 'slidesMarkup' => $slidesMarkup, ]); } } diff --git a/tests/Twig/PresentationExtensionTest.php b/tests/Twig/PresentationExtensionTest.php index d2f6dc0..94725dd 100644 --- a/tests/Twig/PresentationExtensionTest.php +++ b/tests/Twig/PresentationExtensionTest.php @@ -55,7 +55,7 @@ public function getThemeReturnsThemeOfParentDocumentIfAvailable(): void self::assertSame('theme filename of parent document', $presentationExtension->getThemeFile($context)); } - private function createDocumentWithEditableMock(?Document\Editable $themeEditable, Document\PageSnippet $parent = null): Document\PageSnippet + private function createDocumentWithEditableMock(?Document\Editable $themeEditable, ?Document\PageSnippet $parent = null): Document\PageSnippet { $document = $this->prophesize(Document\PageSnippet::class); $document