From 14a557a9a13536c1aac669a1c005fb60ead74451 Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Wed, 1 Nov 2023 14:17:04 -0400 Subject: [PATCH] fixing tests --- .../tests/AssetMapper/ControllerMapGeneratorTest.php | 6 ++++++ .../tests/Twig/UxControllersTwigRuntimeTest.php | 8 ++++++++ 2 files changed, 14 insertions(+) diff --git a/src/StimulusBundle/tests/AssetMapper/ControllerMapGeneratorTest.php b/src/StimulusBundle/tests/AssetMapper/ControllerMapGeneratorTest.php index 39b4128fc31..f2fbe946cb4 100644 --- a/src/StimulusBundle/tests/AssetMapper/ControllerMapGeneratorTest.php +++ b/src/StimulusBundle/tests/AssetMapper/ControllerMapGeneratorTest.php @@ -53,6 +53,7 @@ public function testGetControllersMap() return new MappedAsset($path, '/path/to'.$path); }); } else { + // @legacy for AssetMapper 6.3 $autoImportLocator->expects($this->never()) ->method('locateAsset'); } @@ -92,6 +93,11 @@ public function testGetControllersMap() $this->assertSame('fake-vendor/ux-package1/package-controller-second.js', $controllerSecond->asset->logicalPath); // lazy from user's controller.json $this->assertTrue($controllerSecond->isLazy); + // @legacy: assert can be without the conditional for AssetMapper 6.4+ + if (class_exists(ImportMapConfigReader::class)) { + // 4 auto imports from package.json + $this->assertCount(4, $controllerSecond->autoImports); + } $this->assertCount(4, $controllerSecond->autoImports); $helloControllerFromPackage = $map['fake-vendor--ux-package2--hello-controller']; diff --git a/src/StimulusBundle/tests/Twig/UxControllersTwigRuntimeTest.php b/src/StimulusBundle/tests/Twig/UxControllersTwigRuntimeTest.php index 2eeb7c93f69..3a133303748 100644 --- a/src/StimulusBundle/tests/Twig/UxControllersTwigRuntimeTest.php +++ b/src/StimulusBundle/tests/Twig/UxControllersTwigRuntimeTest.php @@ -13,6 +13,7 @@ use PHPUnit\Framework\TestCase; use Symfony\Component\AssetMapper\AssetMapperInterface; +use Symfony\Component\AssetMapper\ImportMap\ImportMapConfigReader; use Symfony\Component\AssetMapper\MappedAsset; use Symfony\UX\StimulusBundle\AssetMapper\ControllersMapGenerator; use Symfony\UX\StimulusBundle\Twig\UxControllersTwigRuntime; @@ -20,8 +21,15 @@ class UxControllersTwigRuntimeTest extends TestCase { + /** + * @group legacy + */ public function testRenderLinkTags() { + if (class_exists(ImportMapConfigReader::class)) { + $this->markTestSkipped('Skip test for AssetMapper 6.4+'); + } + $controllersMapGenerator = $this->createMock(ControllersMapGenerator::class); $controllersMapGenerator->expects($this->any()) ->method('getControllersJsonPath')