ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ContainerRuntimeLoaderTest.php
Go to the documentation of this file.
1<?php
2
3/*
4 * This file is part of Twig.
5 *
6 * (c) Fabien Potencier
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12class Twig_Tests_ContainerRuntimeLoaderTest extends \PHPUnit\Framework\TestCase
13{
17 public function testLoad()
18 {
19 $container = $this->getMockBuilder('Psr\Container\ContainerInterface')->getMock();
20 $container->expects($this->once())->method('has')->with('stdClass')->willReturn(true);
21 $container->expects($this->once())->method('get')->with('stdClass')->willReturn(new stdClass());
22
24
25 $this->assertInstanceOf('stdClass', $loader->load('stdClass'));
26 }
27
32 {
33 $container = $this->getMockBuilder('Psr\Container\ContainerInterface')->getMock();
34 $container->expects($this->once())->method('has')->with('Foo');
35 $container->expects($this->never())->method('get');
36
38 $this->assertNull($loader->load('Foo'));
39 }
40}
An exception for terminatinating execution or to throw for unit testing.
Lazily loads Twig runtime implementations from a PSR-11 container.
$container
Definition: wac.php:13