use Symfony\Component\AssetMapper\Exception\RuntimeException;
use Symfony\Component\AssetMapper\Factory\MappedAssetFactory;
use Symfony\Component\AssetMapper\MappedAsset;
use Symfony\Component\AssetMapper\Path\PublicAssetsPathResolverInterface;
class MappedAssetFactoryTest extends TestCase
{ private AssetMapperInterface&MockObject
$assetMapper;
public function testCreateMappedAsset() { $factory =
$this->
createFactory();
$asset =
$factory->
createMappedAsset('file2.js', __DIR__.'/../fixtures/dir1/file2.js'
);
$this->
assertSame('file2.js',
$asset->logicalPath
);
$this->
assertMatchesRegularExpression('/^\/final-assets\/file2-[a-zA-Z0-9]{7,128}\.js$/',
$asset->publicPath
);
$this->
assertSame('/final-assets/file2.js',
$asset->publicPathWithoutDigest
);
} public function testCreateMappedAssetRespectsPreDigestedPaths() { $assetMapper =
$this->
createFactory();
$asset =
$assetMapper->
createMappedAsset('already-abcdefVWXYZ0123456789.digested.css', __DIR__.'/../fixtures/dir2/already-abcdefVWXYZ0123456789.digested.css'
);