-
Notifications
You must be signed in to change notification settings - Fork 420
/
ArrayLoaderTest.php
52 lines (45 loc) · 1.28 KB
/
ArrayLoaderTest.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
42
43
44
45
46
47
48
49
50
51
52
<?php
/*
* This file is part of Mustache.php.
*
* (c) 2012 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
* @group unit
*/
class Mustache_Test_Loader_ArrayLoaderTest extends PHPUnit_Framework_TestCase
{
public function testConstructor()
{
$loader = new Mustache_Loader_ArrayLoader(array(
'foo' => 'bar'
));
$this->assertEquals('bar', $loader->load('foo'));
}
public function testSetAndLoadTemplates()
{
$loader = new Mustache_Loader_ArrayLoader(array(
'foo' => 'bar'
));
$this->assertEquals('bar', $loader->load('foo'));
$loader->setTemplate('baz', 'qux');
$this->assertEquals('qux', $loader->load('baz'));
$loader->setTemplates(array(
'foo' => 'FOO',
'baz' => 'BAZ',
));
$this->assertEquals('FOO', $loader->load('foo'));
$this->assertEquals('BAZ', $loader->load('baz'));
}
/**
* @expectedException Mustache_Exception_UnknownTemplateException
*/
public function testMissingTemplatesThrowExceptions()
{
$loader = new Mustache_Loader_ArrayLoader;
$loader->load('not_a_real_template');
}
}