From d80befbe9b26dfa37af117775544c85ea36b7127 Mon Sep 17 00:00:00 2001 From: Damien Retzinger Date: Sun, 26 Apr 2026 23:05:21 -0400 Subject: [PATCH] fix(check-extension): mirror path repos to prevent symlink errors with template files (#218) Composer installs path repositories as symlinks by default, which causes Magento's template engine to fail when resolving .phtml files. Setting `COMPOSER_MIRROR_PATH_REPOS=1` on all composer install steps forces a copy instead, matching how the package would be installed from Packagist in production. Adds a .phtml template and an integration test to the demo package that renders it via Magento's template engine. Without COMPOSER_MIRROR_PATH_REPOS=1 the path repo is installed as a symlink and the test fails; with mirroring it passes. Closes #217 --- .github/workflows/check-extension.yaml | 3 +++ .github/workflows/integration.yaml | 1 + .../Test/Integration/TemplateRenderTest.php | 24 +++++++++++++++++++ .../view/frontend/templates/demo.phtml | 2 ++ 4 files changed, 30 insertions(+) create mode 100644 _test/demo-package/Test/Integration/TemplateRenderTest.php create mode 100644 _test/demo-package/view/frontend/templates/demo.phtml diff --git a/.github/workflows/check-extension.yaml b/.github/workflows/check-extension.yaml index 98a927e..881639b 100644 --- a/.github/workflows/check-extension.yaml +++ b/.github/workflows/check-extension.yaml @@ -75,6 +75,7 @@ jobs: run: composer install env: COMPOSER_AUTH: ${{ secrets.composer_auth }} + COMPOSER_MIRROR_PATH_REPOS: 1 - name: Configure phpunit.xml.dist working-directory: ${{ steps.setup-magento.outputs.path }} @@ -136,6 +137,7 @@ jobs: run: composer install env: COMPOSER_AUTH: ${{ secrets.composer_auth }} + COMPOSER_MIRROR_PATH_REPOS: 1 - name: Enable all modules working-directory: ${{ steps.setup-magento.outputs.path }} @@ -205,6 +207,7 @@ jobs: run: composer install env: COMPOSER_AUTH: ${{ secrets.composer_auth }} + COMPOSER_MIRROR_PATH_REPOS: 1 - uses: graycoreio/github-actions-magento2/get-magento-version@main id: magento-version diff --git a/.github/workflows/integration.yaml b/.github/workflows/integration.yaml index af8c307..22a5629 100644 --- a/.github/workflows/integration.yaml +++ b/.github/workflows/integration.yaml @@ -140,6 +140,7 @@ jobs: env: COMPOSER_CACHE_DIR: ${{ steps.composer-cache.outputs.dir }} COMPOSER_AUTH: ${{ secrets.composer_auth }} + COMPOSER_MIRROR_PATH_REPOS: 1 - name: Replace Configuration Settings for env working-directory: ${{ inputs.magento_directory }}/dev/tests/integration diff --git a/_test/demo-package/Test/Integration/TemplateRenderTest.php b/_test/demo-package/Test/Integration/TemplateRenderTest.php new file mode 100644 index 0000000..876a8fb --- /dev/null +++ b/_test/demo-package/Test/Integration/TemplateRenderTest.php @@ -0,0 +1,24 @@ +create(Template::class); + $block->setTemplate('Graycore_DemoPackage::demo.phtml'); + $this->assertNotEmpty($block->toHtml()); + } +} diff --git a/_test/demo-package/view/frontend/templates/demo.phtml b/_test/demo-package/view/frontend/templates/demo.phtml new file mode 100644 index 0000000..91bab1b --- /dev/null +++ b/_test/demo-package/view/frontend/templates/demo.phtml @@ -0,0 +1,2 @@ + +
demo