bug #20767 [Cache] Fix dumping SplDoublyLinkedList iter mode (nicolas-grekas)
This PR was merged into the 2.7 branch.
Discussion
----------
[Cache] Fix dumping SplDoublyLinkedList iter mode
| Q | A
| ------------- | ---
| Branch? | 2.7
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #20718
| License | MIT
| Doc PR | -
Commits
-------
bfe149f
[Cache] Fix dumping SplDoublyLinkedList iter mode
This commit is contained in:
commit
777fda319d
|
@ -64,7 +64,7 @@ class SplCaster
|
|||
$c->setIteratorMode(\SplDoublyLinkedList::IT_MODE_KEEP | $mode & ~\SplDoublyLinkedList::IT_MODE_DELETE);
|
||||
|
||||
$a += array(
|
||||
$prefix.'mode' => new ConstStub((($mode & \SplDoublyLinkedList::IT_MODE_LIFO) ? 'IT_MODE_LIFO' : 'IT_MODE_FIFO').' | '.(($mode & \SplDoublyLinkedList::IT_MODE_KEEP) ? 'IT_MODE_KEEP' : 'IT_MODE_DELETE'), $mode),
|
||||
$prefix.'mode' => new ConstStub((($mode & \SplDoublyLinkedList::IT_MODE_LIFO) ? 'IT_MODE_LIFO' : 'IT_MODE_FIFO').' | '.(($mode & \SplDoublyLinkedList::IT_MODE_DELETE) ? 'IT_MODE_DELETE' : 'IT_MODE_KEEP'), $mode),
|
||||
$prefix.'dllist' => iterator_to_array($c),
|
||||
);
|
||||
$c->setIteratorMode($mode);
|
||||
|
|
|
@ -0,0 +1,43 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\VarDumper\Tests\Caster;
|
||||
|
||||
use Symfony\Component\VarDumper\Test\VarDumperTestCase;
|
||||
|
||||
class SplCasterTest extends VarDumperTestCase
|
||||
{
|
||||
/**
|
||||
* @dataProvider provideCastSplDoublyLinkedList
|
||||
*/
|
||||
public function testCastSplDoublyLinkedList($modeValue, $modeDump)
|
||||
{
|
||||
$var = new \SplDoublyLinkedList();
|
||||
$var->setIteratorMode($modeValue);
|
||||
$dump = <<<EOTXT
|
||||
SplDoublyLinkedList {
|
||||
%Amode: $modeDump
|
||||
dllist: []
|
||||
}
|
||||
EOTXT;
|
||||
$this->assertDumpMatchesFormat($dump, $var);
|
||||
}
|
||||
|
||||
public function provideCastSplDoublyLinkedList()
|
||||
{
|
||||
return array(
|
||||
array(\SplDoublyLinkedList::IT_MODE_FIFO, 'IT_MODE_FIFO | IT_MODE_KEEP'),
|
||||
array(\SplDoublyLinkedList::IT_MODE_LIFO, 'IT_MODE_LIFO | IT_MODE_KEEP'),
|
||||
array(\SplDoublyLinkedList::IT_MODE_FIFO | \SplDoublyLinkedList::IT_MODE_DELETE, 'IT_MODE_FIFO | IT_MODE_DELETE'),
|
||||
array(\SplDoublyLinkedList::IT_MODE_LIFO | \SplDoublyLinkedList::IT_MODE_DELETE, 'IT_MODE_LIFO | IT_MODE_DELETE'),
|
||||
);
|
||||
}
|
||||
}
|
Reference in New Issue