From 1ba7cdf108964f3992574b0e21f8185409e16c7e Mon Sep 17 00:00:00 2001 From: Christian Blanquera Date: Wed, 23 Sep 2015 23:34:42 +0800 Subject: [PATCH] added case descriptions and used an int example --- tests/Xamin/HandlebarsTest.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/Xamin/HandlebarsTest.php b/tests/Xamin/HandlebarsTest.php index bf918da..31b2177 100644 --- a/tests/Xamin/HandlebarsTest.php +++ b/tests/Xamin/HandlebarsTest.php @@ -601,22 +601,22 @@ class HandlebarsTest extends \PHPUnit_Framework_TestCase //NEXT UP: some practical case studies - //case 1 + //case 1 - i18n $variable1 = array(); - $template1 = "{{_ 'hello'}}, {{_ 'my name is %s' 'Foo'}}! {{_ 'how are your %s kids and %s' '6' 'dog'}}?"; + $template1 = "{{_ 'hello'}}, {{_ 'my name is %s' 'Foo'}}! {{_ 'how are your %s kids and %s' 6 'dog'}}?"; $expected1 = 'bonjour, mon nom est Foo! comment sont les enfants de votre 6 et dog?'; - //case 2 + //case 2 - when $variable2 = array('gender' => 'female'); $template2 = "Hello {{#when gender '===' 'male'}}sir{{else}}maam{{/when}}"; $expected2 = 'Hello maam'; - //case 3 + //case 3 - when else $variable3 = array('gender' => 'male'); $template3 = "Hello {{#when gender '===' 'male'}}sir{{else}}maam{{/when}}"; $expected3 = 'Hello sir'; - //case 4 + //case 4 - loop $variable4 = array( 'rows' => array( array( @@ -632,20 +632,20 @@ class HandlebarsTest extends \PHPUnit_Framework_TestCase $template4 = "{{#loop rows}}
  • {{value.profile_name}} - {{date value.profile_created 'M d'}}
  • {{/loop}}"; $expected4 = '
  • Jane Doe - Apr 04
  • John Doe - Jan 21
  • '; - //case 5 + //case 5 - array in $variable5 = $variable4; $variable5['me'] = 'Jack Doe'; $variable5['admins'] = array('Jane Doe', 'John Doe'); $template5 = "{{#in admins me}}{{else}}No Access{{/in}}"; $expected5 = 'No Access'; - //case 6 + //case 6 - array in else $variable6 = $variable5; $variable6['me'] = 'Jane Doe'; $template6 = $template5; $expected6 = ''; - //case 7 + //case 7 - nested templates and parent-grand variables $variable7 = array('test' => 'Hello World'); $template7 = '{{#nested1 test "test2"}} ' .'In 1: {{test4}} {{#nested1 ../test \'test3\'}} '