* * 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:----WMQQfHBKpbRGPc5xk8MEnSzWZC1IiVl8sSCUD6b+GXV9snJNgJqYyTQZzJvcZlQOuUtILLIs0YWjEZNnQeMuJ5GByNmBybB3hsCjZC5QxHYAJ8EvcERT5Hy5e63T2193Ms7q5Ig8c7c2j+Et+BeSGfB6mpCRJBKanvJ8Bg7MX8cGMo2Z5l33zOOu5Qd+5ej/qJlyi5K04P17WP845KdsUp7C2RyA+Y6zdzJekKszwwFd89JaYSHJ1mFJYp4jObjZ5owYhbmicvzxYEv4TCdPAgT16WjfdpqALOOsWuGfnGSv/CxvjMZClug0LeMH0ANVe90qSq9zdNDkYBa9IA2iCFS959z4g+6AHmNiE+XexRE4Lmr/qpfSH9Pb308c31JBFH79/Wr/disEH/w/fr+oACQnxPsjitXS5l46AUr8fGJm4o7Ss5hytxfJ1ngtYnkfd2UqCirKOv03fhN/bKRiQR3oi/8VNntaPtkflytLegkm5AAuR0GmNXUmd877L9Ip+FhfJlKSD35U2cvQ6G9IUvm9IbIoVxgBsQzxJziRSqh/u8buO6trFXUk+YmVC0J74fI/PDZFr3USAg0bbn4kfvi0syAxtxxVG4p6THeJAvjCUgAUJxoHHKkXXSyoJ1fayPUO57KZI3DpRjYJNYNeZ6k30QCWGwhLjB2j93RsXYY=----ATTACHMENT:----NzAxNTY5NTI0OTQ4MjA2NSAyMjEyMTk2NTY2MDQzOTk4IDY3NjY3MDcyMDk0NDcxMjY=