"Fossies" - the Fresh Open Source Software Archive

Member "4.6.1/vendor/mishal-iless/tests/ILess/Test/Issues/048Test.php" (8 Apr 2021, 1211 Bytes) of package /linux/www/studip-4.6.1.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) PHP source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 <?php
    2 
    3 /*
    4  * This file is part of the ILess
    5  *
    6  * For the full copyright and license information, please view the LICENSE
    7  * file that was distributed with this source code.
    8  */
    9 use ILess\Cache\FileSystemCache;
   10 
   11 /**
   12  * Issue #48 test
   13  *
   14  * @package ILess
   15  * @subpackage test
   16  * @group issue
   17  */
   18 class Test_Issues_048Test extends Test_TestCase
   19 {
   20     protected $cacheDir;
   21 
   22     public function setUp()
   23     {
   24         $this->cacheDir = sys_get_temp_dir() . '/iless_cache';
   25     }
   26 
   27     public function testIssue()
   28     {
   29         $cache = new FileSystemCache($this->cacheDir);
   30         $cache->set('foo', 'bar');
   31 
   32         $this->assertFileExists($this->cacheDir . '/foo.cache');
   33 
   34         // put something in the cache folder
   35         file_put_contents($this->cacheDir . '/something.txt', 'dummy contents');
   36 
   37         $cache->clean();
   38 
   39         // the cache file was removed by clean()
   40         $this->assertFileNotExists($this->cacheDir . '/foo.cache');
   41         // the file is not deleted by clean()
   42         $this->assertFileExists($this->cacheDir . '/something.txt');
   43     }
   44 
   45     public function tearDown()
   46     {
   47         // cleanup
   48         unlink($this->cacheDir . '/something.txt');
   49         rmdir($this->cacheDir);
   50     }
   51 
   52 }