mirror of
https://github.com/fenom-template/fenom.git
synced 2023-08-10 21:13:07 +03:00
Add string concatenation (#3)
This commit is contained in:
@@ -34,7 +34,9 @@ class TestCase extends \PHPUnit_Framework_TestCase
|
||||
"obj" => new \StdClass,
|
||||
"list" => array(
|
||||
"a" => 1,
|
||||
"b" => 2
|
||||
"one" => 1,
|
||||
"b" => 2,
|
||||
"two" => 2
|
||||
),
|
||||
0 => "empty value",
|
||||
1 => "one value",
|
||||
@@ -204,7 +206,11 @@ class TestCase extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function providerVariables()
|
||||
{
|
||||
return array();
|
||||
return array(
|
||||
array('$one', 1),
|
||||
array('$list.one', 1),
|
||||
array('$list[$$.DEVELOP]', 1),
|
||||
);
|
||||
}
|
||||
|
||||
public static function providerObjects()
|
||||
|
||||
@@ -676,10 +676,20 @@ class TemplateTest extends TestCase
|
||||
);
|
||||
}
|
||||
|
||||
public static function providerConcat() {
|
||||
return array(
|
||||
array('{"string" ~ $one ~ up("end")}', "string1END"),
|
||||
array('{"string" ~ $one++ ~ "end"}', "string1end"),
|
||||
array('{"string" ~ ++$one ~ "end"}', "string2end"),
|
||||
array('{"string" ~ "one" ~ "end"}', "stringoneend"),
|
||||
array('{"string" ~ 1 ~ "end"}', "string1end"),
|
||||
);
|
||||
}
|
||||
|
||||
public function _testSandbox()
|
||||
{
|
||||
try {
|
||||
var_dump($this->fenom->compileCode('{$a!"no way":"right"}')->getBody());
|
||||
var_dump($this->fenom->compileCode('{$a++~"hi"~time("Y:m:d")}')->getBody());
|
||||
} catch (\Exception $e) {
|
||||
print_r($e->getMessage() . "\n" . $e->getTraceAsString());
|
||||
}
|
||||
@@ -891,5 +901,13 @@ class TemplateTest extends TestCase
|
||||
{
|
||||
$this->exec($code, self::getVars(), $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerConcat
|
||||
*/
|
||||
public function testConcat($code, $result)
|
||||
{
|
||||
$this->exec($code, self::getVars(), $result);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user