Add support for PHP 5.2.x
This commit is contained in:
@@ -9,29 +9,25 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Mustache\Test;
|
||||
|
||||
use Mustache\Autoloader;
|
||||
|
||||
/**
|
||||
* @group unit
|
||||
*/
|
||||
class AutoloaderTest extends \PHPUnit_Framework_TestCase {
|
||||
class Mustache_Test_AutoloaderTest extends PHPUnit_Framework_TestCase {
|
||||
public function testRegister() {
|
||||
$loader = Autoloader::register();
|
||||
$loader = Mustache_Autoloader::register();
|
||||
$this->assertTrue(spl_autoload_unregister(array($loader, 'autoload')));
|
||||
}
|
||||
|
||||
public function testAutoloader() {
|
||||
$loader = new Autoloader(__DIR__.'/../../fixtures/autoloader');
|
||||
$loader = new Mustache_Autoloader(__DIR__.'/../../fixtures/autoloader');
|
||||
|
||||
$this->assertNull($loader->autoload('NonMustacheClass'));
|
||||
$this->assertFalse(class_exists('NonMustacheClass'));
|
||||
|
||||
$loader->autoload('Mustache\Foo');
|
||||
$this->assertTrue(class_exists('Mustache\Foo'));
|
||||
$loader->autoload('Mustache_Foo');
|
||||
$this->assertTrue(class_exists('Mustache_Foo'));
|
||||
|
||||
$loader->autoload('\Mustache\Bar');
|
||||
$this->assertTrue(class_exists('Mustache\Bar'));
|
||||
$loader->autoload('\Mustache_Bar');
|
||||
$this->assertTrue(class_exists('Mustache_Bar'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,21 +9,16 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Mustache\Test;
|
||||
|
||||
use Mustache\Compiler;
|
||||
use Mustache\Tokenizer;
|
||||
|
||||
/**
|
||||
* @group unit
|
||||
*/
|
||||
class CompilerTest extends \PHPUnit_Framework_TestCase {
|
||||
class Mustache_Test_CompilerTest extends \PHPUnit_Framework_TestCase {
|
||||
|
||||
/**
|
||||
* @dataProvider getCompileValues
|
||||
*/
|
||||
public function testCompile($source, array $tree, $name, $customEscaper, $charset, $expected) {
|
||||
$compiler = new Compiler;
|
||||
$compiler = new Mustache_Compiler;
|
||||
|
||||
$compiled = $compiler->compile($source, $tree, $name, $customEscaper, $charset);
|
||||
foreach ($expected as $contains) {
|
||||
@@ -34,20 +29,20 @@ class CompilerTest extends \PHPUnit_Framework_TestCase {
|
||||
public function getCompileValues() {
|
||||
return array(
|
||||
array('', array(), 'Banana', false, 'ISO-8859-1', array(
|
||||
"\nclass Banana extends \Mustache\Template",
|
||||
"\nclass Banana extends Mustache_Template",
|
||||
'return htmlspecialchars($buffer, ENT_COMPAT, \'ISO-8859-1\');',
|
||||
'return $buffer;',
|
||||
)),
|
||||
|
||||
array('', array('TEXT'), 'Monkey', false, 'UTF-8', array(
|
||||
"\nclass Monkey extends \Mustache\Template",
|
||||
"\nclass Monkey extends Mustache_Template",
|
||||
'return htmlspecialchars($buffer, ENT_COMPAT, \'UTF-8\');',
|
||||
'$buffer .= $indent . \'TEXT\';',
|
||||
'return $buffer;',
|
||||
)),
|
||||
|
||||
array('', array('TEXT'), 'Monkey', true, 'ISO-8859-1', array(
|
||||
"\nclass Monkey extends \Mustache\Template",
|
||||
"\nclass Monkey extends Mustache_Template",
|
||||
'$buffer .= $indent . \'TEXT\';',
|
||||
'return call_user_func($this->mustache->getEscape(), $buffer);',
|
||||
'return $buffer;',
|
||||
@@ -59,12 +54,12 @@ class CompilerTest extends \PHPUnit_Framework_TestCase {
|
||||
'foo',
|
||||
"\n",
|
||||
array(
|
||||
Tokenizer::TYPE => Tokenizer::T_ESCAPED,
|
||||
Tokenizer::NAME => 'name',
|
||||
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_ESCAPED,
|
||||
Mustache_Tokenizer::NAME => 'name',
|
||||
),
|
||||
array(
|
||||
Tokenizer::TYPE => Tokenizer::T_ESCAPED,
|
||||
Tokenizer::NAME => '.',
|
||||
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_ESCAPED,
|
||||
Mustache_Tokenizer::NAME => '.',
|
||||
),
|
||||
"'bar'",
|
||||
),
|
||||
@@ -72,7 +67,7 @@ class CompilerTest extends \PHPUnit_Framework_TestCase {
|
||||
false,
|
||||
'UTF-8',
|
||||
array(
|
||||
"\nclass Monkey extends \Mustache\Template",
|
||||
"\nclass Monkey extends Mustache_Template",
|
||||
'$buffer .= $indent . \'foo\'',
|
||||
'$buffer .= "\n"',
|
||||
'$value = $context->find(\'name\');',
|
||||
@@ -90,7 +85,7 @@ class CompilerTest extends \PHPUnit_Framework_TestCase {
|
||||
* @expectedException InvalidArgumentException
|
||||
*/
|
||||
public function testCompilerThrowsUnknownNodeTypeException() {
|
||||
$compiler = new Compiler;
|
||||
$compiler->compile('', array(array(Tokenizer::TYPE => 'invalid')), 'SomeClass');
|
||||
$compiler = new Mustache_Compiler;
|
||||
$compiler->compile('', array(array(Mustache_Tokenizer::TYPE => 'invalid')), 'SomeClass');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,44 +9,40 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Mustache\Test;
|
||||
|
||||
use Mustache\Context;
|
||||
|
||||
/**
|
||||
* @group unit
|
||||
*/
|
||||
class ContextTest extends \PHPUnit_Framework_TestCase {
|
||||
class Mustache_Test_ContextTest extends PHPUnit_Framework_TestCase {
|
||||
public function testConstructor() {
|
||||
$one = new Context;
|
||||
$one = new Mustache_Context;
|
||||
$this->assertSame('', $one->find('foo'));
|
||||
$this->assertSame('', $one->find('bar'));
|
||||
|
||||
$two = new Context(array(
|
||||
$two = new Mustache_Context(array(
|
||||
'foo' => 'FOO',
|
||||
'bar' => '<BAR>'
|
||||
));
|
||||
$this->assertEquals('FOO', $two->find('foo'));
|
||||
$this->assertEquals('<BAR>', $two->find('bar'));
|
||||
|
||||
$obj = new \StdClass;
|
||||
$obj = new StdClass;
|
||||
$obj->name = 'NAME';
|
||||
$three = new Context($obj);
|
||||
$three = new Mustache_Context($obj);
|
||||
$this->assertSame($obj, $three->last());
|
||||
$this->assertEquals('NAME', $three->find('name'));
|
||||
}
|
||||
|
||||
public function testPushPopAndLast() {
|
||||
$context = new Context;
|
||||
$context = new Mustache_Context;
|
||||
$this->assertFalse($context->last());
|
||||
|
||||
$dummy = new TestDummy;
|
||||
$dummy = new Mustache_Test_TestDummy;
|
||||
$context->push($dummy);
|
||||
$this->assertSame($dummy, $context->last());
|
||||
$this->assertSame($dummy, $context->pop());
|
||||
$this->assertFalse($context->last());
|
||||
|
||||
$obj = new \StdClass;
|
||||
$obj = new StdClass;
|
||||
$context->push($dummy);
|
||||
$this->assertSame($dummy, $context->last());
|
||||
$context->push($obj);
|
||||
@@ -57,11 +53,11 @@ class ContextTest extends \PHPUnit_Framework_TestCase {
|
||||
}
|
||||
|
||||
public function testFind() {
|
||||
$context = new Context;
|
||||
$context = new Mustache_Context;
|
||||
|
||||
$dummy = new TestDummy;
|
||||
$dummy = new Mustache_Test_TestDummy;
|
||||
|
||||
$obj = new \StdClass;
|
||||
$obj = new StdClass;
|
||||
$obj->name = 'obj';
|
||||
|
||||
$arr = array(
|
||||
@@ -98,7 +94,7 @@ class ContextTest extends \PHPUnit_Framework_TestCase {
|
||||
}
|
||||
}
|
||||
|
||||
class TestDummy {
|
||||
class Mustache_Test_TestDummy {
|
||||
public $name = 'dummy';
|
||||
|
||||
public function __invoke() {
|
||||
|
||||
@@ -9,21 +9,17 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Mustache\Test\Functional;
|
||||
|
||||
use Mustache\Mustache;
|
||||
|
||||
/**
|
||||
* @group magic_methods
|
||||
* @group functional
|
||||
*/
|
||||
class CallTest extends \PHPUnit_Framework_TestCase {
|
||||
class Mustache_Test_Functional_CallTest extends PHPUnit_Framework_TestCase {
|
||||
|
||||
public function testCallEatsContext() {
|
||||
$m = new Mustache;
|
||||
$m = new Mustache_Mustache;
|
||||
$tpl = $m->loadTemplate('{{# foo }}{{ label }}: {{ name }}{{/ foo }}');
|
||||
|
||||
$foo = new ClassWithCall();
|
||||
$foo = new Mustache_Test_Functional_ClassWithCall();
|
||||
$foo->name = 'Bob';
|
||||
|
||||
$data = array('label' => 'name', 'foo' => $foo);
|
||||
@@ -32,7 +28,7 @@ class CallTest extends \PHPUnit_Framework_TestCase {
|
||||
}
|
||||
}
|
||||
|
||||
class ClassWithCall {
|
||||
class Mustache_Test_Functional_ClassWithCall {
|
||||
public $name;
|
||||
public function __call($method, $args) {
|
||||
return 'unknown value';
|
||||
|
||||
@@ -9,15 +9,11 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Mustache\Test\Functional;
|
||||
|
||||
use Mustache\Mustache;
|
||||
|
||||
/**
|
||||
* @group examples
|
||||
* @group functional
|
||||
*/
|
||||
class ExamplesTest extends \PHPUnit_Framework_TestCase {
|
||||
class Mustache_Test_Functional_ExamplesTest extends PHPUnit_Framework_TestCase {
|
||||
|
||||
/**
|
||||
* Test everything in the `examples` directory.
|
||||
@@ -30,7 +26,7 @@ class ExamplesTest extends \PHPUnit_Framework_TestCase {
|
||||
* @param string $expected
|
||||
*/
|
||||
public function testExamples($context, $source, $partials, $expected) {
|
||||
$mustache = new Mustache(array(
|
||||
$mustache = new Mustache_Mustache(array(
|
||||
'partials' => $partials
|
||||
));
|
||||
$this->assertEquals($expected, $mustache->loadTemplate($source)->render($context));
|
||||
|
||||
@@ -9,26 +9,22 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Mustache\Test\Functional;
|
||||
|
||||
use Mustache\Mustache;
|
||||
|
||||
/**
|
||||
* @group lambdas
|
||||
* @group functional
|
||||
*/
|
||||
class HigherOrderSectionsTest extends \PHPUnit_Framework_TestCase {
|
||||
class Mustache_Test_Functional_HigherOrderSectionsTest extends PHPUnit_Framework_TestCase {
|
||||
|
||||
private $mustache;
|
||||
|
||||
public function setUp() {
|
||||
$this->mustache = new Mustache;
|
||||
$this->mustache = new Mustache_Mustache;
|
||||
}
|
||||
|
||||
public function testAnonymousFunctionSectionCallback() {
|
||||
$tpl = $this->mustache->loadTemplate('{{#wrapper}}{{name}}{{/wrapper}}');
|
||||
|
||||
$foo = new Foo;
|
||||
$foo = new Mustache_Test_Functional_Foo;
|
||||
$foo->name = 'Mario';
|
||||
$foo->wrapper = function($text) {
|
||||
return sprintf('<div class="anonymous">%s</div>', $text);
|
||||
@@ -41,7 +37,7 @@ class HigherOrderSectionsTest extends \PHPUnit_Framework_TestCase {
|
||||
$one = $this->mustache->loadTemplate('{{name}}');
|
||||
$two = $this->mustache->loadTemplate('{{#wrap}}{{name}}{{/wrap}}');
|
||||
|
||||
$foo = new Foo;
|
||||
$foo = new Mustache_Test_Functional_Foo;
|
||||
$foo->name = 'Luigi';
|
||||
|
||||
$this->assertEquals($foo->name, $one->render($foo));
|
||||
@@ -51,7 +47,7 @@ class HigherOrderSectionsTest extends \PHPUnit_Framework_TestCase {
|
||||
public function testRuntimeSectionCallback() {
|
||||
$tpl = $this->mustache->loadTemplate('{{#doublewrap}}{{name}}{{/doublewrap}}');
|
||||
|
||||
$foo = new Foo;
|
||||
$foo = new Mustache_Test_Functional_Foo;
|
||||
$foo->doublewrap = array($foo, 'wrapWithBoth');
|
||||
|
||||
$this->assertEquals(sprintf('<strong><em>%s</em></strong>', $foo->name), $tpl->render($foo));
|
||||
@@ -60,7 +56,7 @@ class HigherOrderSectionsTest extends \PHPUnit_Framework_TestCase {
|
||||
public function testStaticSectionCallback() {
|
||||
$tpl = $this->mustache->loadTemplate('{{#trimmer}} {{name}} {{/trimmer}}');
|
||||
|
||||
$foo = new Foo;
|
||||
$foo = new Mustache_Test_Functional_Foo;
|
||||
$foo->trimmer = array(get_class($foo), 'staticTrim');
|
||||
|
||||
$this->assertEquals($foo->name, $tpl->render($foo));
|
||||
@@ -69,7 +65,7 @@ class HigherOrderSectionsTest extends \PHPUnit_Framework_TestCase {
|
||||
public function testViewArraySectionCallback() {
|
||||
$tpl = $this->mustache->loadTemplate('{{#trim}} {{name}} {{/trim}}');
|
||||
|
||||
$foo = new Foo;
|
||||
$foo = new Mustache_Test_Functional_Foo;
|
||||
|
||||
$data = array(
|
||||
'name' => 'Bob',
|
||||
@@ -95,19 +91,19 @@ class HigherOrderSectionsTest extends \PHPUnit_Framework_TestCase {
|
||||
public function testMonsters() {
|
||||
$tpl = $this->mustache->loadTemplate('{{#title}}{{title}} {{/title}}{{name}}');
|
||||
|
||||
$frank = new Monster();
|
||||
$frank = new Mustache_Test_Functional_Monster();
|
||||
$frank->title = 'Dr.';
|
||||
$frank->name = 'Frankenstein';
|
||||
$this->assertEquals('Dr. Frankenstein', $tpl->render($frank));
|
||||
|
||||
$dracula = new Monster();
|
||||
$dracula = new Mustache_Test_Functional_Monster();
|
||||
$dracula->title = 'Count';
|
||||
$dracula->name = 'Dracula';
|
||||
$this->assertEquals('Count Dracula', $tpl->render($dracula));
|
||||
}
|
||||
}
|
||||
|
||||
class Foo {
|
||||
class Mustache_Test_Functional_Foo {
|
||||
public $name = 'Justin';
|
||||
public $lorem = 'Lorem ipsum dolor sit amet,';
|
||||
public $wrap;
|
||||
@@ -135,7 +131,7 @@ class Foo {
|
||||
}
|
||||
}
|
||||
|
||||
class Monster {
|
||||
class Mustache_Test_Functional_Monster {
|
||||
public $title;
|
||||
public $name;
|
||||
}
|
||||
|
||||
@@ -9,20 +9,16 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Mustache\Test\Functional;
|
||||
|
||||
use Mustache\Mustache;
|
||||
|
||||
/**
|
||||
* @group mustache_injection
|
||||
* @group functional
|
||||
*/
|
||||
class MustacheInjectionTest extends \PHPUnit_Framework_TestCase {
|
||||
class Mustache_Test_Functional_MustacheInjectionTest extends PHPUnit_Framework_TestCase {
|
||||
|
||||
private $mustache;
|
||||
|
||||
public function setUp() {
|
||||
$this->mustache = new Mustache;
|
||||
$this->mustache = new Mustache_Mustache;
|
||||
}
|
||||
|
||||
// interpolation
|
||||
|
||||
@@ -9,23 +9,18 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Mustache\Test\Functional;
|
||||
|
||||
use Mustache\Mustache;
|
||||
use Mustache\Loader\StringLoader;
|
||||
|
||||
/**
|
||||
* A PHPUnit test case wrapping the Mustache Spec
|
||||
*
|
||||
* @group mustache-spec
|
||||
* @group functional
|
||||
*/
|
||||
class MustacheSpecTest extends \PHPUnit_Framework_TestCase {
|
||||
class Mustache_Test_Functional_MustacheSpecTest extends PHPUnit_Framework_TestCase {
|
||||
|
||||
private static $mustache;
|
||||
|
||||
public static function setUpBeforeClass() {
|
||||
self::$mustache = new Mustache;
|
||||
self::$mustache = new Mustache_Mustache;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -167,7 +162,7 @@ class MustacheSpecTest extends \PHPUnit_Framework_TestCase {
|
||||
}
|
||||
|
||||
$data = array();
|
||||
$yaml = new \sfYamlParser;
|
||||
$yaml = new sfYamlParser;
|
||||
$file = file_get_contents($filename);
|
||||
|
||||
// @hack: pre-process the 'lambdas' spec so the Symfony YAML parser doesn't complain.
|
||||
|
||||
@@ -9,24 +9,20 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Mustache\Test\Functional;
|
||||
|
||||
use Mustache\Mustache;
|
||||
|
||||
/**
|
||||
* @group sections
|
||||
* @group functional
|
||||
*/
|
||||
class ObjectSectionTest extends \PHPUnit_Framework_TestCase {
|
||||
class Mustache_Test_Functional_ObjectSectionTest extends PHPUnit_Framework_TestCase {
|
||||
private $mustache;
|
||||
|
||||
public function setUp() {
|
||||
$this->mustache = new Mustache;
|
||||
$this->mustache = new Mustache_Mustache;
|
||||
}
|
||||
|
||||
public function testBasicObject() {
|
||||
$tpl = $this->mustache->loadTemplate('{{#foo}}{{name}}{{/foo}}');
|
||||
$this->assertEquals('Foo', $tpl->render(new Alpha));
|
||||
$this->assertEquals('Foo', $tpl->render(new Mustache_Test_Functional_Alpha));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -34,7 +30,7 @@ class ObjectSectionTest extends \PHPUnit_Framework_TestCase {
|
||||
*/
|
||||
public function testObjectWithGet() {
|
||||
$tpl = $this->mustache->loadTemplate('{{#foo}}{{name}}{{/foo}}');
|
||||
$this->assertEquals('Foo', $tpl->render(new Beta));
|
||||
$this->assertEquals('Foo', $tpl->render(new Mustache_Test_Functional_Beta));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -42,32 +38,32 @@ class ObjectSectionTest extends \PHPUnit_Framework_TestCase {
|
||||
*/
|
||||
public function testSectionObjectWithGet() {
|
||||
$tpl = $this->mustache->loadTemplate('{{#bar}}{{#foo}}{{name}}{{/foo}}{{/bar}}');
|
||||
$this->assertEquals('Foo', $tpl->render(new Gamma));
|
||||
$this->assertEquals('Foo', $tpl->render(new Mustache_Test_Functional_Gamma));
|
||||
}
|
||||
|
||||
public function testSectionObjectWithFunction() {
|
||||
$tpl = $this->mustache->loadTemplate('{{#foo}}{{name}}{{/foo}}');
|
||||
$alpha = new Alpha;
|
||||
$alpha->foo = new Delta;
|
||||
$alpha = new Mustache_Test_Functional_Alpha;
|
||||
$alpha->foo = new Mustache_Test_Functional_Delta;
|
||||
$this->assertEquals('Foo', $tpl->render($alpha));
|
||||
}
|
||||
}
|
||||
|
||||
class Alpha {
|
||||
class Mustache_Test_Functional_Alpha {
|
||||
public $foo;
|
||||
|
||||
public function __construct() {
|
||||
$this->foo = new \StdClass();
|
||||
$this->foo = new StdClass();
|
||||
$this->foo->name = 'Foo';
|
||||
$this->foo->number = 1;
|
||||
}
|
||||
}
|
||||
|
||||
class Beta {
|
||||
class Mustache_Test_Functional_Beta {
|
||||
protected $_data = array();
|
||||
|
||||
public function __construct() {
|
||||
$this->_data['foo'] = new \StdClass();
|
||||
$this->_data['foo'] = new StdClass();
|
||||
$this->_data['foo']->name = 'Foo';
|
||||
$this->_data['foo']->number = 1;
|
||||
}
|
||||
@@ -81,15 +77,15 @@ class Beta {
|
||||
}
|
||||
}
|
||||
|
||||
class Gamma {
|
||||
class Mustache_Test_Functional_Gamma {
|
||||
public $bar;
|
||||
|
||||
public function __construct() {
|
||||
$this->bar = new Beta();
|
||||
$this->bar = new Mustache_Test_Functional_Beta;
|
||||
}
|
||||
}
|
||||
|
||||
class Delta {
|
||||
class Mustache_Test_Functional_Delta {
|
||||
protected $_name = 'Foo';
|
||||
|
||||
public function name() {
|
||||
|
||||
@@ -9,16 +9,12 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Mustache\Test;
|
||||
|
||||
use Mustache\HelperCollection;
|
||||
|
||||
class HelperCollectionTest extends \PHPUnit_Framework_TestCase {
|
||||
class Mustache_Test_HelperCollectionTest extends PHPUnit_Framework_TestCase {
|
||||
public function testConstructor() {
|
||||
$foo = function() { echo 'foo'; };
|
||||
$bar = 'BAR';
|
||||
|
||||
$helpers = new HelperCollection(array(
|
||||
$helpers = new Mustache_HelperCollection(array(
|
||||
'foo' => $foo,
|
||||
'bar' => $bar,
|
||||
));
|
||||
@@ -31,7 +27,7 @@ class HelperCollectionTest extends \PHPUnit_Framework_TestCase {
|
||||
$foo = function() { echo 'foo'; };
|
||||
$bar = 'BAR';
|
||||
|
||||
$helpers = new HelperCollection;
|
||||
$helpers = new Mustache_HelperCollection;
|
||||
$this->assertTrue($helpers->isEmpty());
|
||||
$this->assertFalse($helpers->has('foo'));
|
||||
$this->assertFalse($helpers->has('bar'));
|
||||
@@ -56,7 +52,7 @@ class HelperCollectionTest extends \PHPUnit_Framework_TestCase {
|
||||
$foo = function() { echo 'foo'; };
|
||||
$bar = 'BAR';
|
||||
|
||||
$helpers = new HelperCollection;
|
||||
$helpers = new Mustache_HelperCollection;
|
||||
$this->assertTrue($helpers->isEmpty());
|
||||
$this->assertFalse($helpers->has('foo'));
|
||||
$this->assertFalse($helpers->has('bar'));
|
||||
@@ -93,7 +89,7 @@ class HelperCollectionTest extends \PHPUnit_Framework_TestCase {
|
||||
$this->setExpectedException($exception);
|
||||
}
|
||||
|
||||
$helpers = new HelperCollection($helpers);
|
||||
$helpers = new Mustache_HelperCollection($helpers);
|
||||
|
||||
foreach ($actions as $method => $args) {
|
||||
call_user_func_array(array($helpers, $method), $args);
|
||||
|
||||
@@ -9,16 +9,12 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Mustache\Test\Loader;
|
||||
|
||||
use Mustache\Loader\ArrayLoader;
|
||||
|
||||
/**
|
||||
* @group unit
|
||||
*/
|
||||
class ArrayLoaderTest extends \PHPUnit_Framework_TestCase {
|
||||
class Mustache_Test_Loader_ArrayLoaderTest extends PHPUnit_Framework_TestCase {
|
||||
public function testConstructor() {
|
||||
$loader = new ArrayLoader(array(
|
||||
$loader = new Mustache_Loader_ArrayLoader(array(
|
||||
'foo' => 'bar'
|
||||
));
|
||||
|
||||
@@ -26,7 +22,7 @@ class ArrayLoaderTest extends \PHPUnit_Framework_TestCase {
|
||||
}
|
||||
|
||||
public function testSetAndLoadTemplates() {
|
||||
$loader = new ArrayLoader(array(
|
||||
$loader = new Mustache_Loader_ArrayLoader(array(
|
||||
'foo' => 'bar'
|
||||
));
|
||||
$this->assertEquals('bar', $loader->load('foo'));
|
||||
@@ -46,7 +42,7 @@ class ArrayLoaderTest extends \PHPUnit_Framework_TestCase {
|
||||
* @expectedException \InvalidArgumentException
|
||||
*/
|
||||
public function testMissingTemplatesThrowExceptions() {
|
||||
$loader = new ArrayLoader;
|
||||
$loader = new Mustache_Loader_ArrayLoader;
|
||||
$loader->load('not_a_real_template');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,24 +9,20 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Mustache\Test\Loader;
|
||||
|
||||
use Mustache\Loader\FilesystemLoader;
|
||||
|
||||
/**
|
||||
* @group unit
|
||||
*/
|
||||
class FilesystemLoaderTest extends \PHPUnit_Framework_TestCase {
|
||||
class Mustache_Test_Loader_FilesystemLoaderTest extends PHPUnit_Framework_TestCase {
|
||||
public function testConstructor() {
|
||||
$baseDir = realpath(__DIR__.'/../../../fixtures/templates');
|
||||
$loader = new FilesystemLoader($baseDir, array('extension' => '.ms'));
|
||||
$loader = new Mustache_Loader_FilesystemLoader($baseDir, array('extension' => '.ms'));
|
||||
$this->assertEquals('alpha contents', $loader->load('alpha'));
|
||||
$this->assertEquals('beta contents', $loader->load('beta.ms'));
|
||||
}
|
||||
|
||||
public function testLoadTemplates() {
|
||||
$baseDir = realpath(__DIR__.'/../../../fixtures/templates');
|
||||
$loader = new FilesystemLoader($baseDir);
|
||||
$loader = new Mustache_Loader_FilesystemLoader($baseDir);
|
||||
$this->assertEquals('one contents', $loader->load('one'));
|
||||
$this->assertEquals('two contents', $loader->load('two.mustache'));
|
||||
}
|
||||
@@ -35,7 +31,7 @@ class FilesystemLoaderTest extends \PHPUnit_Framework_TestCase {
|
||||
* @expectedException \RuntimeException
|
||||
*/
|
||||
public function testMissingBaseDirThrowsException() {
|
||||
$loader = new FilesystemLoader(__DIR__.'/not_a_directory');
|
||||
$loader = new Mustache_Loader_FilesystemLoader(__DIR__.'/not_a_directory');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -43,7 +39,7 @@ class FilesystemLoaderTest extends \PHPUnit_Framework_TestCase {
|
||||
*/
|
||||
public function testMissingTemplateThrowsException() {
|
||||
$baseDir = realpath(__DIR__.'/../../../fixtures/templates');
|
||||
$loader = new FilesystemLoader($baseDir);
|
||||
$loader = new Mustache_Loader_FilesystemLoader($baseDir);
|
||||
|
||||
$loader->load('fake');
|
||||
}
|
||||
|
||||
@@ -9,16 +9,12 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Mustache\Test\Loader;
|
||||
|
||||
use Mustache\Loader\StringLoader;
|
||||
|
||||
/**
|
||||
* @group unit
|
||||
*/
|
||||
class StringLoaderTest extends \PHPUnit_Framework_TestCase {
|
||||
class Mustache_Test_Loader_StringLoaderTest extends PHPUnit_Framework_TestCase {
|
||||
public function testLoadTemplates() {
|
||||
$loader = new StringLoader;
|
||||
$loader = new Mustache_Loader_StringLoader;
|
||||
|
||||
$this->assertEquals('foo', $loader->load('foo'));
|
||||
$this->assertEquals('{{ bar }}', $loader->load('{{ bar }}'));
|
||||
|
||||
@@ -9,19 +9,10 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Mustache\Test;
|
||||
|
||||
use Mustache\Compiler;
|
||||
use Mustache\Mustache;
|
||||
use Mustache\Loader\StringLoader;
|
||||
use Mustache\Loader\ArrayLoader;
|
||||
use Mustache\Parser;
|
||||
use Mustache\Tokenizer;
|
||||
|
||||
/**
|
||||
* @group unit
|
||||
*/
|
||||
class MustacheTest extends \PHPUnit_Framework_TestCase {
|
||||
class Mustache_Test_MustacheTest extends PHPUnit_Framework_TestCase {
|
||||
|
||||
private static $tempDir;
|
||||
|
||||
@@ -33,9 +24,9 @@ class MustacheTest extends \PHPUnit_Framework_TestCase {
|
||||
}
|
||||
|
||||
public function testConstructor() {
|
||||
$loader = new StringLoader;
|
||||
$partialsLoader = new ArrayLoader;
|
||||
$mustache = new Mustache(array(
|
||||
$loader = new Mustache_Loader_StringLoader;
|
||||
$partialsLoader = new Mustache_Loader_ArrayLoader;
|
||||
$mustache = new Mustache_Mustache(array(
|
||||
'template_class_prefix' => '__whot__',
|
||||
'cache' => self::$tempDir,
|
||||
'loader' => $loader,
|
||||
@@ -67,7 +58,7 @@ class MustacheTest extends \PHPUnit_Framework_TestCase {
|
||||
$data = array('bar' => 'baz');
|
||||
$output = 'TEH OUTPUT';
|
||||
|
||||
$template = $this->getMockBuilder('Mustache\Template')
|
||||
$template = $this->getMockBuilder('Mustache_Template')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
@@ -84,11 +75,11 @@ class MustacheTest extends \PHPUnit_Framework_TestCase {
|
||||
}
|
||||
|
||||
public function testSettingServices() {
|
||||
$loader = new StringLoader;
|
||||
$tokenizer = new Tokenizer;
|
||||
$parser = new Parser;
|
||||
$compiler = new Compiler;
|
||||
$mustache = new Mustache;
|
||||
$loader = new Mustache_Loader_StringLoader;
|
||||
$tokenizer = new Mustache_Tokenizer;
|
||||
$parser = new Mustache_Parser;
|
||||
$compiler = new Mustache_Compiler;
|
||||
$mustache = new Mustache_Mustache;
|
||||
|
||||
$this->assertNotSame($loader, $mustache->getLoader());
|
||||
$mustache->setLoader($loader);
|
||||
@@ -115,7 +106,7 @@ class MustacheTest extends \PHPUnit_Framework_TestCase {
|
||||
* @group functional
|
||||
*/
|
||||
public function testCache() {
|
||||
$mustache = new Mustache(array(
|
||||
$mustache = new Mustache_Mustache(array(
|
||||
'template_class_prefix' => '__whot__',
|
||||
'cache' => self::$tempDir,
|
||||
));
|
||||
@@ -126,7 +117,7 @@ class MustacheTest extends \PHPUnit_Framework_TestCase {
|
||||
$fileName = self::$tempDir . '/' . $className . '.php';
|
||||
$this->assertInstanceOf($className, $template);
|
||||
$this->assertFileExists($fileName);
|
||||
$this->assertContains("\nclass $className extends \Mustache\Template", file_get_contents($fileName));
|
||||
$this->assertContains("\nclass $className extends Mustache_Template", file_get_contents($fileName));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -134,7 +125,7 @@ class MustacheTest extends \PHPUnit_Framework_TestCase {
|
||||
* @dataProvider getBadEscapers
|
||||
*/
|
||||
public function testNonCallableEscapeThrowsException($escape) {
|
||||
new Mustache(array('escape' => $escape));
|
||||
new Mustache_Mustache(array('escape' => $escape));
|
||||
}
|
||||
|
||||
public function getBadEscapers() {
|
||||
@@ -144,25 +135,12 @@ class MustacheTest extends \PHPUnit_Framework_TestCase {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @group functional
|
||||
* @expectedException \RuntimeException
|
||||
*/
|
||||
public function testCacheFailsThrowException() {
|
||||
global $mustacheFilesystemRenameHax;
|
||||
|
||||
$mustacheFilesystemRenameHax = true;
|
||||
|
||||
$mustache = new Mustache(array('cache' => self::$tempDir));
|
||||
$mustache->loadTemplate('{{ foo }}');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \RuntimeException
|
||||
*/
|
||||
public function testImmutablePartialsLoadersThrowException() {
|
||||
$mustache = new Mustache(array(
|
||||
'partials_loader' => new StringLoader,
|
||||
$mustache = new Mustache_Mustache(array(
|
||||
'partials_loader' => new Mustache_Loader_StringLoader,
|
||||
));
|
||||
|
||||
$mustache->setPartials(array('foo' => '{{ foo }}'));
|
||||
@@ -171,7 +149,7 @@ class MustacheTest extends \PHPUnit_Framework_TestCase {
|
||||
public function testHelpers() {
|
||||
$foo = function() { return 'foo'; };
|
||||
$bar = 'BAR';
|
||||
$mustache = new Mustache(array('helpers' => array(
|
||||
$mustache = new Mustache_Mustache(array('helpers' => array(
|
||||
'foo' => $foo,
|
||||
'bar' => $bar,
|
||||
)));
|
||||
@@ -207,7 +185,7 @@ class MustacheTest extends \PHPUnit_Framework_TestCase {
|
||||
* @expectedException \InvalidArgumentException
|
||||
*/
|
||||
public function testSetHelpersThrowsExceptions() {
|
||||
$mustache = new Mustache;
|
||||
$mustache = new Mustache_Mustache;
|
||||
$mustache->setHelpers('monkeymonkeymonkey');
|
||||
}
|
||||
|
||||
@@ -232,7 +210,7 @@ class MustacheTest extends \PHPUnit_Framework_TestCase {
|
||||
}
|
||||
}
|
||||
|
||||
class MustacheStub extends Mustache {
|
||||
class MustacheStub extends Mustache_Mustache {
|
||||
public $source;
|
||||
public $template;
|
||||
public function loadTemplate($source) {
|
||||
@@ -241,14 +219,3 @@ class MustacheStub extends Mustache {
|
||||
return $this->template;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// It's prob'ly best if you ignore this bit.
|
||||
|
||||
namespace Mustache;
|
||||
|
||||
function rename($a, $b) {
|
||||
global $mustacheFilesystemRenameHax;
|
||||
|
||||
return ($mustacheFilesystemRenameHax) ? false : \rename($a, $b);
|
||||
}
|
||||
|
||||
@@ -9,22 +9,17 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Mustache\Test;
|
||||
|
||||
use Mustache\Parser;
|
||||
use Mustache\Tokenizer;
|
||||
|
||||
/**
|
||||
* @group unit
|
||||
*/
|
||||
class ParserTest extends \PHPUnit_Framework_TestCase {
|
||||
class Mustache_Test_ParserTest extends PHPUnit_Framework_TestCase {
|
||||
|
||||
/**
|
||||
* @dataProvider getTokenSets
|
||||
*/
|
||||
public function testParse($tokens, $expected)
|
||||
{
|
||||
$parser = new Parser;
|
||||
$parser = new Mustache_Parser;
|
||||
$this->assertEquals($expected, $parser->parse($tokens));
|
||||
}
|
||||
|
||||
@@ -43,12 +38,12 @@ class ParserTest extends \PHPUnit_Framework_TestCase {
|
||||
|
||||
array(
|
||||
array(array(
|
||||
Tokenizer::TYPE => Tokenizer::T_ESCAPED,
|
||||
Tokenizer::NAME => 'name'
|
||||
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_ESCAPED,
|
||||
Mustache_Tokenizer::NAME => 'name'
|
||||
)),
|
||||
array(array(
|
||||
Tokenizer::TYPE => Tokenizer::T_ESCAPED,
|
||||
Tokenizer::NAME => 'name'
|
||||
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_ESCAPED,
|
||||
Mustache_Tokenizer::NAME => 'name'
|
||||
)),
|
||||
),
|
||||
|
||||
@@ -56,32 +51,32 @@ class ParserTest extends \PHPUnit_Framework_TestCase {
|
||||
array(
|
||||
'foo',
|
||||
array(
|
||||
Tokenizer::TYPE => Tokenizer::T_INVERTED,
|
||||
Tokenizer::INDEX => 123,
|
||||
Tokenizer::NAME => 'parent'
|
||||
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_INVERTED,
|
||||
Mustache_Tokenizer::INDEX => 123,
|
||||
Mustache_Tokenizer::NAME => 'parent'
|
||||
),
|
||||
array(
|
||||
Tokenizer::TYPE => Tokenizer::T_ESCAPED,
|
||||
Tokenizer::NAME => 'name'
|
||||
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_ESCAPED,
|
||||
Mustache_Tokenizer::NAME => 'name'
|
||||
),
|
||||
array(
|
||||
Tokenizer::TYPE => Tokenizer::T_END_SECTION,
|
||||
Tokenizer::INDEX => 456,
|
||||
Tokenizer::NAME => 'parent'
|
||||
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_END_SECTION,
|
||||
Mustache_Tokenizer::INDEX => 456,
|
||||
Mustache_Tokenizer::NAME => 'parent'
|
||||
),
|
||||
'bar',
|
||||
),
|
||||
array(
|
||||
'foo',
|
||||
array(
|
||||
Tokenizer::TYPE => Tokenizer::T_INVERTED,
|
||||
Tokenizer::NAME => 'parent',
|
||||
Tokenizer::INDEX => 123,
|
||||
Tokenizer::END => 456,
|
||||
Tokenizer::NODES => array(
|
||||
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_INVERTED,
|
||||
Mustache_Tokenizer::NAME => 'parent',
|
||||
Mustache_Tokenizer::INDEX => 123,
|
||||
Mustache_Tokenizer::END => 456,
|
||||
Mustache_Tokenizer::NODES => array(
|
||||
array(
|
||||
Tokenizer::TYPE => Tokenizer::T_ESCAPED,
|
||||
Tokenizer::NAME => 'name'
|
||||
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_ESCAPED,
|
||||
Mustache_Tokenizer::NAME => 'name'
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -97,7 +92,7 @@ class ParserTest extends \PHPUnit_Framework_TestCase {
|
||||
* @expectedException \LogicException
|
||||
*/
|
||||
public function testParserThrowsExceptions($tokens) {
|
||||
$parser = new Parser;
|
||||
$parser = new Mustache_Parser;
|
||||
$parser->parse($tokens);
|
||||
}
|
||||
|
||||
@@ -107,9 +102,9 @@ class ParserTest extends \PHPUnit_Framework_TestCase {
|
||||
array(
|
||||
array(
|
||||
array(
|
||||
Tokenizer::TYPE => Tokenizer::T_SECTION,
|
||||
Tokenizer::NAME => 'parent',
|
||||
Tokenizer::INDEX => 123,
|
||||
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_SECTION,
|
||||
Mustache_Tokenizer::NAME => 'parent',
|
||||
Mustache_Tokenizer::INDEX => 123,
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -118,9 +113,9 @@ class ParserTest extends \PHPUnit_Framework_TestCase {
|
||||
array(
|
||||
array(
|
||||
array(
|
||||
Tokenizer::TYPE => Tokenizer::T_INVERTED,
|
||||
Tokenizer::NAME => 'parent',
|
||||
Tokenizer::INDEX => 123,
|
||||
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_INVERTED,
|
||||
Mustache_Tokenizer::NAME => 'parent',
|
||||
Mustache_Tokenizer::INDEX => 123,
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -129,9 +124,9 @@ class ParserTest extends \PHPUnit_Framework_TestCase {
|
||||
array(
|
||||
array(
|
||||
array(
|
||||
Tokenizer::TYPE => Tokenizer::T_END_SECTION,
|
||||
Tokenizer::NAME => 'parent',
|
||||
Tokenizer::INDEX => 123,
|
||||
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_END_SECTION,
|
||||
Mustache_Tokenizer::NAME => 'parent',
|
||||
Mustache_Tokenizer::INDEX => 123,
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -140,24 +135,24 @@ class ParserTest extends \PHPUnit_Framework_TestCase {
|
||||
array(
|
||||
array(
|
||||
array(
|
||||
Tokenizer::TYPE => Tokenizer::T_SECTION,
|
||||
Tokenizer::NAME => 'parent',
|
||||
Tokenizer::INDEX => 123,
|
||||
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_SECTION,
|
||||
Mustache_Tokenizer::NAME => 'parent',
|
||||
Mustache_Tokenizer::INDEX => 123,
|
||||
),
|
||||
array(
|
||||
Tokenizer::TYPE => Tokenizer::T_SECTION,
|
||||
Tokenizer::NAME => 'child',
|
||||
Tokenizer::INDEX => 123,
|
||||
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_SECTION,
|
||||
Mustache_Tokenizer::NAME => 'child',
|
||||
Mustache_Tokenizer::INDEX => 123,
|
||||
),
|
||||
array(
|
||||
Tokenizer::TYPE => Tokenizer::T_END_SECTION,
|
||||
Tokenizer::NAME => 'parent',
|
||||
Tokenizer::INDEX => 123,
|
||||
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_END_SECTION,
|
||||
Mustache_Tokenizer::NAME => 'parent',
|
||||
Mustache_Tokenizer::INDEX => 123,
|
||||
),
|
||||
array(
|
||||
Tokenizer::TYPE => Tokenizer::T_END_SECTION,
|
||||
Tokenizer::NAME => 'child',
|
||||
Tokenizer::INDEX => 123,
|
||||
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_END_SECTION,
|
||||
Mustache_Tokenizer::NAME => 'child',
|
||||
Mustache_Tokenizer::INDEX => 123,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -9,28 +9,22 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Mustache\Test;
|
||||
|
||||
use Mustache\Context;
|
||||
use Mustache\Mustache;
|
||||
use Mustache\Template;
|
||||
|
||||
/**
|
||||
* @group unit
|
||||
*/
|
||||
class TemplateTest extends \PHPUnit_Framework_TestCase {
|
||||
class Mustache_Test_TemplateTest extends PHPUnit_Framework_TestCase {
|
||||
public function testConstructor() {
|
||||
$mustache = new Mustache;
|
||||
$template = new TemplateStub($mustache);
|
||||
$mustache = new Mustache_Mustache;
|
||||
$template = new Mustache_Test_TemplateStub($mustache);
|
||||
$this->assertSame($mustache, $template->getMustache());
|
||||
}
|
||||
|
||||
public function testRendering() {
|
||||
$rendered = '<< wheee >>';
|
||||
$mustache = new Mustache;
|
||||
$template = new TemplateStub($mustache);
|
||||
$mustache = new Mustache_Mustache;
|
||||
$template = new Mustache_Test_TemplateStub($mustache);
|
||||
$template->rendered = $rendered;
|
||||
$context = new Context;
|
||||
$context = new Mustache_Context;
|
||||
|
||||
$this->assertEquals($rendered, $template());
|
||||
$this->assertEquals($rendered, $template->render());
|
||||
@@ -39,14 +33,14 @@ class TemplateTest extends \PHPUnit_Framework_TestCase {
|
||||
}
|
||||
}
|
||||
|
||||
class TemplateStub extends Template {
|
||||
class Mustache_Test_TemplateStub extends Mustache_Template {
|
||||
public $rendered;
|
||||
|
||||
public function getMustache() {
|
||||
return $this->mustache;
|
||||
}
|
||||
|
||||
public function renderInternal(Context $context, $indent = '', $escape = false) {
|
||||
public function renderInternal(Mustache_Context $context, $indent = '', $escape = false) {
|
||||
return $this->rendered;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,20 +9,16 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Mustache\Test;
|
||||
|
||||
use Mustache\Tokenizer;
|
||||
|
||||
/**
|
||||
* @group unit
|
||||
*/
|
||||
class TokenizerTest extends \PHPUnit_Framework_TestCase {
|
||||
class Mustache_Test_TokenizerTest extends PHPUnit_Framework_TestCase {
|
||||
|
||||
/**
|
||||
* @dataProvider getTokens
|
||||
*/
|
||||
public function testScan($text, $delimiters, $expected) {
|
||||
$tokenizer = new Tokenizer;
|
||||
$tokenizer = new Mustache_Tokenizer;
|
||||
$this->assertSame($expected, $tokenizer->scan($text, $delimiters));
|
||||
}
|
||||
|
||||
@@ -45,11 +41,11 @@ class TokenizerTest extends \PHPUnit_Framework_TestCase {
|
||||
null,
|
||||
array(
|
||||
array(
|
||||
Tokenizer::TYPE => Tokenizer::T_ESCAPED,
|
||||
Tokenizer::NAME => 'name',
|
||||
Tokenizer::OTAG => '{{',
|
||||
Tokenizer::CTAG => '}}',
|
||||
Tokenizer::INDEX => 10,
|
||||
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_ESCAPED,
|
||||
Mustache_Tokenizer::NAME => 'name',
|
||||
Mustache_Tokenizer::OTAG => '{{',
|
||||
Mustache_Tokenizer::CTAG => '}}',
|
||||
Mustache_Tokenizer::INDEX => 10,
|
||||
)
|
||||
)
|
||||
),
|
||||
@@ -65,11 +61,11 @@ class TokenizerTest extends \PHPUnit_Framework_TestCase {
|
||||
'<<< >>>',
|
||||
array(
|
||||
array(
|
||||
Tokenizer::TYPE => Tokenizer::T_ESCAPED,
|
||||
Tokenizer::NAME => 'name',
|
||||
Tokenizer::OTAG => '<<<',
|
||||
Tokenizer::CTAG => '>>>',
|
||||
Tokenizer::INDEX => 12,
|
||||
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_ESCAPED,
|
||||
Mustache_Tokenizer::NAME => 'name',
|
||||
Mustache_Tokenizer::OTAG => '<<<',
|
||||
Mustache_Tokenizer::CTAG => '>>>',
|
||||
Mustache_Tokenizer::INDEX => 12,
|
||||
)
|
||||
)
|
||||
),
|
||||
@@ -79,42 +75,42 @@ class TokenizerTest extends \PHPUnit_Framework_TestCase {
|
||||
null,
|
||||
array(
|
||||
array(
|
||||
Tokenizer::TYPE => Tokenizer::T_UNESCAPED,
|
||||
Tokenizer::NAME => 'a',
|
||||
Tokenizer::OTAG => '{{',
|
||||
Tokenizer::CTAG => '}}',
|
||||
Tokenizer::INDEX => 8,
|
||||
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_UNESCAPED,
|
||||
Mustache_Tokenizer::NAME => 'a',
|
||||
Mustache_Tokenizer::OTAG => '{{',
|
||||
Mustache_Tokenizer::CTAG => '}}',
|
||||
Mustache_Tokenizer::INDEX => 8,
|
||||
),
|
||||
"\n",
|
||||
array(
|
||||
Tokenizer::TYPE => Tokenizer::T_SECTION,
|
||||
Tokenizer::NAME => 'b',
|
||||
Tokenizer::OTAG => '{{',
|
||||
Tokenizer::CTAG => '}}',
|
||||
Tokenizer::INDEX => 18,
|
||||
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_SECTION,
|
||||
Mustache_Tokenizer::NAME => 'b',
|
||||
Mustache_Tokenizer::OTAG => '{{',
|
||||
Mustache_Tokenizer::CTAG => '}}',
|
||||
Mustache_Tokenizer::INDEX => 18,
|
||||
),
|
||||
null,
|
||||
array(
|
||||
Tokenizer::TYPE => Tokenizer::T_ESCAPED,
|
||||
Tokenizer::NAME => 'c',
|
||||
Tokenizer::OTAG => '|',
|
||||
Tokenizer::CTAG => '|',
|
||||
Tokenizer::INDEX => 37,
|
||||
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_ESCAPED,
|
||||
Mustache_Tokenizer::NAME => 'c',
|
||||
Mustache_Tokenizer::OTAG => '|',
|
||||
Mustache_Tokenizer::CTAG => '|',
|
||||
Mustache_Tokenizer::INDEX => 37,
|
||||
),
|
||||
array(
|
||||
Tokenizer::TYPE => Tokenizer::T_END_SECTION,
|
||||
Tokenizer::NAME => 'b',
|
||||
Tokenizer::OTAG => '|',
|
||||
Tokenizer::CTAG => '|',
|
||||
Tokenizer::INDEX => 37,
|
||||
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_END_SECTION,
|
||||
Mustache_Tokenizer::NAME => 'b',
|
||||
Mustache_Tokenizer::OTAG => '|',
|
||||
Mustache_Tokenizer::CTAG => '|',
|
||||
Mustache_Tokenizer::INDEX => 37,
|
||||
),
|
||||
"\n",
|
||||
array(
|
||||
Tokenizer::TYPE => Tokenizer::T_UNESCAPED,
|
||||
Tokenizer::NAME => 'd',
|
||||
Tokenizer::OTAG => '|',
|
||||
Tokenizer::CTAG => '|',
|
||||
Tokenizer::INDEX => 51,
|
||||
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_UNESCAPED,
|
||||
Mustache_Tokenizer::NAME => 'd',
|
||||
Mustache_Tokenizer::OTAG => '|',
|
||||
Mustache_Tokenizer::CTAG => '|',
|
||||
Mustache_Tokenizer::INDEX => 51,
|
||||
),
|
||||
|
||||
)
|
||||
|
||||
+1
-1
@@ -10,6 +10,6 @@
|
||||
*/
|
||||
|
||||
require __DIR__.'/../src/Mustache/Autoloader.php';
|
||||
\Mustache\Autoloader::register();
|
||||
Mustache_Autoloader::register();
|
||||
|
||||
require __DIR__.'/../vendor/yaml/lib/sfYamlParser.php';
|
||||
|
||||
+1
-3
@@ -9,8 +9,6 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Mustache;
|
||||
|
||||
class Bar {
|
||||
class Mustache_Bar {
|
||||
// nada
|
||||
}
|
||||
|
||||
+1
-3
@@ -9,8 +9,6 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Mustache;
|
||||
|
||||
class Foo {
|
||||
class Mustache_Foo {
|
||||
// nada
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user