loadConfigCacheMetadataFor example

$factory->expects($this->once())
            ->method('createMappedAsset')
            ->willReturn($mappedAsset);

        $cachedFactory = new CachedMappedAssetFactory(
            $factory,
            $this->cacheDir,
            true
        );
        $cachedFactory->createMappedAsset('file1.css', $sourcePath);

        $configCacheMetadata = $this->loadConfigCacheMetadataFor($mappedAsset);
        $this->assertCount(5, $configCacheMetadata);
        $this->assertInstanceOf(FileResource::class$configCacheMetadata[0]);
        $this->assertInstanceOf(DirectoryResource::class$configCacheMetadata[1]);
        $this->assertInstanceOf(FileResource::class$configCacheMetadata[2]);
        $this->assertSame(realpath(__DIR__.'/../fixtures/importmap.php')$configCacheMetadata[0]->getResource());
        $this->assertSame($mappedAsset->sourcePath, $configCacheMetadata[2]->getResource());
        $this->assertSame($dependentOnContentAsset->sourcePath, $configCacheMetadata[3]->getResource());
        $this->assertSame($deeplyNestedAsset->sourcePath, $configCacheMetadata[4]->getResource());
    }

    private function loadConfigCacheMetadataFor(MappedAsset $mappedAsset): array
    {
Home | Imprint | This part of the site doesn't use cookies.