public function testGetFromLoader() {
$resource = $this
->getMock('Assetic\\Factory\\Resource\\ResourceInterface');
$loader = $this
->getMock('Assetic\\Factory\\Loader\\FormulaLoaderInterface');
$asset = $this
->getMock('Assetic\\Asset\\AssetInterface');
$formula = array(
array(
'js/core.js',
'js/more.js',
),
array(
'?yui_js',
),
array(
'output' => 'js/all.js',
),
);
$loader
->expects($this
->once())
->method('load')
->with($resource)
->will($this
->returnValue(array(
'foo' => $formula,
)));
$this->factory
->expects($this
->once())
->method('createAsset')
->with($formula[0], $formula[1], $formula[2] + array(
'name' => 'foo',
))
->will($this
->returnValue($asset));
$this->am
->setLoader('foo', $loader);
$this->am
->addResource($resource, 'foo');
$this
->assertSame($asset, $this->am
->get('foo'), '->get() returns an asset from the loader');
// test the "once" expectations
$this->am
->get('foo');
}