added some unit tests for previous merge

This commit is contained in:
Fabien Potencier
2012-10-31 13:42:47 +01:00
committed by Tobias Schultze
parent e84448bc84
commit c4d5b3ffdb
+17
View File
@@ -199,6 +199,8 @@ class Twig_Tests_TemplateTest extends PHPUnit_Framework_TestCase
'null' => null, 'null' => null,
'1' => 1, '1' => 1,
'bar' => true, 'bar' => true,
'09' => '09',
'+4' => '+4',
); );
$objectArray = new Twig_TemplateArrayAccessObject(); $objectArray = new Twig_TemplateArrayAccessObject();
@@ -224,6 +226,8 @@ class Twig_Tests_TemplateTest extends PHPUnit_Framework_TestCase
array(true, 1, 1.0), array(true, 1, 1.0),
array(true, null, 'null'), array(true, null, 'null'),
array(true, true, 'bar'), array(true, true, 'bar'),
array(true, '09', '09'),
array(true, '+4', '+4'),
); );
$testObjects = array( $testObjects = array(
// array(object, type of fetch) // array(object, type of fetch)
@@ -243,6 +247,10 @@ class Twig_Tests_TemplateTest extends PHPUnit_Framework_TestCase
foreach ($basicTests as $test) { foreach ($basicTests as $test) {
// properties cannot be numbers // properties cannot be numbers
if (($testObject[0] instanceof stdClass || $testObject[0] instanceof Twig_TemplatePropertyObject) && is_numeric($test[2])) { if (($testObject[0] instanceof stdClass || $testObject[0] instanceof Twig_TemplatePropertyObject) && is_numeric($test[2])) {
continue;
}
if ('+4' === $test[2] && $methodObject === $testObject[0]) {
continue; continue;
} }
@@ -380,6 +388,8 @@ class Twig_TemplateArrayAccessObject implements ArrayAccess
'null' => null, 'null' => null,
'1' => 1, '1' => 1,
'bar' => true, 'bar' => true,
'09' => '09',
'+4' => '+4',
); );
public function offsetExists($name) public function offsetExists($name)
@@ -410,6 +420,8 @@ class Twig_TemplateMagicPropertyObject
'null' => null, 'null' => null,
'1' => 1, '1' => 1,
'bar' => true, 'bar' => true,
'09' => '09',
'+4' => '+4',
); );
protected $protected = 'protected'; protected $protected = 'protected';
@@ -478,6 +490,11 @@ class Twig_TemplateMethodObject
return 1; return 1;
} }
public function get09()
{
return '09';
}
public function getZero() public function getZero()
{ {
return 0; return 0;