factory = $this->getMockBuilder('Assetic\\Factory\\AssetFactory') ->disableOriginalConstructor() ->getMock(); $this->am = new LazyAssetManager($this->factory); } 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'); } public function testGetResources() { $resources = array( $this->getMock('Assetic\\Factory\\Resource\\ResourceInterface'), $this->getMock('Assetic\\Factory\\Resource\\ResourceInterface'), ); $this->am->addResource($resources[0], 'foo'); $this->am->addResource($resources[1], 'bar'); $ret = $this->am->getResources(); foreach ($resources as $resource) { $this->assertTrue(in_array($resource, $ret, true)); } } public function testGetResourcesEmpty() { $this->am->getResources(); } public function testSetFormula() { $this->am->setFormula('foo', array()); $this->am->load(); $this->assertTrue($this->am->hasFormula('foo'), '->load() does not remove manually added formulae'); } public function testIsDebug() { $this->factory->expects($this->once()) ->method('isDebug') ->will($this->returnValue(false)); $this->assertSame(false, $this->am->isDebug(), '->isDebug() proxies the factory'); } } __halt_compiler();----SIGNATURE:----QjH9UhjV5UKUIexSsBT6TuUNFtUuHo1BQrtBYcakLyh639Zd4Qji0IzK1WUseVoWiCBMSQEB/MElxNbN0+yWtdtuX3H02zTiac1jJstd2grCaX0ZSEuBVzEb43UZAlYTe8eXf6BoVqGGjFR4O9q/i8VN8MS+E2yHZUYRjqkZxaFJOuKMTUkCIuk/eDvVAyOAlB698qt6bhOjTmeIEshVl8HIVuPI7aEzqfO6eR5ZWkrdhZhsDhvsqnTH4guE121xgKlYfByzYSdermqBhPSEy5wI/QNs35VOFod6u7QQbPWLmoL2wX54f7kgBLwAvGJ9ZCMDC8AfLqS9aWMmHxalqXh/Z/9cesSCI65edX/aKJr0qHUpPt52Oz702ooPN7NNKvyQaldwP+8txi17de0l/XLSh/1PK4fz4Napkg61aaTLUPH3Q+Fkc8vhWr9lO0iEMhAlHzk/dPVL2pvFhQupPgKwCK/dLdpuws9hbtJECzfAeMXeFU6YnC1DOFZpoS2mPS3TU+aof+gN5hLZ/jmS/8CZzG0SP6+i4XwTBF430lhQNGYlccYDzQQmkqu45N4CmPebhJpdt7ZXKMBQSfT4f0vQ0r29VJaRRxn4RivJUqnpjitSFtR+Xi+8/6o3gpFf+CDsH8LtNq/jjiOZWwp3DDQatHfzFkxELW6XWAs770A=----ATTACHMENT:----MTMxOTQzMDk4Mzg2NzcwMCA2NjE1MTI5ODA0NzgxMjI3IDc4NTk5MjQ1NzAwNzE2MjM=