Big update

This commit is contained in:
bzick
2013-02-21 22:51:24 +04:00
parent b2f2e61be4
commit ee9cd9b746
14 changed files with 409 additions and 193 deletions

View File

@@ -43,7 +43,7 @@ class ExtendsTemplateTest extends TestCase {
* @param $vars
* @param $result
*/
public function testDynamicExtends($name, $code, $vars, $result) {
public function _testDynamicExtends($name, $code, $vars, $result) {
static $i = 0;
$vars["iteration"] = $i++;
$this->execTpl($name, $code, $vars, $result);
@@ -60,7 +60,7 @@ class ExtendsTemplateTest extends TestCase {
/**
* @group extends
*/
public function _testChildLevel1() {
public function testChildLevel1() {
//echo($this->aspect->fetch("child1.tpl", array("a" => "a char"))); exit;
}

View File

@@ -1,10 +1,10 @@
<?php
namespace Aspect\Provider;
namespace Aspect;
use Aspect;
class FSTest extends \Aspect\TestCase {
class FSProviderTest extends \Aspect\TestCase {
/**
* @var Provider
* @var FSProvider
*/
public $provider;
@@ -12,7 +12,7 @@ class FSTest extends \Aspect\TestCase {
parent::setUp();
$this->tpl("template1.tpl", 'Template 1 {$a}');
$this->tpl("template2.tpl", 'Template 2 {$a}');
$this->provider = new FS(ASPECT_RESOURCES.'/template');
$this->provider = new FSProvider(ASPECT_RESOURCES.'/template');
}
public function testIsTemplateExists() {

View File

@@ -15,6 +15,10 @@ class TemplateTest extends TestCase {
)));
}
/*public function testSandbox() {
var_dump($this->aspect->compileCode('{"$s:{$b+1}f d {$d}"}')->_body);
exit;
}*/
public static function providerVars() {
$a = array("a" => "World");
@@ -69,6 +73,42 @@ class TemplateTest extends TestCase {
);
}
public static function providerScalars() {
return array(
array('77', 77),
array('-33', -33),
array('0.2', 0.2),
array('-0.3', -0.3),
array('1e6', 1e6),
array('-2e6', -2e6),
array('"str"', 'str'),
array('"str\nand\nmany\nlines"', "str\nand\nmany\nlines"),
array('"str and \'substr\'"', "str and 'substr'"),
array('"str and \"substr\""', 'str and "substr"'),
array("'str'", 'str'),
array("'str\\nin\\none\\nline'", 'str\nin\none\nline'),
array("'str and \"substr\"'", 'str and "substr"'),
array("'str and \'substr\''", "str and 'substr'"),
array('"$one"', '1'),
array('"$one $two"', '1 2'),
array('"$one and $two"', '1 and 2'),
array('"a $one and $two b"', 'a 1 and 2 b'),
array('"{$one}"', '1'),
array('"a {$one} b"', 'a 1 b'),
array('"{$one + 2}"', '3'),
array('"{$one * $two + 1}"', '3'),
array('"{$one} and {$two}"', '1 and 2'),
array('"$one and {$two}"', '1 and 2'),
array('"{$one} and $two"', '1 and 2'),
array('"a {$one} and {$two} b"', 'a 1 and 2 b'),
array('"{$one+1} and {$two-1}"', '2 and 1'),
array('"a {$one+1} and {$two-1} b"', 'a 2 and 1 b'),
array('"a {$one|dots} and {$two|dots} b"', 'a 1... and 2... b'),
array('"a {$one|dots} and $two b"', 'a 1... and 2 b'),
array('"a $one and {$two|dots} b"', 'a 1 and 2... b'),
);
}
public static function providerVarsInvalid() {
return array(
array('hello, {$a.}!', 'Aspect\CompileException', "Unexpected end of expression"),