修正标签解析单元测试

This commit is contained in:
yunwuxin
2016-05-08 19:04:16 +08:00
parent 6ca3dad850
commit 1f6cde00eb
2 changed files with 7 additions and 5 deletions

2
.gitignore vendored
View File

@@ -1 +1,3 @@
/composer.lock
/vendor
.idea

View File

@@ -47,7 +47,7 @@ EOF;
{/volist}
EOF;
$data = <<<EOF
<?php if(is_array(\$list)): \$key = 0; \$__LIST__ = \$list;if( count(\$__LIST__)==0 ) : echo "" ;else: foreach(\$__LIST__ as \$key=>\$vo): \$mod = (\$key % 2 );++\$key;?>
<?php if(is_array(\$list) || \$list instanceof \\think\\Collection): \$key = 0; \$__LIST__ = \$list;if( count(\$__LIST__)==0 ) : echo "" ;else: foreach(\$__LIST__ as \$key=>\$vo): \$mod = (\$key % 2 );++\$key;?>
<?php endforeach; endif; else: echo "" ;endif; ?>
EOF;
@@ -88,9 +88,9 @@ EOF;
{/foreach}
EOF;
$data = <<<EOF
<?php if(is_array(\$list)): foreach(\$list as \$key=>\$val): ?>
<?php if(is_array(\$list) || \$list instanceof \\think\\Collection): if( count(\$list)==0 ) : echo "empty" ;else: foreach(\$list as \$key=>\$val): ?>
<?php endforeach; endif; ?><?php if(empty(\$list)): echo '"empty'; endif; ?>
<?php endforeach; endif; else: echo "empty" ;endif; ?>
EOF;
$cx->parseTag($content);
$this->assertEquals($content, $data);
@@ -389,7 +389,7 @@ default
{/empty}
EOF;
$data = <<<EOF
<?php if(empty(\$var)): ?>
<?php if(empty(\$var) || (\$var instanceof \\think\\Collection && \$var->isEmpty())): ?>
default
<?php endif; ?>
EOF;
@@ -402,7 +402,7 @@ default
{/notempty}
EOF;
$data = <<<EOF
<?php if(!empty(\$var)): ?>
<?php if(!(empty(\$var) || (\$var instanceof \\think\\Collection && \$var->isEmpty()))): ?>
default
<?php endif; ?>
EOF;