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 12use Twig\RuntimeLoader\FactoryRuntimeLoader; 13 14class Twig_Tests_FactoryRuntimeLoaderTest extends \PHPUnit\Framework\TestCase 15{ 16 public function testLoad() 17 { 18 $loader = new FactoryRuntimeLoader(['stdClass' => 'getRuntime']); 19 20 $this->assertInstanceOf('stdClass', $loader->load('stdClass')); 21 } 22 23 public function testLoadReturnsNullForUnmappedRuntime() 24 { 25 $loader = new FactoryRuntimeLoader(); 26 27 $this->assertNull($loader->load('stdClass')); 28 } 29} 30 31function getRuntime() 32{ 33 return new \stdClass(); 34} 35