Jhernandez has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/218860

Change subject: WIP: Add tests for mustache conditionals
......................................................................

WIP: Add tests for mustache conditionals

Change-Id: I713fd184173b2e6a1e0be924e9e8f1fd77a69b16
---
A tests/phpunit/data/templates/foobar_block_conditional.mustache
M tests/phpunit/includes/TemplateParserTest.php
2 files changed, 12 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/60/218860/1

diff --git a/tests/phpunit/data/templates/foobar_block_conditional.mustache 
b/tests/phpunit/data/templates/foobar_block_conditional.mustache
new file mode 100644
index 0000000..023bbb7
--- /dev/null
+++ b/tests/phpunit/data/templates/foobar_block_conditional.mustache
@@ -0,0 +1 @@
+{{#person}}Welcome {{name}}!{{/person}}{{^person}}Hellow stranger!{{/person}}
diff --git a/tests/phpunit/includes/TemplateParserTest.php 
b/tests/phpunit/includes/TemplateParserTest.php
index 81854ff..602afe6 100644
--- a/tests/phpunit/includes/TemplateParserTest.php
+++ b/tests/phpunit/includes/TemplateParserTest.php
@@ -28,7 +28,7 @@
                if ( $exception ) {
                        $this->setExpectedException( $exception );
                }
-               $tp = new TemplateParser( $this->templateDir );
+               $tp = new TemplateParser( $this->templateDir, true );
                $this->assertEquals( $result, $tp->processTemplate( $name, 
$args ) );
        }
 
@@ -47,6 +47,16 @@
                                "hello world!\n",
                        ),
                        array(
+                               'foobar_block_conditional',
+                               array( 'person' => array( 'name' => 'John' ) ),
+                               "Welcome John!\n",
+                       ),
+                       array(
+                               'foobar_block_conditional',
+                               array(),
+                               "Hellow stranger!\n",
+                       ),
+                       array(
                                '../foobar',
                                array(),
                                false,

-- 
To view, visit https://gerrit.wikimedia.org/r/218860
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I713fd184173b2e6a1e0be924e9e8f1fd77a69b16
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Jhernandez <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to