Symfony\Bundle\AsseticBundle\Tests\Factory\AssetFactoryTest::testBundleNotation PHP Method

testBundleNotation() public method

public testBundleNotation ( )
    public function testBundleNotation()
    {
        $input = '@MyBundle/Resources/css/main.css';
        $bundle = $this->getMockBuilder('Symfony\\Component\\HttpKernel\\Bundle\\BundleInterface')->getMock();
        $this->parameterBag->expects($this->once())->method('resolveValue')->will($this->returnCallback(function ($v) {
            return $v;
        }));
        $this->kernel->expects($this->once())->method('getBundle')->with('MyBundle')->will($this->returnValue($bundle));
        $this->kernel->expects($this->once())->method('locateResource')->with($input)->will($this->returnValue('/path/to/MyBundle/Resources/css/main.css'));
        $bundle->expects($this->once())->method('getPath')->will($this->returnValue('/path/to/MyBundle'));
        $coll = $this->factory->createAsset($input)->all();
        $asset = $coll[0];
        $this->assertEquals('/path/to/MyBundle', $asset->getSourceRoot(), '->createAsset() sets the asset root');
        $this->assertEquals('Resources/css/main.css', $asset->getSourcePath(), '->createAsset() sets the asset path');
    }