24 $this->assertEquals(
'bar',
$loader->getSource(
'foo'));
25 $this->assertEquals(
'foo',
$loader->getSource(
'bar'));
30 $path = dirname(__FILE__).
'/../Fixtures';
37 $this->assertEquals(
'foo',
$loader->getSourceContext(
'foo')->getName());
38 $this->assertSame(
'',
$loader->getSourceContext(
'foo')->getPath());
40 $this->assertEquals(
'errors/index.html',
$loader->getSourceContext(
'errors/index.html')->getName());
41 $this->assertSame(
'',
$loader->getSourceContext(
'errors/index.html')->getPath());
42 $this->assertEquals(
'baz',
$loader->getSourceContext(
'errors/index.html')->getCode());
44 $this->assertEquals(
'errors/base.html',
$loader->getSourceContext(
'errors/base.html')->getName());
45 $this->assertEquals(realpath(
$path.
'/errors/base.html'), realpath(
$loader->getSourceContext(
'errors/base.html')->getPath()));
46 $this->assertNotEquals(
'baz',
$loader->getSourceContext(
'errors/base.html')->getCode());
56 $loader->getSourceContext(
'foo');
77 $this->assertEquals(
'foo:bar',
$loader->getCacheKey(
'foo'));
78 $this->assertEquals(
'bar:foo',
$loader->getCacheKey(
'bar'));
96 $this->assertEquals(
'bar',
$loader->getSourceContext(
'foo')->getCode());
101 $loader1 = $this->getMockBuilder(
'Twig_ChainTestLoaderWithExistsInterface')->getMock();
102 $loader1->expects($this->once())->method(
'exists')->will($this->returnValue(
false));
103 $loader1->expects($this->never())->method(
'getSourceContext');
106 $loader2 = $this->getMockBuilder(
'Twig_ChainTestLoaderInterface')->getMock();
108 $loader2->expects($this->once())->method(
'getSourceContext')->will($this->returnValue(
new Twig_Source(
'content',
'index')));
114 $this->assertTrue(
$loader->exists(
'foo'));
testGetSourceWhenTemplateDoesNotExist()
legacy Twig_Error_Loader
Loads template from the filesystem.
testGetSourceContextWhenTemplateDoesNotExist()
Twig_Error_Loader
Adds an exists() method for loaders.
Adds a getSourceContext() method for loaders.
Loads templates from other loaders.
Create styles array
The data for the language used.
testGetCacheKeyWhenTemplateDoesNotExist()
Twig_Error_Loader
Holds information about a non-compiled Twig template.
Interface all loaders must implement.
Loads a template from an array.