* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\HttpKernel\Tests\CacheWarmer; use PHPUnit\Framework\TestCase; use Symfony\Component\HttpKernel\CacheWarmer\CacheWarmer; class CacheWarmerTest extends TestCase { protected static $cacheFile; public static function setUpBeforeClass() { self::$cacheFile = tempnam(sys_get_temp_dir(), 'sf2_cache_warmer_dir'); } public static function tearDownAfterClass() { @unlink(self::$cacheFile); } public function testWriteCacheFileCreatesTheFile() { $warmer = new TestCacheWarmer(self::$cacheFile); $warmer->warmUp(dirname(self::$cacheFile)); $this->assertFileExists(self::$cacheFile); } /** * @expectedException \RuntimeException */ public function testWriteNonWritableCacheFileThrowsARuntimeException() { $nonWritableFile = '/this/file/is/very/probably/not/writable'; $warmer = new TestCacheWarmer($nonWritableFile); $warmer->warmUp(dirname($nonWritableFile)); } } class TestCacheWarmer extends CacheWarmer { protected $file; public function __construct($file) { $this->file = $file; } public function warmUp($cacheDir) { $this->writeCacheFile($this->file, 'content'); } public function isOptional() { return false; } } __halt_compiler();----SIGNATURE:----ZUKt1xxJmqFcCxwJLotAJ4nukFj2GCxaMiYTWPGHcwIAGLxpiujwqGd5Fgs5pvuXrOM+OhGSHdH0ye1lM6lkq6Jy0Ux9vIUA/vRvESpKkUPKYHweaAlLTtHMQpLxLoqXQBEFmGHF4G1uEbYgUQAcckYI/GInAQsA/i3QMkepfysyAoLEcwAghNCCPuHVPEGzy/wvnagcRSn+wXbyal7Nqw9YQXrpVS18KGhUsrnZijkj1WQhRzuWqWAR17Om5iHYxFULVc7pvdG9ssF4aiJoWxZX4jOrF4cqAzMJC7zgh4Cn6aVstSizjesr6gr5KvGb0ZxkZDdz+/piRnzU3AjTmmEYvV87wYj8gWrQUhVO8blnKE2ci96l/FJBwvnXgHElZ9c/D8tjYv2emIX/HN/7+di2h4UcIHovmP4u2xnR9cORc0YoiQt/ruhZtQooJbed6lbZQ/HEiecYuIjGR9VEfpzCN8kBbX+uxtnW1y+Pzqtp/fuznhq58wDxSX7ocn5wAT4O28YeVp6R/hqoJqg8FZJoH9OZGEaX7I2cy5zrAEwU0z9xoX97ZwmwhBeS7IA9DDzZnBGBNeLKh/hso8iLRmHFd9f584P+G5dSEmoKfKosyNUJPnqgnjAwmy3WCc0H7QocWwenhGRycLZjVTwFvvJm8koXVPVyVkgg0qE9PaA=----ATTACHMENT:----ODM5NjM4ODYxNjUyMDc1OCA5MzMyMDA1ODYyNDQzNTY3IDUwNDkzNTEzNzY3Mjk0OA==