You are here

public function Twig_Tests_Loader_ChainTest::testExists in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/twig/twig/test/Twig/Tests/Loader/ChainTest.php \Twig_Tests_Loader_ChainTest::testExists()

File

vendor/twig/twig/test/Twig/Tests/Loader/ChainTest.php, line 64

Class

Twig_Tests_Loader_ChainTest

Code

public function testExists() {
  $loader1 = $this
    ->getMock('Twig_Loader_Array', array(
    'exists',
    'getSource',
  ), array(), '', false);
  $loader1
    ->expects($this
    ->once())
    ->method('exists')
    ->will($this
    ->returnValue(false));
  $loader1
    ->expects($this
    ->never())
    ->method('getSource');
  $loader2 = $this
    ->getMock('Twig_LoaderInterface');
  $loader2
    ->expects($this
    ->once())
    ->method('getSource')
    ->will($this
    ->returnValue('content'));
  $loader = new Twig_Loader_Chain();
  $loader
    ->addLoader($loader1);
  $loader
    ->addLoader($loader2);
  $this
    ->assertTrue($loader
    ->exists('foo'));
}