-
Notifications
You must be signed in to change notification settings - Fork 83
Expand file tree
/
Copy pathTwigRuntimeLoaderTest.php
More file actions
59 lines (46 loc) · 1.91 KB
/
TwigRuntimeLoaderTest.php
File metadata and controls
59 lines (46 loc) · 1.91 KB
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<?php
/**
* Slim Framework (http://slimframework.com)
*
* @license https://github.com/slimphp/Twig-View/blob/master/LICENSE.md (MIT License)
*/
declare(strict_types=1);
namespace Slim\Tests;
use Psr\Http\Message\UriInterface;
use Slim\Interfaces\RouteParserInterface;
use Slim\Views\TwigRuntimeExtension;
use Slim\Views\TwigRuntimeLoader;
class TwigRuntimeLoaderTest extends TestCase
{
public function testConstructor()
{
$routeParser = $this->createMock(RouteParserInterface::class);
$uri = $this->createMock(UriInterface::class);
$basePath = '';
// Create the twig runtime loader.
$twigRuntimeLoader = new TwigRuntimeLoader($routeParser, $uri, $basePath);
$this->assertInaccessiblePropertySame($routeParser, $twigRuntimeLoader, 'routeParser');
$this->assertInaccessiblePropertySame($uri, $twigRuntimeLoader, 'uri');
$this->assertInaccessiblePropertySame($basePath, $twigRuntimeLoader, 'basePath');
}
public function testLoad()
{
$routeParser = $this->createMock(RouteParserInterface::class);
$uri = $this->createMock(UriInterface::class);
$basePath = '';
// Create the twig runtime loader.
$twigRuntimeLoader = new TwigRuntimeLoader($routeParser, $uri, $basePath);
$runtimeExtension = $twigRuntimeLoader->load(TwigRuntimeExtension::class);
$this->assertInstanceOf(TwigRuntimeExtension::class, $runtimeExtension);
}
public function testLoadUnsupportedRuntimeExtension()
{
$routeParser = $this->createMock(RouteParserInterface::class);
$uri = $this->createMock(UriInterface::class);
$basePath = '';
// Create the twig runtime loader.
$twigRuntimeLoader = new TwigRuntimeLoader($routeParser, $uri, $basePath);
$runtimeExtension = $twigRuntimeLoader->load('UnsupportedRuntimeExtension');
$this->assertNull($runtimeExtension);
}
}