test will run sinc php 5.6

This commit is contained in:
uwetews
2016-11-11 23:03:46 +01:00
parent 9bfc85b045
commit b7f845f5a9

View File

@@ -2,6 +2,8 @@
//require_once '../../../../../vendor/autoload.php'; //require_once '../../../../../vendor/autoload.php';
if (version_compare(phpversion(), '5.5.0', '>')) {
class Base class Base
{ {
const TEMPLATE = '034_parent.tpl'; const TEMPLATE = '034_parent.tpl';
@@ -34,10 +36,10 @@ class BaseClone extends Base
} }
/* /*
* @requires PHP 5.5 * @requires PHP 5.5
*/ */
class InheritanceTest extends PHPUnit_Framework_TestCase class InheritanceTest extends PHPUnit_Framework_TestCase
{ {
protected $smarty; protected $smarty;
@@ -54,35 +56,35 @@ class InheritanceTest extends PHPUnit_Framework_TestCase
/** /**
* @dataProvider providerInheritance * @dataProvider providerInheritance
* @requires PHP5.5
*/ */
public function testInheritance($elements, $assertions) public function testInheritance($elements, $assertions)
{ {
foreach ($elements as $nr=> $element) foreach ($elements as $nr => $element) {
{
$this->smarty->assign('e', $element); $this->smarty->assign('e', $element);
$this->assertSame($assertions[ $nr ], $this->smarty->fetch($element::TEMPLATE)); $this->assertSame($assertions[ $nr ], $this->smarty->fetch($element::TEMPLATE));
} }
} }
/** /**
* @dataProvider providerInheritance * @dataProvider providerInheritance
*/ */
public function testInheritanceCaching($elements, $assertions) public function testInheritanceCaching($elements, $assertions)
{ {
$this->smarty->caching = true; $this->smarty->caching = true;
foreach ($elements as $nr=> $element) foreach ($elements as $nr => $element) {
{
$this->smarty->assign('e', $element); $this->smarty->assign('e', $element);
$this->assertSame($assertions[ $nr ], $this->smarty->fetch($element::TEMPLATE)); $this->assertSame($assertions[ $nr ], $this->smarty->fetch($element::TEMPLATE));
} }
} }
/** /**
* @dataProvider providerInheritance * @dataProvider providerInheritance
*/ */
public function testInheritanceCaching1($elements, $assertions) public function testInheritanceCaching1($elements, $assertions)
{ {
$this->smarty->caching = true; $this->smarty->caching = true;
foreach ($elements as $nr=> $element) foreach ($elements as $nr => $element) {
{
$this->smarty->assign('e', $element); $this->smarty->assign('e', $element);
$stat = $this->smarty->isCached($element::TEMPLATE); $stat = $this->smarty->isCached($element::TEMPLATE);
$this->assertSame($assertions[ $nr ], $this->smarty->fetch($element::TEMPLATE)); $this->assertSame($assertions[ $nr ], $this->smarty->fetch($element::TEMPLATE));
@@ -92,76 +94,32 @@ class InheritanceTest extends PHPUnit_Framework_TestCase
public function providerInheritance() public function providerInheritance()
{ {
return [ return [[//(#0) This test works as expected
[ [new Base(1), new Base(2), new BaseClone(3),], ['1 Base', '2 Base', '3 BaseClone',],],
//(#0) This test works as expected [//(#1) This test works as expected
[ [new Child(1), new BaseClone(2), //This output is right(!)
new Base(1), ], ['1 Child', '2 BaseClone',],], [//(#2) This test fails
new Base(2), [new Child(1), new Child(2), new BaseClone(3),],
new BaseClone(3), ['1 Child', '2 Child', '3 BaseClone',
], [ //Here the output is "2 Child"
'1 Base', ],], [//(#3) This test fails
'2 Base', [new Child(1), new BaseClone(2), new Child(3),],
'3 BaseClone', ['1 Child', '2 BaseClone', '3 Child',
], //Here the output is "2 Child"
], [ ],], [//(#4) This test fails
//(#1) This test works as expected [new Child(1), new Child(2), new BaseClone(3),
[ new Child(4),],
new Child(1), ['1 Child', '2 Child', '3 BaseClone',
new BaseClone(2), //This output is right(!) //Here the output is also "2 Child"
], [ '4 Child',],], [//(#5) This test fails
'1 Child', [new BaseClone(1), new Child(2),
'2 BaseClone', new Child(3), new BaseClone(4),],
], ['1 BaseClone',
], [ //This output is right(!)
//(#2) This test fails '2 Child', '3 Child',
[ '4 BaseClone',
new Child(1), //Here the output is "3 Child"
new Child(2), ],],];
new BaseClone(3), }
], [
'1 Child',
'2 Child',
'3 BaseClone', //Here the output is "2 Child"
],
], [
//(#3) This test fails
[
new Child(1),
new BaseClone(2),
new Child(3),
], [
'1 Child',
'2 BaseClone',
'3 Child', //Here the output is "2 Child"
],
], [
//(#4) This test fails
[
new Child(1),
new Child(2),
new BaseClone(3),
new Child(4),
], [
'1 Child',
'2 Child',
'3 BaseClone', //Here the output is also "2 Child"
'4 Child',
],
], [
//(#5) This test fails
[
new BaseClone(1),
new Child(2),
new Child(3),
new BaseClone(4),
], [
'1 BaseClone', //This output is right(!)
'2 Child',
'3 Child',
'4 BaseClone', //Here the output is "3 Child"
],
],
];
} }
} }