ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
Twig_Tests_Loader_ArrayTest Class Reference
+ Inheritance diagram for Twig_Tests_Loader_ArrayTest:
+ Collaboration diagram for Twig_Tests_Loader_ArrayTest:

Public Member Functions

 testGetSource ()
 @group legacy More...
 
 testGetSourceWhenTemplateDoesNotExist ()
 @group legacy @expectedException Twig_Error_Loader More...
 
 testGetSourceContextWhenTemplateDoesNotExist ()
 @expectedException Twig_Error_Loader More...
 
 testGetCacheKey ()
 
 testGetCacheKeyWhenTemplateHasDuplicateContent ()
 
 testGetCacheKeyIsProtectedFromEdgeCollisions ()
 
 testGetCacheKeyWhenTemplateDoesNotExist ()
 @expectedException Twig_Error_Loader More...
 
 testSetTemplate ()
 
 testIsFresh ()
 
 testIsFreshWhenTemplateDoesNotExist ()
 @expectedException Twig_Error_Loader More...
 
 testTemplateReference ()
 

Detailed Description

Definition at line 12 of file ArrayTest.php.

Member Function Documentation

◆ testGetCacheKey()

Twig_Tests_Loader_ArrayTest::testGetCacheKey ( )

Definition at line 45 of file ArrayTest.php.

46 {
47 $loader = new Twig_Loader_Array(array('foo' => 'bar'));
48
49 $this->assertEquals('foo:bar', $loader->getCacheKey('foo'));
50 }
Loads a template from an array.
Definition: Array.php:27

References $loader.

◆ testGetCacheKeyIsProtectedFromEdgeCollisions()

Twig_Tests_Loader_ArrayTest::testGetCacheKeyIsProtectedFromEdgeCollisions ( )

Definition at line 63 of file ArrayTest.php.

64 {
65 $loader = new Twig_Loader_Array(array(
66 'foo__' => 'bar',
67 'foo' => '__bar',
68 ));
69
70 $this->assertEquals('foo__:bar', $loader->getCacheKey('foo__'));
71 $this->assertEquals('foo:__bar', $loader->getCacheKey('foo'));
72 }

References $loader.

◆ testGetCacheKeyWhenTemplateDoesNotExist()

Twig_Tests_Loader_ArrayTest::testGetCacheKeyWhenTemplateDoesNotExist ( )

@expectedException Twig_Error_Loader

Definition at line 77 of file ArrayTest.php.

78 {
79 $loader = new Twig_Loader_Array(array());
80
81 $loader->getCacheKey('foo');
82 }

References $loader.

◆ testGetCacheKeyWhenTemplateHasDuplicateContent()

Twig_Tests_Loader_ArrayTest::testGetCacheKeyWhenTemplateHasDuplicateContent ( )

Definition at line 52 of file ArrayTest.php.

53 {
54 $loader = new Twig_Loader_Array(array(
55 'foo' => 'bar',
56 'baz' => 'bar',
57 ));
58
59 $this->assertEquals('foo:bar', $loader->getCacheKey('foo'));
60 $this->assertEquals('baz:bar', $loader->getCacheKey('baz'));
61 }

References $loader.

◆ testGetSource()

Twig_Tests_Loader_ArrayTest::testGetSource ( )

@group legacy

Definition at line 17 of file ArrayTest.php.

18 {
19 $loader = new Twig_Loader_Array(array('foo' => 'bar'));
20
21 $this->assertEquals('bar', $loader->getSource('foo'));
22 }

References $loader.

◆ testGetSourceContextWhenTemplateDoesNotExist()

Twig_Tests_Loader_ArrayTest::testGetSourceContextWhenTemplateDoesNotExist ( )

@expectedException Twig_Error_Loader

Definition at line 38 of file ArrayTest.php.

39 {
40 $loader = new Twig_Loader_Array(array());
41
42 $loader->getSourceContext('foo');
43 }

References $loader.

◆ testGetSourceWhenTemplateDoesNotExist()

Twig_Tests_Loader_ArrayTest::testGetSourceWhenTemplateDoesNotExist ( )

@group legacy @expectedException Twig_Error_Loader

Definition at line 28 of file ArrayTest.php.

29 {
30 $loader = new Twig_Loader_Array(array());
31
32 $loader->getSource('foo');
33 }

References $loader.

◆ testIsFresh()

Twig_Tests_Loader_ArrayTest::testIsFresh ( )

Definition at line 92 of file ArrayTest.php.

93 {
94 $loader = new Twig_Loader_Array(array('foo' => 'bar'));
95 $this->assertTrue($loader->isFresh('foo', time()));
96 }

References $loader.

◆ testIsFreshWhenTemplateDoesNotExist()

Twig_Tests_Loader_ArrayTest::testIsFreshWhenTemplateDoesNotExist ( )

@expectedException Twig_Error_Loader

Definition at line 101 of file ArrayTest.php.

102 {
103 $loader = new Twig_Loader_Array(array());
104
105 $loader->isFresh('foo', time());
106 }

References $loader.

◆ testSetTemplate()

Twig_Tests_Loader_ArrayTest::testSetTemplate ( )

Definition at line 84 of file ArrayTest.php.

85 {
86 $loader = new Twig_Loader_Array(array());
87 $loader->setTemplate('foo', 'bar');
88
89 $this->assertEquals('bar', $loader->getSourceContext('foo')->getCode());
90 }

References $loader.

◆ testTemplateReference()

Twig_Tests_Loader_ArrayTest::testTemplateReference ( )

Definition at line 108 of file ArrayTest.php.

109 {
111 $loader = new Twig_Loader_Array(array('foo' => 'bar'));
112
113 $loader->getCacheKey($name);
114 $loader->getSourceContext($name);
115 $loader->isFresh($name, time());
116 $loader->setTemplate($name, 'foo:bar');
117
118 // add a dummy assertion here to satisfy PHPUnit, the only thing we want to test is that the code above
119 // can be executed without crashing PHP
120 $this->addToAssertionCount(1);
121 }
if($format !==null) $name
Definition: metadata.php:146

References $loader, and $name.


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