mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-13 10:56:38 +00:00
Revert "refactored some tests"
This reverts commit d45c980a41.
Tests should work on PHP 5.2
This commit is contained in:
@@ -26,9 +26,10 @@ class Twig_Tests_TemplateTest extends PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testUnknownPropertyOnArray($array)
|
||||
{
|
||||
list($template, $m) = $this->getTemplate(true);
|
||||
$env = new Twig_Environment(null, array('strict_variables' => true));
|
||||
$template = new Twig_TemplateTest($env);
|
||||
|
||||
$m->invoke($template, $array, 'unknown', array(), Twig_TemplateInterface::ARRAY_CALL);
|
||||
$template->getAttribute($array, 'unknown', array(), Twig_TemplateInterface::ARRAY_CALL);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -36,20 +37,9 @@ class Twig_Tests_TemplateTest extends PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testGetAttribute($expected, $object, $item, $arguments, $type)
|
||||
{
|
||||
list($template, $m) = $this->getTemplate(false);
|
||||
$template = new Twig_TemplateTest(new Twig_Environment());
|
||||
|
||||
$this->assertEquals($expected, $m->invoke($template, $object, $item, $arguments, $type));
|
||||
}
|
||||
|
||||
protected function getTemplate($strict)
|
||||
{
|
||||
$env = new Twig_Environment(null, array('strict_variables' => $strict));
|
||||
$template = $this->getMockForAbstractClass('Twig_Template', array($env));
|
||||
$r = new ReflectionObject($template);
|
||||
$m = $r->getMethod('getAttribute');
|
||||
$m->setAccessible(true);
|
||||
|
||||
return array($template, $m);
|
||||
$this->assertEquals($expected, $template->getAttribute($object, $item, $arguments, $type));
|
||||
}
|
||||
|
||||
public function getGetAttributeTests()
|
||||
@@ -100,6 +90,18 @@ class Twig_Tests_TemplateTest extends PHPUnit_Framework_TestCase
|
||||
}
|
||||
}
|
||||
|
||||
class Twig_TemplateTest extends Twig_Template
|
||||
{
|
||||
protected function doDisplay(array $context, array $blocks = array())
|
||||
{
|
||||
}
|
||||
|
||||
public function getAttribute($object, $item, array $arguments = array(), $type = Twig_TemplateInterface::ANY_CALL, $noStrictCheck = false, $lineno = -1)
|
||||
{
|
||||
return parent::getAttribute($object, $item, $arguments, $type);
|
||||
}
|
||||
}
|
||||
|
||||
class Twig_TemplateObject
|
||||
{
|
||||
public $foo = 'foo';
|
||||
|
||||
Reference in New Issue
Block a user