Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 7ad248a

Browse filesBrowse files
[Cache] Fix dumping SplDoublyLinkedList iter mode
1 parent f9bceb8 commit 7ad248a
Copy full SHA for 7ad248a

File tree

2 files changed

+44
-1
lines changed
Filter options

2 files changed

+44
-1
lines changed

‎src/Symfony/Component/VarDumper/Caster/SplCaster.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/VarDumper/Caster/SplCaster.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public static function castDoublyLinkedList(\SplDoublyLinkedList $c, array $a, S
6464
$c->setIteratorMode(\SplDoublyLinkedList::IT_MODE_KEEP | $mode & ~\SplDoublyLinkedList::IT_MODE_DELETE);
6565

6666
$a += array(
67-
$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),
67+
$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),
6868
$prefix.'dllist' => iterator_to_array($c),
6969
);
7070
$c->setIteratorMode($mode);
+43Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Component\VarDumper\Tests\Caster;
13+
14+
use Symfony\Component\VarDumper\Test\VarDumperTestCase;
15+
16+
class SplCasterTest extends VarDumperTestCase
17+
{
18+
/**
19+
* @dataProvider provideCastSplDoublyLinkedList
20+
*/
21+
public function testCastSplDoublyLinkedList($modeValue, $modeDump)
22+
{
23+
$var = new \SplDoublyLinkedList();
24+
$var->setIteratorMode($modeValue);
25+
$dump = <<<EOTXT
26+
SplDoublyLinkedList {
27+
mode: $modeDump
28+
dllist: []
29+
}
30+
EOTXT;
31+
$this->assertDumpMatchesFormat($dump, $var);
32+
}
33+
34+
public function provideCastSplDoublyLinkedList()
35+
{
36+
return array(
37+
array(\SplDoublyLinkedList::IT_MODE_FIFO, 'IT_MODE_FIFO | IT_MODE_KEEP'),
38+
array(\SplDoublyLinkedList::IT_MODE_LIFO, 'IT_MODE_LIFO | IT_MODE_KEEP'),
39+
array(\SplDoublyLinkedList::IT_MODE_FIFO | \SplDoublyLinkedList::IT_MODE_DELETE, 'IT_MODE_FIFO | IT_MODE_DELETE'),
40+
array(\SplDoublyLinkedList::IT_MODE_LIFO | \SplDoublyLinkedList::IT_MODE_DELETE, 'IT_MODE_LIFO | IT_MODE_DELETE'),
41+
);
42+
}
43+
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.