ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
Twig_Tests_FileCachingTest Class Reference
+ Inheritance diagram for Twig_Tests_FileCachingTest:
+ Collaboration diagram for Twig_Tests_FileCachingTest:

Public Member Functions

 testWritingCacheFiles ()
 legacy More...
 
 testClearingCacheFiles ()
 legacy More...
 

Protected Member Functions

 setUp ()
 
 tearDown ()
 

Private Attributes

 $env
 
 $tmpDir
 

Detailed Description

Definition at line 14 of file FileCachingTest.php.

Member Function Documentation

◆ setUp()

Twig_Tests_FileCachingTest::setUp ( )
protected

Definition at line 19 of file FileCachingTest.php.

20  {
21  $this->tmpDir = sys_get_temp_dir().'/TwigTests';
22  if (!file_exists($this->tmpDir)) {
23  @mkdir($this->tmpDir, 0777, true);
24  }
25 
26  if (!is_writable($this->tmpDir)) {
27  $this->markTestSkipped(sprintf('Unable to run the tests as "%s" is not writable.', $this->tmpDir));
28  }
29 
30  $this->env = new Twig_Environment(new Twig_Loader_Array(array('index' => 'index', 'index2' => 'index2')), array('cache' => $this->tmpDir));
31  }
Stores the Twig configuration.
Definition: Environment.php:17
Loads a template from an array.
Definition: Array.php:26

◆ tearDown()

Twig_Tests_FileCachingTest::tearDown ( )
protected

Definition at line 33 of file FileCachingTest.php.

References Twig_Tests_FilesystemHelper\removeDir().

34  {
36  }
+ Here is the call graph for this function:

◆ testClearingCacheFiles()

Twig_Tests_FileCachingTest::testClearingCacheFiles ( )

legacy

Definition at line 53 of file FileCachingTest.php.

References $name.

54  {
55  $name = 'index2';
56  $this->env->loadTemplate($name);
57  $cacheFileName = $this->env->getCacheFilename($name);
58 
59  $this->assertFileExists($cacheFileName, 'Cache file does not exist.');
60  $this->env->clearCacheFiles();
61  $this->assertFileNotExists($cacheFileName, 'Cache file was not cleared.');
62  }

◆ testWritingCacheFiles()

Twig_Tests_FileCachingTest::testWritingCacheFiles ( )

legacy

Definition at line 41 of file FileCachingTest.php.

References $name.

42  {
43  $name = 'index';
44  $this->env->loadTemplate($name);
45  $cacheFileName = $this->env->getCacheFilename($name);
46 
47  $this->assertFileExists($cacheFileName, 'Cache file does not exist.');
48  }

Field Documentation

◆ $env

Twig_Tests_FileCachingTest::$env
private

Definition at line 16 of file FileCachingTest.php.

◆ $tmpDir

Twig_Tests_FileCachingTest::$tmpDir
private

Definition at line 17 of file FileCachingTest.php.


The documentation for this class was generated from the following file: