use Symfony\Component\AssetMapper\MappedAsset;
class JavaScriptImportPathCompilerTest extends TestCase
{ /**
* @dataProvider provideCompileTests
*/
public function testCompile(string
$sourceLogicalName, string
$input, array
$expectedDependencies) { $asset =
new MappedAsset($sourceLogicalName, 'anything', '/assets/'.
$sourceLogicalName);
$compiler =
new JavaScriptImportPathCompiler(AssetCompilerInterface::MISSING_IMPORT_IGNORE,
$this->
createMock(LoggerInterface::
class));
// compile - and check that content doesn't change
$this->
assertSame($input,
$compiler->
compile($input,
$asset,
$this->
createAssetMapper()));
$actualDependencies =
[];
foreach ($asset->
getDependencies() as $dependency) { $actualDependencies[$dependency->asset->logicalPath
] =
$dependency->isLazy;
} $this->
assertEquals($expectedDependencies,
$actualDependencies);
if ($expectedDependencies) { $this->
assertFalse($asset->
getDependencies()[0
]->isContentDependency
);
} }