mirror of
https://github.com/graycoreio/github-actions-magento2.git
synced 2026-06-08 19:46:41 +00:00
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
This commit is contained in:
@@ -75,6 +75,7 @@ jobs:
|
|||||||
run: composer install
|
run: composer install
|
||||||
env:
|
env:
|
||||||
COMPOSER_AUTH: ${{ secrets.composer_auth }}
|
COMPOSER_AUTH: ${{ secrets.composer_auth }}
|
||||||
|
COMPOSER_MIRROR_PATH_REPOS: 1
|
||||||
|
|
||||||
- name: Configure phpunit.xml.dist
|
- name: Configure phpunit.xml.dist
|
||||||
working-directory: ${{ steps.setup-magento.outputs.path }}
|
working-directory: ${{ steps.setup-magento.outputs.path }}
|
||||||
@@ -136,6 +137,7 @@ jobs:
|
|||||||
run: composer install
|
run: composer install
|
||||||
env:
|
env:
|
||||||
COMPOSER_AUTH: ${{ secrets.composer_auth }}
|
COMPOSER_AUTH: ${{ secrets.composer_auth }}
|
||||||
|
COMPOSER_MIRROR_PATH_REPOS: 1
|
||||||
|
|
||||||
- name: Enable all modules
|
- name: Enable all modules
|
||||||
working-directory: ${{ steps.setup-magento.outputs.path }}
|
working-directory: ${{ steps.setup-magento.outputs.path }}
|
||||||
@@ -205,6 +207,7 @@ jobs:
|
|||||||
run: composer install
|
run: composer install
|
||||||
env:
|
env:
|
||||||
COMPOSER_AUTH: ${{ secrets.composer_auth }}
|
COMPOSER_AUTH: ${{ secrets.composer_auth }}
|
||||||
|
COMPOSER_MIRROR_PATH_REPOS: 1
|
||||||
|
|
||||||
- uses: graycoreio/github-actions-magento2/get-magento-version@main
|
- uses: graycoreio/github-actions-magento2/get-magento-version@main
|
||||||
id: magento-version
|
id: magento-version
|
||||||
|
|||||||
@@ -140,6 +140,7 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
COMPOSER_CACHE_DIR: ${{ steps.composer-cache.outputs.dir }}
|
COMPOSER_CACHE_DIR: ${{ steps.composer-cache.outputs.dir }}
|
||||||
COMPOSER_AUTH: ${{ secrets.composer_auth }}
|
COMPOSER_AUTH: ${{ secrets.composer_auth }}
|
||||||
|
COMPOSER_MIRROR_PATH_REPOS: 1
|
||||||
|
|
||||||
- name: Replace Configuration Settings for env
|
- name: Replace Configuration Settings for env
|
||||||
working-directory: ${{ inputs.magento_directory }}/dev/tests/integration
|
working-directory: ${{ inputs.magento_directory }}/dev/tests/integration
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Graycore\DemoPackage\Test\Integration;
|
||||||
|
|
||||||
|
use Magento\Framework\View\Element\Template;
|
||||||
|
use Magento\TestFramework\Helper\Bootstrap;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fails when the extension is installed as a symlink (default Composer path repo behavior)
|
||||||
|
* because Magento's template engine cannot resolve .phtml files through symlinks.
|
||||||
|
* Requires COMPOSER_MIRROR_PATH_REPOS=1 during composer install.
|
||||||
|
*/
|
||||||
|
class TemplateRenderTest extends \PHPUnit\Framework\TestCase
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @magentoAppArea frontend
|
||||||
|
*/
|
||||||
|
public function testTemplateRendersWithoutSymlinkError()
|
||||||
|
{
|
||||||
|
$block = Bootstrap::getObjectManager()->create(Template::class);
|
||||||
|
$block->setTemplate('Graycore_DemoPackage::demo.phtml');
|
||||||
|
$this->assertNotEmpty($block->toHtml());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
<?php /** @var \Magento\Framework\View\Element\Template $block */ ?>
|
||||||
|
<div>demo</div>
|
||||||
Reference in New Issue
Block a user