diff --git a/src/Assetic/Asset/AssetReference.php b/src/Assetic/Asset/AssetReference.php index 4ac2741..e38cc42 100644 --- a/src/Assetic/Asset/AssetReference.php +++ b/src/Assetic/Asset/AssetReference.php @@ -32,6 +32,16 @@ public function __clone() } } + public function getName() + { + return $this->name; + } + + public function getAsset() + { + return $this->resolve(); + } + public function ensureFilter(FilterInterface $filter) { $this->filters[] = $filter; diff --git a/tests/Assetic/Test/Asset/AssetReferenceTest.php b/tests/Assetic/Test/Asset/AssetReferenceTest.php index 0b49f58..ed1c2a3 100644 --- a/tests/Assetic/Test/Asset/AssetReferenceTest.php +++ b/tests/Assetic/Test/Asset/AssetReferenceTest.php @@ -53,6 +53,23 @@ public function getMethodAndRetVal() ); } + public function testGetName() + { + $this->assertEquals('foo', $this->ref->getName()); + } + + public function testGetAsset() + { + $asset = $this->getMockBuilder(AssetInterface::class)->getMock(); + + $this->am->expects($this->once()) + ->method('get') + ->with('foo') + ->will($this->returnValue($asset)); + + $this->assertEquals($asset, $this->ref->getAsset(), '->getAsset() returns the asset object'); + } + public function testLazyFilters() { $this->am->expects($this->never())->method('get');