loader = $this->getMock('Assetic\\Factory\\Loader\\FormulaLoaderInterface'); $this->configCache = $this->getMockBuilder('Assetic\\Cache\\ConfigCache') ->disableOriginalConstructor() ->getMock(); $this->resource = $this->getMock('Assetic\\Factory\\Resource\\ResourceInterface'); } public function testNotDebug() { $expected = array( 'foo' => array(array(), array(), array()), 'bar' => array(array(), array(), array()), ); $this->configCache->expects($this->once()) ->method('has') ->with($this->isType('string')) ->will($this->returnValue(false)); $this->loader->expects($this->once()) ->method('load') ->with($this->resource) ->will($this->returnValue($expected)); $this->configCache->expects($this->once()) ->method('set') ->with($this->isType('string'), $expected); $loader = new CachedFormulaLoader($this->loader, $this->configCache); $this->assertEquals($expected, $loader->load($this->resource), '->load() returns formulae'); } public function testNotDebugCached() { $expected = array( 'foo' => array(array(), array(), array()), 'bar' => array(array(), array(), array()), ); $this->configCache->expects($this->once()) ->method('has') ->with($this->isType('string')) ->will($this->returnValue(true)); $this->resource->expects($this->never()) ->method('isFresh'); $this->configCache->expects($this->once()) ->method('get') ->with($this->isType('string')) ->will($this->returnValue($expected)); $loader = new CachedFormulaLoader($this->loader, $this->configCache); $this->assertEquals($expected, $loader->load($this->resource), '->load() returns formulae'); } public function testDebugCached() { $timestamp = 123; $expected = array( 'foo' => array(array(), array(), array()), 'bar' => array(array(), array(), array()), ); $this->configCache->expects($this->once()) ->method('has') ->with($this->isType('string')) ->will($this->returnValue(true)); $this->configCache->expects($this->once()) ->method('getTimestamp') ->with($this->isType('string')) ->will($this->returnValue($timestamp)); $this->resource->expects($this->once()) ->method('isFresh') ->with($timestamp) ->will($this->returnValue(true)); $this->loader->expects($this->never()) ->method('load'); $this->configCache->expects($this->once()) ->method('get') ->with($this->isType('string')) ->will($this->returnValue($expected)); $loader = new CachedFormulaLoader($this->loader, $this->configCache, true); $this->assertEquals($expected, $loader->load($this->resource), '->load() returns formulae'); } public function testDebugCachedStale() { $timestamp = 123; $expected = array( 'foo' => array(array(), array(), array()), 'bar' => array(array(), array(), array()), ); $this->configCache->expects($this->once()) ->method('has') ->with($this->isType('string')) ->will($this->returnValue(true)); $this->configCache->expects($this->once()) ->method('getTimestamp') ->with($this->isType('string')) ->will($this->returnValue($timestamp)); $this->resource->expects($this->once()) ->method('isFresh') ->with($timestamp) ->will($this->returnValue(false)); $this->loader->expects($this->once()) ->method('load') ->with($this->resource) ->will($this->returnValue($expected)); $this->configCache->expects($this->once()) ->method('set') ->with($this->isType('string'), $expected); $loader = new CachedFormulaLoader($this->loader, $this->configCache, true); $this->assertEquals($expected, $loader->load($this->resource), '->load() returns formulae'); } } __halt_compiler();----SIGNATURE:----yGRIef0EzxYGj3Z5/RzhhRvwbGFeGwY3Rh4FQUNPVkmw8VXKwPwx8qZsMQAMSC8cR+helzCv3AaUdDFAguhnCPt2vzPg4OexYWON8smnKXUF31n5FxSl4wMCvHPFaERVVHNttHD7Y9XPf7Ezk3kUrtXwEae7oErZ8vV1IOK/3uuTayOeg0pdsRDkA5W6XFecvORLk06KzhSWt5clddBYzCMSQdM7vcn1SLf/QB3IHV+SoVhPdem7WGs+Pmx8hixwZu7WuuW2FTXCWyylfkxOXl0E6AyYvdoYxErBLT3WLfdy8x5Q85IUtWOv4yO7ki2cvIDGVpF2SM6F2EMlFD8GPpaDx7TW7LmeqmKwiBPi8aophWs+vvdGc2EMsDKtIkF0P1d8F7l/qdu1EGv1SLLJkogCgK5wZjczANha6WxbCTvhj8fglAGMK11PIaRFOsGD4I28AosyXk6YHdOPdUZZerTp/Cx7mv4T6flky7EPKplurZj2u0g2Rayx65v46jRjsv5a+GVKfv6RR3eL/QlozifUj/Qsy3plyjt+dTPlJZxSovOLEbLjUurLdNArYXy7MeRC4HZQAkKSD2QxYae5lnOHEsQCScJWicmpDbx9nrwJ34eTUGAKxzUfw4XtlgNkeKHvFWJvhcvooYc7ciZfGaAgMlwgsAMCFFeyNxYRodQ=----ATTACHMENT:----MjkxNjU2ODI5NjQ1NDk1IDM1Mjg0MzQzMTI3MjE2NTYgNjU1NTIyNTgxNzI3MzEwOA==