am = $this->getMock('Assetic\\AssetManager'); $this->ref = new AssetReference($this->am, 'foo'); } /** * @dataProvider getMethodAndRetVal */ public function testMethods($method, $returnValue) { $asset = $this->getMock('Assetic\\Asset\\AssetInterface'); $this->am->expects($this->once()) ->method('get') ->with('foo') ->will($this->returnValue($asset)); $asset->expects($this->once()) ->method($method) ->will($this->returnValue($returnValue)); $this->assertEquals($returnValue, $this->ref->$method(), '->'.$method.'() returns the asset value'); } public function getMethodAndRetVal() { return array( array('getContent', 'asdf'), array('getSourceRoot', 'asdf'), array('getSourcePath', 'asdf'), array('getTargetPath', 'asdf'), array('getLastModified', 123), ); } public function testLazyFilters() { $this->am->expects($this->never())->method('get'); $this->ref->ensureFilter($this->getMock('Assetic\\Filter\\FilterInterface')); } public function testFilterFlush() { $asset = $this->getMock('Assetic\\Asset\\AssetInterface'); $this->am->expects($this->exactly(2)) ->method('get') ->with('foo') ->will($this->returnValue($asset)); $asset->expects($this->once())->method('ensureFilter'); $asset->expects($this->once()) ->method('getFilters') ->will($this->returnValue(array())); $this->ref->ensureFilter($this->getMock('Assetic\\Filter\\FilterInterface')); $this->assertInternalType('array', $this->ref->getFilters(), '->getFilters() flushes and returns filters'); } public function testSetContent() { $asset = $this->getMock('Assetic\\Asset\\AssetInterface'); $this->am->expects($this->once()) ->method('get') ->with('foo') ->will($this->returnValue($asset)); $asset->expects($this->once()) ->method('setContent') ->with('asdf'); $this->ref->setContent('asdf'); } public function testLoad() { $filter = $this->getMock('Assetic\\Filter\\FilterInterface'); $asset = $this->getMock('Assetic\\Asset\\AssetInterface'); $this->am->expects($this->exactly(2)) ->method('get') ->with('foo') ->will($this->returnValue($asset)); $asset->expects($this->once()) ->method('load') ->with($filter); $this->ref->load($filter); } public function testDump() { $filter = $this->getMock('Assetic\\Filter\\FilterInterface'); $asset = $this->getMock('Assetic\\Asset\\AssetInterface'); $this->am->expects($this->exactly(2)) ->method('get') ->with('foo') ->will($this->returnValue($asset)); $asset->expects($this->once()) ->method('dump') ->with($filter); $this->ref->dump($filter); } public function testClone() { $filter1 = $this->getMock('Assetic\\Filter\\FilterInterface'); $filter2 = $this->getMock('Assetic\\Filter\\FilterInterface'); $filter3 = $this->getMock('Assetic\\Filter\\FilterInterface'); $asset = new StringAsset(''); $this->am->expects($this->any()) ->method('get') ->with('foo') ->will($this->returnValue($asset)); $this->ref->ensureFilter($filter1); $this->ref->load(); $clone1 = clone $this->ref; $clone1->ensureFilter($filter2); $clone1->load(); $clone2 = clone $clone1; $clone2->ensureFilter($filter3); $clone2->load(); $this->assertCount(1, $asset->getFilters()); $this->assertCount(1, $this->ref->getFilters()); $this->assertCount(2, $clone1->getFilters()); $this->assertCount(3, $clone2->getFilters()); } } __halt_compiler();----SIGNATURE:----EmrNCX7cuuv5zTc5ktqXf416Aa4Mv3CTEDn8DcmSF9adN0kaGk8w1+ma7Pal6JCzatxIcyjJ+vrEdcnnS9Aim5v65YQTT0vIhnCMXbqI3gzOwFsj3Eb29iT58BiAT41mvpE/4cOZHNRTjbKFHKnEt6HndnEM4uIOJOxbBeSgMzmHU/I40pImS/tBtIagCZKVH6sK0wdhsa2HRAGFvD/WLrPoColDVWsAhD6a6zxS69F5Nb6wunzkOkpJ7WbPpdGD33oK4+5vURyqZ41f2gSTNxaeG+mIK6qzJsIE5dQaBN/Cb85zy2ODtuHQsxeNcUMFVxW5FL5gaT/Pnj7L1J3IXE+jjE6fQvV/RM8fgcgcSO2TF9q3sFs4YzwmT39vYDnXR18b0//YAkwh0fRfoqe2/uG/bjXYh/EY6hSFEZszYo1glQvPBDfuxy9Jo4555cqiFHOumT/CA8du/On8zdM8j2Sxco28dzPcEieYlRAFhttvk6D3yfGzKycPJqbS2ltcjv6OJxHgsdV3UWxuSMh0/JMqep5vmBNxjorQ27qaQEcHijdEoJY7MON3wn79n2mRynkJbuJmL/l1EtQPeK2Ap4hFseODZ3+TzuMSl/tEpeErQbqzTu69DUMflt8TFasqdDVSjg+pF6HErYhRt24QpKVFebwJc7P5XFRL/7aiBcw=----ATTACHMENT:----NzEyMjQ3MDQzMTM0MjYwMyA0NDg0MzYzNDMxMDY4MDkyIDMzNjE0ODI3NDY5OTgxMjg=