-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
/
NativeFilesystemLoaderTest.php
41 lines (33 loc) · 1.46 KB
/
NativeFilesystemLoaderTest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?php
namespace Symfony\Bundle\TwigBundle\Tests\Loader;
use Symfony\Bundle\TwigBundle\Loader\NativeFilesystemLoader;
use Symfony\Bundle\TwigBundle\Tests\TestCase;
class NativeFilesystemLoaderTest extends TestCase
{
public function testWithNativeNamespace()
{
$loader = new NativeFilesystemLoader(null, __DIR__.'/../');
$loader->addPath('Fixtures/templates', 'Test');
$this->assertSame('Fixtures'.\DIRECTORY_SEPARATOR.'templates'.\DIRECTORY_SEPARATOR.'Foo'.\DIRECTORY_SEPARATOR.'index.html.twig', $loader->getCacheKey('@Test/Foo/index.html.twig'));
}
/**
* @expectedException \Twig\Error\LoaderError
* @expectedExceptionMessage Template reference "TestBundle::Foo/index.html.twig" not found, did you mean "@Test/Foo/index.html.twig"?
*/
public function testWithLegacyStyle1()
{
$loader = new NativeFilesystemLoader(null, __DIR__.'/../');
$loader->addPath('Fixtures/templates', 'Test');
$loader->getCacheKey('TestBundle::Foo/index.html.twig');
}
/**
* @expectedException \Twig\Error\LoaderError
* @expectedExceptionMessage Template reference "TestBundle:Foo:index.html.twig" not found, did you mean "@Test/Foo/index.html.twig"?
*/
public function testWithLegacyStyle2()
{
$loader = new NativeFilesystemLoader(null, __DIR__.'/../');
$loader->addPath('Fixtures/templates', 'Test');
$loader->getCacheKey('TestBundle:Foo:index.html.twig');
}
}