Merge pull request #221 from keradus/cs

update CS by php-cs-fixer
This commit is contained in:
Justin Hileman
2014-08-18 17:08:29 -07:00
24 changed files with 74 additions and 74 deletions
+7 -7
View File
@@ -278,7 +278,7 @@ class Mustache_Engine
public function getLoader() public function getLoader()
{ {
if (!isset($this->loader)) { if (!isset($this->loader)) {
$this->loader = new Mustache_Loader_StringLoader; $this->loader = new Mustache_Loader_StringLoader();
} }
return $this->loader; return $this->loader;
@@ -305,7 +305,7 @@ class Mustache_Engine
public function getPartialsLoader() public function getPartialsLoader()
{ {
if (!isset($this->partialsLoader)) { if (!isset($this->partialsLoader)) {
$this->partialsLoader = new Mustache_Loader_ArrayLoader; $this->partialsLoader = new Mustache_Loader_ArrayLoader();
} }
return $this->partialsLoader; return $this->partialsLoader;
@@ -321,7 +321,7 @@ class Mustache_Engine
public function setPartials(array $partials = array()) public function setPartials(array $partials = array())
{ {
if (!isset($this->partialsLoader)) { if (!isset($this->partialsLoader)) {
$this->partialsLoader = new Mustache_Loader_ArrayLoader; $this->partialsLoader = new Mustache_Loader_ArrayLoader();
} }
if (!$this->partialsLoader instanceof Mustache_Loader_MutableLoader) { if (!$this->partialsLoader instanceof Mustache_Loader_MutableLoader) {
@@ -365,7 +365,7 @@ class Mustache_Engine
public function getHelpers() public function getHelpers()
{ {
if (!isset($this->helpers)) { if (!isset($this->helpers)) {
$this->helpers = new Mustache_HelperCollection; $this->helpers = new Mustache_HelperCollection();
} }
return $this->helpers; return $this->helpers;
@@ -474,7 +474,7 @@ class Mustache_Engine
public function getTokenizer() public function getTokenizer()
{ {
if (!isset($this->tokenizer)) { if (!isset($this->tokenizer)) {
$this->tokenizer = new Mustache_Tokenizer; $this->tokenizer = new Mustache_Tokenizer();
} }
return $this->tokenizer; return $this->tokenizer;
@@ -500,7 +500,7 @@ class Mustache_Engine
public function getParser() public function getParser()
{ {
if (!isset($this->parser)) { if (!isset($this->parser)) {
$this->parser = new Mustache_Parser; $this->parser = new Mustache_Parser();
} }
return $this->parser; return $this->parser;
@@ -526,7 +526,7 @@ class Mustache_Engine
public function getCompiler() public function getCompiler()
{ {
if (!isset($this->compiler)) { if (!isset($this->compiler)) {
$this->compiler = new Mustache_Compiler; $this->compiler = new Mustache_Compiler();
} }
return $this->compiler; return $this->compiler;
+1 -1
View File
@@ -140,7 +140,7 @@ abstract class Mustache_Template
*/ */
protected function prepareContextStack($context = null) protected function prepareContextStack($context = null)
{ {
$stack = new Mustache_Context; $stack = new Mustache_Context();
$helpers = $this->mustache->getHelpers(); $helpers = $this->mustache->getHelpers();
if (!$helpers->isEmpty()) { if (!$helpers->isEmpty()) {
+2 -2
View File
@@ -20,7 +20,7 @@ class Mustache_Test_CompilerTest extends PHPUnit_Framework_TestCase
*/ */
public function testCompile($source, array $tree, $name, $customEscaper, $entityFlags, $charset, $expected) public function testCompile($source, array $tree, $name, $customEscaper, $entityFlags, $charset, $expected)
{ {
$compiler = new Mustache_Compiler; $compiler = new Mustache_Compiler();
$compiled = $compiler->compile($source, $tree, $name, $customEscaper, $charset, false, $entityFlags); $compiled = $compiler->compile($source, $tree, $name, $customEscaper, $charset, false, $entityFlags);
foreach ($expected as $contains) { foreach ($expected as $contains) {
@@ -138,7 +138,7 @@ class Mustache_Test_CompilerTest extends PHPUnit_Framework_TestCase
*/ */
public function testCompilerThrowsSyntaxException() public function testCompilerThrowsSyntaxException()
{ {
$compiler = new Mustache_Compiler; $compiler = new Mustache_Compiler();
$compiler->compile('', array(array(Mustache_Tokenizer::TYPE => 'invalid')), 'SomeClass'); $compiler->compile('', array(array(Mustache_Tokenizer::TYPE => 'invalid')), 'SomeClass');
} }
+9 -9
View File
@@ -16,7 +16,7 @@ class Mustache_Test_ContextTest extends PHPUnit_Framework_TestCase
{ {
public function testConstructor() public function testConstructor()
{ {
$one = new Mustache_Context; $one = new Mustache_Context();
$this->assertSame('', $one->find('foo')); $this->assertSame('', $one->find('foo'));
$this->assertSame('', $one->find('bar')); $this->assertSame('', $one->find('bar'));
@@ -27,7 +27,7 @@ class Mustache_Test_ContextTest extends PHPUnit_Framework_TestCase
$this->assertEquals('FOO', $two->find('foo')); $this->assertEquals('FOO', $two->find('foo'));
$this->assertEquals('<BAR>', $two->find('bar')); $this->assertEquals('<BAR>', $two->find('bar'));
$obj = new StdClass; $obj = new StdClass();
$obj->name = 'NAME'; $obj->name = 'NAME';
$three = new Mustache_Context($obj); $three = new Mustache_Context($obj);
$this->assertSame($obj, $three->last()); $this->assertSame($obj, $three->last());
@@ -36,16 +36,16 @@ class Mustache_Test_ContextTest extends PHPUnit_Framework_TestCase
public function testPushPopAndLast() public function testPushPopAndLast()
{ {
$context = new Mustache_Context; $context = new Mustache_Context();
$this->assertFalse($context->last()); $this->assertFalse($context->last());
$dummy = new Mustache_Test_TestDummy; $dummy = new Mustache_Test_TestDummy();
$context->push($dummy); $context->push($dummy);
$this->assertSame($dummy, $context->last()); $this->assertSame($dummy, $context->last());
$this->assertSame($dummy, $context->pop()); $this->assertSame($dummy, $context->pop());
$this->assertFalse($context->last()); $this->assertFalse($context->last());
$obj = new StdClass; $obj = new StdClass();
$context->push($dummy); $context->push($dummy);
$this->assertSame($dummy, $context->last()); $this->assertSame($dummy, $context->last());
$context->push($obj); $context->push($obj);
@@ -57,11 +57,11 @@ class Mustache_Test_ContextTest extends PHPUnit_Framework_TestCase
public function testFind() public function testFind()
{ {
$context = new Mustache_Context; $context = new Mustache_Context();
$dummy = new Mustache_Test_TestDummy; $dummy = new Mustache_Test_TestDummy();
$obj = new StdClass; $obj = new StdClass();
$obj->name = 'obj'; $obj->name = 'obj';
$arr = array( $arr = array(
@@ -112,7 +112,7 @@ class Mustache_Test_ContextTest extends PHPUnit_Framework_TestCase
public function testAccessorPriority() public function testAccessorPriority()
{ {
$context = new Mustache_Context(new Mustache_Test_AllTheThings); $context = new Mustache_Context(new Mustache_Test_AllTheThings());
$this->assertEquals('win', $context->find('foo'), 'method beats property'); $this->assertEquals('win', $context->find('foo'), 'method beats property');
$this->assertEquals('win', $context->find('bar'), 'property beats ArrayAccess'); $this->assertEquals('win', $context->find('bar'), 'property beats ArrayAccess');
+12 -12
View File
@@ -17,8 +17,8 @@ class Mustache_Test_EngineTest extends Mustache_Test_FunctionalTestCase
public function testConstructor() public function testConstructor()
{ {
$logger = new Mustache_Logger_StreamLogger(tmpfile()); $logger = new Mustache_Logger_StreamLogger(tmpfile());
$loader = new Mustache_Loader_StringLoader; $loader = new Mustache_Loader_StringLoader();
$partialsLoader = new Mustache_Loader_ArrayLoader; $partialsLoader = new Mustache_Loader_ArrayLoader();
$mustache = new Mustache_Engine(array( $mustache = new Mustache_Engine(array(
'template_class_prefix' => '__whot__', 'template_class_prefix' => '__whot__',
'cache' => self::$tempDir, 'cache' => self::$tempDir,
@@ -69,7 +69,7 @@ class Mustache_Test_EngineTest extends Mustache_Test_FunctionalTestCase
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$mustache = new MustacheStub; $mustache = new MustacheStub();
$mustache->template = $template; $mustache->template = $template;
$template->expects($this->once()) $template->expects($this->once())
@@ -84,11 +84,11 @@ class Mustache_Test_EngineTest extends Mustache_Test_FunctionalTestCase
public function testSettingServices() public function testSettingServices()
{ {
$logger = new Mustache_Logger_StreamLogger(tmpfile()); $logger = new Mustache_Logger_StreamLogger(tmpfile());
$loader = new Mustache_Loader_StringLoader; $loader = new Mustache_Loader_StringLoader();
$tokenizer = new Mustache_Tokenizer; $tokenizer = new Mustache_Tokenizer();
$parser = new Mustache_Parser; $parser = new Mustache_Parser();
$compiler = new Mustache_Compiler; $compiler = new Mustache_Compiler();
$mustache = new Mustache_Engine; $mustache = new Mustache_Engine();
$cache = new Mustache_Cache_FilesystemCache(self::$tempDir); $cache = new Mustache_Cache_FilesystemCache(self::$tempDir);
$this->assertNotSame($logger, $mustache->getLogger()); $this->assertNotSame($logger, $mustache->getLogger());
@@ -181,7 +181,7 @@ class Mustache_Test_EngineTest extends Mustache_Test_FunctionalTestCase
public function testImmutablePartialsLoadersThrowException() public function testImmutablePartialsLoadersThrowException()
{ {
$mustache = new Mustache_Engine(array( $mustache = new Mustache_Engine(array(
'partials_loader' => new Mustache_Loader_StringLoader, 'partials_loader' => new Mustache_Loader_StringLoader(),
)); ));
$mustache->setPartials(array('foo' => '{{ foo }}')); $mustache->setPartials(array('foo' => '{{ foo }}'));
@@ -245,7 +245,7 @@ class Mustache_Test_EngineTest extends Mustache_Test_FunctionalTestCase
*/ */
public function testSetHelpersThrowsExceptions() public function testSetHelpersThrowsExceptions()
{ {
$mustache = new Mustache_Engine; $mustache = new Mustache_Engine();
$mustache->setHelpers('monkeymonkeymonkey'); $mustache->setHelpers('monkeymonkeymonkey');
} }
@@ -254,8 +254,8 @@ class Mustache_Test_EngineTest extends Mustache_Test_FunctionalTestCase
*/ */
public function testSetLoggerThrowsExceptions() public function testSetLoggerThrowsExceptions()
{ {
$mustache = new Mustache_Engine; $mustache = new Mustache_Engine();
$mustache->setLogger(new StdClass); $mustache->setLogger(new StdClass());
} }
public function testLoadPartialCascading() public function testLoadPartialCascading()
@@ -19,7 +19,7 @@ class Mustache_Test_FiveThree_Functional_ClosureQuirksTest extends PHPUnit_Frame
public function setUp() public function setUp()
{ {
$this->mustache = new Mustache_Engine; $this->mustache = new Mustache_Engine();
} }
public function testClosuresDontLikeItWhenYouTouchTheirProperties() public function testClosuresDontLikeItWhenYouTouchTheirProperties()
@@ -19,7 +19,7 @@ class Mustache_Test_FiveThree_Functional_FiltersTest extends PHPUnit_Framework_T
public function setUp() public function setUp()
{ {
$this->mustache = new Mustache_Engine; $this->mustache = new Mustache_Engine();
} }
/** /**
@@ -71,7 +71,7 @@ class Mustache_Test_FiveThree_Functional_FiltersTest extends PHPUnit_Framework_T
return sprintf('[[%s]]', $value); return sprintf('[[%s]]', $value);
}); });
$foo = new \StdClass; $foo = new \StdClass();
$foo->date = new DateTime('1/1/2000', new DateTimeZone("UTC")); $foo->date = new DateTime('1/1/2000', new DateTimeZone("UTC"));
$this->assertEquals('[[2000-01-01 12:01:00]]', $tpl->render($foo)); $this->assertEquals('[[2000-01-01 12:01:00]]', $tpl->render($foo));
@@ -19,14 +19,14 @@ class Mustache_Test_FiveThree_Functional_HigherOrderSectionsTest extends PHPUnit
public function setUp() public function setUp()
{ {
$this->mustache = new Mustache_Engine; $this->mustache = new Mustache_Engine();
} }
public function testAnonymousFunctionSectionCallback() public function testAnonymousFunctionSectionCallback()
{ {
$tpl = $this->mustache->loadTemplate('{{#wrapper}}{{name}}{{/wrapper}}'); $tpl = $this->mustache->loadTemplate('{{#wrapper}}{{name}}{{/wrapper}}');
$foo = new Mustache_Test_FiveThree_Functional_Foo; $foo = new Mustache_Test_FiveThree_Functional_Foo();
$foo->name = 'Mario'; $foo->name = 'Mario';
$foo->wrapper = function ($text) { $foo->wrapper = function ($text) {
return sprintf('<div class="anonymous">%s</div>', $text); return sprintf('<div class="anonymous">%s</div>', $text);
@@ -40,7 +40,7 @@ class Mustache_Test_FiveThree_Functional_HigherOrderSectionsTest extends PHPUnit
$one = $this->mustache->loadTemplate('{{name}}'); $one = $this->mustache->loadTemplate('{{name}}');
$two = $this->mustache->loadTemplate('{{#wrap}}{{name}}{{/wrap}}'); $two = $this->mustache->loadTemplate('{{#wrap}}{{name}}{{/wrap}}');
$foo = new Mustache_Test_FiveThree_Functional_Foo; $foo = new Mustache_Test_FiveThree_Functional_Foo();
$foo->name = 'Luigi'; $foo->name = 'Luigi';
$this->assertEquals($foo->name, $one->render($foo)); $this->assertEquals($foo->name, $one->render($foo));
@@ -19,7 +19,7 @@ class Mustache_Test_FiveThree_Functional_LambdaHelperTest extends PHPUnit_Framew
public function setUp() public function setUp()
{ {
$this->mustache = new Mustache_Engine; $this->mustache = new Mustache_Engine();
} }
public function testSectionLambdaHelper() public function testSectionLambdaHelper()
@@ -27,7 +27,7 @@ class Mustache_Test_FiveThree_Functional_LambdaHelperTest extends PHPUnit_Framew
$one = $this->mustache->loadTemplate('{{name}}'); $one = $this->mustache->loadTemplate('{{name}}');
$two = $this->mustache->loadTemplate('{{#lambda}}{{name}}{{/lambda}}'); $two = $this->mustache->loadTemplate('{{#lambda}}{{name}}{{/lambda}}');
$foo = new StdClass; $foo = new StdClass();
$foo->name = 'Mario'; $foo->name = 'Mario';
$foo->lambda = function ($text, $mustache) { $foo->lambda = function ($text, $mustache) {
return strtoupper($mustache->render($text)); return strtoupper($mustache->render($text));
@@ -23,7 +23,7 @@ class Mustache_Test_FiveThree_Functional_StrictCallablesTest extends PHPUnit_Fra
$mustache = new Mustache_Engine(array('strict_callables' => $strict)); $mustache = new Mustache_Engine(array('strict_callables' => $strict));
$tpl = $mustache->loadTemplate('{{# section }}{{ name }}{{/ section }}'); $tpl = $mustache->loadTemplate('{{# section }}{{ name }}{{/ section }}');
$data = new StdClass; $data = new StdClass();
$data->name = $name; $data->name = $name;
$data->section = $section; $data->section = $section;
+1 -1
View File
@@ -18,7 +18,7 @@ class Mustache_Test_Functional_CallTest extends PHPUnit_Framework_TestCase
public function testCallEatsContext() public function testCallEatsContext()
{ {
$m = new Mustache_Engine; $m = new Mustache_Engine();
$tpl = $m->loadTemplate('{{# foo }}{{ label }}: {{ name }}{{/ foo }}'); $tpl = $m->loadTemplate('{{# foo }}{{ label }}: {{ name }}{{/ foo }}');
$foo = new Mustache_Test_Functional_ClassWithCall(); $foo = new Mustache_Test_Functional_ClassWithCall();
@@ -93,7 +93,7 @@ class Mustache_Test_Functional_ExamplesTest extends PHPUnit_Framework_TestCase
switch ($info['extension']) { switch ($info['extension']) {
case 'php': case 'php':
require_once $fullpath; require_once $fullpath;
$context = new $info['filename']; $context = new $info['filename']();
break; break;
case 'mustache': case 'mustache':
@@ -19,7 +19,7 @@ class Mustache_Test_Functional_HigherOrderSectionsTest extends Mustache_Test_Fun
public function setUp() public function setUp()
{ {
$this->mustache = new Mustache_Engine; $this->mustache = new Mustache_Engine();
} }
/** /**
@@ -32,10 +32,10 @@ class Mustache_Test_Functional_HigherOrderSectionsTest extends Mustache_Test_Fun
public function sectionCallbackData() public function sectionCallbackData()
{ {
$foo = new Mustache_Test_Functional_Foo; $foo = new Mustache_Test_Functional_Foo();
$foo->doublewrap = array($foo, 'wrapWithBoth'); $foo->doublewrap = array($foo, 'wrapWithBoth');
$bar = new Mustache_Test_Functional_Foo; $bar = new Mustache_Test_Functional_Foo();
$bar->trimmer = array(get_class($bar), 'staticTrim'); $bar->trimmer = array(get_class($bar), 'staticTrim');
return array( return array(
@@ -48,7 +48,7 @@ class Mustache_Test_Functional_HigherOrderSectionsTest extends Mustache_Test_Fun
{ {
$tpl = $this->mustache->loadTemplate('{{#trim}} {{name}} {{/trim}}'); $tpl = $this->mustache->loadTemplate('{{#trim}} {{name}} {{/trim}}');
$foo = new Mustache_Test_Functional_Foo; $foo = new Mustache_Test_Functional_Foo();
$data = array( $data = array(
'name' => 'Bob', 'name' => 'Bob',
@@ -81,7 +81,7 @@ class Mustache_Test_Functional_HigherOrderSectionsTest extends Mustache_Test_Fun
$tpl = $mustache->loadTemplate('{{#wrap}}NAME{{/wrap}}'); $tpl = $mustache->loadTemplate('{{#wrap}}NAME{{/wrap}}');
$foo = new Mustache_Test_Functional_Foo; $foo = new Mustache_Test_Functional_Foo();
$foo->wrap = array($foo, 'wrapWithEm'); $foo->wrap = array($foo, 'wrapWithEm');
$this->assertEquals('<em>NAME</em>', $tpl->render($foo)); $this->assertEquals('<em>NAME</em>', $tpl->render($foo));
@@ -96,7 +96,7 @@ class Mustache_Test_Functional_HigherOrderSectionsTest extends Mustache_Test_Fun
$tpl = $mustache->loadTemplate('{{#wrap}}{{name}}{{/wrap}}'); $tpl = $mustache->loadTemplate('{{#wrap}}{{name}}{{/wrap}}');
$foo = new Mustache_Test_Functional_Foo; $foo = new Mustache_Test_Functional_Foo();
$foo->wrap = array($foo, 'wrapWithEm'); $foo->wrap = array($foo, 'wrapWithEm');
$this->assertEquals('<em>' . $foo->name . '</em>', $tpl->render($foo)); $this->assertEquals('<em>' . $foo->name . '</em>', $tpl->render($foo));
@@ -115,7 +115,7 @@ class Mustache_Test_Functional_HigherOrderSectionsTest extends Mustache_Test_Fun
)); ));
$tpl = $mustache->loadTemplate('{{#wrap}}{{name}}{{/wrap}}'); $tpl = $mustache->loadTemplate('{{#wrap}}{{name}}{{/wrap}}');
$foo = new Mustache_Test_Functional_Foo; $foo = new Mustache_Test_Functional_Foo();
$foo->wrap = array($foo, 'wrapWithEm'); $foo->wrap = array($foo, 'wrapWithEm');
$this->assertEquals('<em>' . $foo->name . '</em>', $tpl->render($foo)); $this->assertEquals('<em>' . $foo->name . '</em>', $tpl->render($foo));
$this->assertCount($expect, glob($cacheDir . '/*.php')); $this->assertCount($expect, glob($cacheDir . '/*.php'));
@@ -20,7 +20,7 @@ class Mustache_Test_Functional_MustacheInjectionTest extends PHPUnit_Framework_T
public function setUp() public function setUp()
{ {
$this->mustache = new Mustache_Engine; $this->mustache = new Mustache_Engine();
} }
/** /**
@@ -19,13 +19,13 @@ class Mustache_Test_Functional_ObjectSectionTest extends PHPUnit_Framework_TestC
public function setUp() public function setUp()
{ {
$this->mustache = new Mustache_Engine; $this->mustache = new Mustache_Engine();
} }
public function testBasicObject() public function testBasicObject()
{ {
$tpl = $this->mustache->loadTemplate('{{#foo}}{{name}}{{/foo}}'); $tpl = $this->mustache->loadTemplate('{{#foo}}{{name}}{{/foo}}');
$this->assertEquals('Foo', $tpl->render(new Mustache_Test_Functional_Alpha)); $this->assertEquals('Foo', $tpl->render(new Mustache_Test_Functional_Alpha()));
} }
/** /**
@@ -34,7 +34,7 @@ class Mustache_Test_Functional_ObjectSectionTest extends PHPUnit_Framework_TestC
public function testObjectWithGet() public function testObjectWithGet()
{ {
$tpl = $this->mustache->loadTemplate('{{#foo}}{{name}}{{/foo}}'); $tpl = $this->mustache->loadTemplate('{{#foo}}{{name}}{{/foo}}');
$this->assertEquals('Foo', $tpl->render(new Mustache_Test_Functional_Beta)); $this->assertEquals('Foo', $tpl->render(new Mustache_Test_Functional_Beta()));
} }
/** /**
@@ -43,14 +43,14 @@ class Mustache_Test_Functional_ObjectSectionTest extends PHPUnit_Framework_TestC
public function testSectionObjectWithGet() public function testSectionObjectWithGet()
{ {
$tpl = $this->mustache->loadTemplate('{{#bar}}{{#foo}}{{name}}{{/foo}}{{/bar}}'); $tpl = $this->mustache->loadTemplate('{{#bar}}{{#foo}}{{name}}{{/foo}}{{/bar}}');
$this->assertEquals('Foo', $tpl->render(new Mustache_Test_Functional_Gamma)); $this->assertEquals('Foo', $tpl->render(new Mustache_Test_Functional_Gamma()));
} }
public function testSectionObjectWithFunction() public function testSectionObjectWithFunction()
{ {
$tpl = $this->mustache->loadTemplate('{{#foo}}{{name}}{{/foo}}'); $tpl = $this->mustache->loadTemplate('{{#foo}}{{name}}{{/foo}}');
$alpha = new Mustache_Test_Functional_Alpha; $alpha = new Mustache_Test_Functional_Alpha();
$alpha->foo = new Mustache_Test_Functional_Delta; $alpha->foo = new Mustache_Test_Functional_Delta();
$this->assertEquals('Foo', $tpl->render($alpha)); $this->assertEquals('Foo', $tpl->render($alpha));
} }
} }
@@ -95,7 +95,7 @@ class Mustache_Test_Functional_Gamma
public function __construct() public function __construct()
{ {
$this->bar = new Mustache_Test_Functional_Beta; $this->bar = new Mustache_Test_Functional_Beta();
} }
} }
+2 -2
View File
@@ -35,7 +35,7 @@ class Mustache_Test_HelperCollectionTest extends PHPUnit_Framework_TestCase
$foo = array($this, 'getFoo'); $foo = array($this, 'getFoo');
$bar = 'BAR'; $bar = 'BAR';
$helpers = new Mustache_HelperCollection; $helpers = new Mustache_HelperCollection();
$this->assertTrue($helpers->isEmpty()); $this->assertTrue($helpers->isEmpty());
$this->assertFalse($helpers->has('foo')); $this->assertFalse($helpers->has('foo'));
$this->assertFalse($helpers->has('bar')); $this->assertFalse($helpers->has('bar'));
@@ -61,7 +61,7 @@ class Mustache_Test_HelperCollectionTest extends PHPUnit_Framework_TestCase
$foo = array($this, 'getFoo'); $foo = array($this, 'getFoo');
$bar = 'BAR'; $bar = 'BAR';
$helpers = new Mustache_HelperCollection; $helpers = new Mustache_HelperCollection();
$this->assertTrue($helpers->isEmpty()); $this->assertTrue($helpers->isEmpty());
$this->assertFalse($helpers->has('foo')); $this->assertFalse($helpers->has('foo'));
$this->assertFalse($helpers->has('bar')); $this->assertFalse($helpers->has('bar'));
@@ -46,7 +46,7 @@ class Mustache_Test_Loader_ArrayLoaderTest extends PHPUnit_Framework_TestCase
*/ */
public function testMissingTemplatesThrowExceptions() public function testMissingTemplatesThrowExceptions()
{ {
$loader = new Mustache_Loader_ArrayLoader; $loader = new Mustache_Loader_ArrayLoader();
$loader->load('not_a_real_template'); $loader->load('not_a_real_template');
} }
} }
@@ -16,7 +16,7 @@ class Mustache_Test_Loader_StringLoaderTest extends PHPUnit_Framework_TestCase
{ {
public function testLoadTemplates() public function testLoadTemplates()
{ {
$loader = new Mustache_Loader_StringLoader; $loader = new Mustache_Loader_StringLoader();
$this->assertEquals('foo', $loader->load('foo')); $this->assertEquals('foo', $loader->load('foo'));
$this->assertEquals('{{ bar }}', $loader->load('{{ bar }}')); $this->assertEquals('{{ bar }}', $loader->load('{{ bar }}'));
@@ -16,7 +16,7 @@ class Mustache_Test_Logger_AbstractLoggerTest extends PHPUnit_Framework_TestCase
{ {
public function testEverything() public function testEverything()
{ {
$logger = new Mustache_Test_Logger_TestLogger; $logger = new Mustache_Test_Logger_TestLogger();
$logger->emergency('emergency message'); $logger->emergency('emergency message');
$logger->alert('alert message'); $logger->alert('alert message');
+3 -3
View File
@@ -20,7 +20,7 @@ class Mustache_Test_ParserTest extends PHPUnit_Framework_TestCase
*/ */
public function testParse($tokens, $expected) public function testParse($tokens, $expected)
{ {
$parser = new Mustache_Parser; $parser = new Mustache_Parser();
$this->assertEquals($expected, $parser->parse($tokens)); $this->assertEquals($expected, $parser->parse($tokens));
} }
@@ -157,7 +157,7 @@ class Mustache_Test_ParserTest extends PHPUnit_Framework_TestCase
*/ */
public function testParseWithInheritance($tokens, $expected) public function testParseWithInheritance($tokens, $expected)
{ {
$parser = new Mustache_Parser; $parser = new Mustache_Parser();
$parser->setPragmas(array(Mustache_Engine::PRAGMA_BLOCKS)); $parser->setPragmas(array(Mustache_Engine::PRAGMA_BLOCKS));
$this->assertEquals($expected, $parser->parse($tokens)); $this->assertEquals($expected, $parser->parse($tokens));
} }
@@ -286,7 +286,7 @@ class Mustache_Test_ParserTest extends PHPUnit_Framework_TestCase
*/ */
public function testParserThrowsExceptions($tokens) public function testParserThrowsExceptions($tokens)
{ {
$parser = new Mustache_Parser; $parser = new Mustache_Parser();
$parser->parse($tokens); $parser->parse($tokens);
} }
+2 -2
View File
@@ -15,7 +15,7 @@ abstract class Mustache_Test_SpecTestCase extends PHPUnit_Framework_TestCase
public static function setUpBeforeClass() public static function setUpBeforeClass()
{ {
self::$mustache = new Mustache_Engine; self::$mustache = new Mustache_Engine();
} }
protected static function loadTemplate($source, $partials) protected static function loadTemplate($source, $partials)
@@ -42,7 +42,7 @@ abstract class Mustache_Test_SpecTestCase extends PHPUnit_Framework_TestCase
} }
$data = array(); $data = array();
$yaml = new sfYamlParser; $yaml = new sfYamlParser();
$file = file_get_contents($filename); $file = file_get_contents($filename);
// @hack: pre-process the 'lambdas' spec so the Symfony YAML parser doesn't complain. // @hack: pre-process the 'lambdas' spec so the Symfony YAML parser doesn't complain.
+3 -3
View File
@@ -16,7 +16,7 @@ class Mustache_Test_TemplateTest extends PHPUnit_Framework_TestCase
{ {
public function testConstructor() public function testConstructor()
{ {
$mustache = new Mustache_Engine; $mustache = new Mustache_Engine();
$template = new Mustache_Test_TemplateStub($mustache); $template = new Mustache_Test_TemplateStub($mustache);
$this->assertSame($mustache, $template->getMustache()); $this->assertSame($mustache, $template->getMustache());
} }
@@ -24,10 +24,10 @@ class Mustache_Test_TemplateTest extends PHPUnit_Framework_TestCase
public function testRendering() public function testRendering()
{ {
$rendered = '<< wheee >>'; $rendered = '<< wheee >>';
$mustache = new Mustache_Engine; $mustache = new Mustache_Engine();
$template = new Mustache_Test_TemplateStub($mustache); $template = new Mustache_Test_TemplateStub($mustache);
$template->rendered = $rendered; $template->rendered = $rendered;
$context = new Mustache_Context; $context = new Mustache_Context();
if (version_compare(PHP_VERSION, '5.3.0', '>=')) { if (version_compare(PHP_VERSION, '5.3.0', '>=')) {
$this->assertEquals($rendered, $template()); $this->assertEquals($rendered, $template());
+3 -3
View File
@@ -20,7 +20,7 @@ class Mustache_Test_TokenizerTest extends PHPUnit_Framework_TestCase
*/ */
public function testScan($text, $delimiters, $expected) public function testScan($text, $delimiters, $expected)
{ {
$tokenizer = new Mustache_Tokenizer; $tokenizer = new Mustache_Tokenizer();
$this->assertSame($expected, $tokenizer->scan($text, $delimiters)); $this->assertSame($expected, $tokenizer->scan($text, $delimiters));
} }
@@ -29,7 +29,7 @@ class Mustache_Test_TokenizerTest extends PHPUnit_Framework_TestCase
*/ */
public function testUnevenBracesThrowExceptions() public function testUnevenBracesThrowExceptions()
{ {
$tokenizer = new Mustache_Tokenizer; $tokenizer = new Mustache_Tokenizer();
$text = "{{{ name }}"; $text = "{{{ name }}";
$tokenizer->scan($text, null); $tokenizer->scan($text, null);
@@ -40,7 +40,7 @@ class Mustache_Test_TokenizerTest extends PHPUnit_Framework_TestCase
*/ */
public function testUnevenBracesWithCustomDelimiterThrowExceptions() public function testUnevenBracesWithCustomDelimiterThrowExceptions()
{ {
$tokenizer = new Mustache_Tokenizer; $tokenizer = new Mustache_Tokenizer();
$text = "<%{ name %>"; $text = "<%{ name %>";
$tokenizer->scan($text, "<% %>"); $tokenizer->scan($text, "<% %>");
+1 -1
View File
@@ -6,7 +6,7 @@ class SectionObjects
public function middle() public function middle()
{ {
return new SectionObject; return new SectionObject();
} }
public $final = "Then, surprisingly, it worked the final time."; public $final = "Then, surprisingly, it worked the final time.";