use Symfony\Component\AssetMapper\Compiler\AssetCompilerInterface;
use Symfony\Component\AssetMapper\Compiler\CssAssetUrlCompiler;
use Symfony\Component\AssetMapper\MappedAsset;
class CssAssetUrlCompilerTest extends TestCase
{ /**
* @dataProvider provideCompileTests
*/
public function testCompile(string
$sourceLogicalName, string
$input, string
$expectedOutput, array
$expectedDependencies) { $compiler =
new CssAssetUrlCompiler(AssetCompilerInterface::MISSING_IMPORT_IGNORE,
$this->
createMock(LoggerInterface::
class));
$asset =
new MappedAsset($sourceLogicalName, 'anything', '/assets/'.
$sourceLogicalName);
$this->
assertSame($expectedOutput,
$compiler->
compile($input,
$asset,
$this->
createAssetMapper()));
$assetDependencyLogicalPaths =
array_map(fn (AssetDependency
$dependency) =>
$dependency->asset->logicalPath,
$asset->
getDependencies());
$this->
assertSame($expectedDependencies,
$assetDependencyLogicalPaths);
if ($expectedDependencies) { $this->
assertTrue($asset->
getDependencies()[0
]->isContentDependency
);
} } public static function provideCompileTests(): iterable
{