* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Config\Tests; use PHPUnit\Framework\TestCase; use Symfony\Component\Config\ConfigCache; use Symfony\Component\Config\Tests\Resource\ResourceStub; class ConfigCacheTest extends TestCase { private $cacheFile = null; protected function setUp() { $this->cacheFile = tempnam(sys_get_temp_dir(), 'config_'); } protected function tearDown() { $files = array($this->cacheFile, $this->cacheFile.'.meta'); foreach ($files as $file) { if (file_exists($file)) { unlink($file); } } } /** * @dataProvider debugModes */ public function testCacheIsNotValidIfNothingHasBeenCached($debug) { unlink($this->cacheFile); // remove tempnam() side effect $cache = new ConfigCache($this->cacheFile, $debug); $this->assertFalse($cache->isFresh()); } public function testIsAlwaysFreshInProduction() { $staleResource = new ResourceStub(); $staleResource->setFresh(false); $cache = new ConfigCache($this->cacheFile, false); $cache->write('', array($staleResource)); $this->assertTrue($cache->isFresh()); } /** * @dataProvider debugModes */ public function testIsFreshWhenNoResourceProvided($debug) { $cache = new ConfigCache($this->cacheFile, $debug); $cache->write('', array()); $this->assertTrue($cache->isFresh()); } public function testFreshResourceInDebug() { $freshResource = new ResourceStub(); $freshResource->setFresh(true); $cache = new ConfigCache($this->cacheFile, true); $cache->write('', array($freshResource)); $this->assertTrue($cache->isFresh()); } public function testStaleResourceInDebug() { $staleResource = new ResourceStub(); $staleResource->setFresh(false); $cache = new ConfigCache($this->cacheFile, true); $cache->write('', array($staleResource)); $this->assertFalse($cache->isFresh()); } public function debugModes() { return array( array(true), array(false), ); } } __halt_compiler();----SIGNATURE:----WhUJLLcniM3BunFz9zlmXEmry0vGCqY5C8O5XkxjnEBztnRDfcY/HvHN7aAiSdFy2unmtptvQ1gJUkCtDmcw0FBpqXoiO13QpFTwQ/kc6zLfV/9zWuQZU+2/9sWCVHJ7N1Oq3FX+Cj71QkcxIFZkNq88UhGTjC8I2uDC2A0zXjzQEqoaiFGGuDCJK9AQKoeM2eREcP4r5BdyvXSiAh7gp+QIw8XWEFjvoYjBkSFb6w/0oTfk1sxHJ1JHQhwQY6gYUgRJ4zJqv25/pkM+8ua1mhOX86s8bI1ASV5U3xfBwBfvPDqL6fKrY2xAN+HnNMyf5oD+4MgZaoORaAOWlSZ1OCsnv1UPP45U8p9HPNL9XyGKSTTW/qxjp48oW/YAPHte7GyLmTc2S2IzGuqREX3uu13O24h+2JIcpWtZS9KH8OO9Kz63+6xBGxDKT/vnlb/soi5mMgOFI+E+wGHDBYrdDzeM1lXaaKpM5p3czUD4M+mCLTtSkiEglJlSN9FBUU0aqYUsKiW0j1dG6RFs4vXx+yVP7TEb+wHINpyB0TvTo21vbSIDYKAq2cdLyPiOF22v+CjBs61EXB5pG2BzSTxPuIHQ6A7t07cnmVBaRHJTWWAYmwETZ2yYxb8cfY45OTRRmlFAL0tc6LbM0Dj6wPUkiMf6Z2JEfswdK3C0jyDRRho=----ATTACHMENT:----NjA2NTMzMTQ4Mzg0NTk0MyA5ODcxMDIxNTA5NTMwOTIyIDI4ODQwNzQ3MDk2Njg4OTc=