public function testErrorMessageAvoidsCircularException() { $assetMapper =
$this->
createMock(AssetMapperInterface::
class);
$assetMapper->
expects($this->
any()) ->
method('getAsset'
) ->
willReturnCallback(function D
$logicalPath) { if ('htmx' ===
$logicalPath) { return null;
} if ('htmx.js' ===
$logicalPath) { throw new CircularAssetsException();
} });
$asset =
new MappedAsset('htmx.js', '/path/to/app.js'
);
$compiler =
new JavaScriptImportPathCompiler();
$content = '//** @type {import("./htmx").HtmxApi} */';
$compiled =
$compiler->
compile($content,
$asset,
$assetMapper);
// To form a good exception message, the compiler will check for the
// htmx.js asset, which will throw a CircularAssetsException. This
// should not be caught.
$this->
assertSame($content,
$compiled);
}