Completed
Push — 1.x ( 0fa590...3b8a3a )
by Théo
01:13
created

test_it_deep_copies_a_doubly_linked_spl_list()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 14
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 8
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 14
rs 9.4285
1
<?php
2
3
namespace DeepCopyTest\TypeFilter\Spl;
4
5
use DeepCopy\DeepCopy;
6
use DeepCopy\TypeFilter\Spl\SplDoublyLinkedListFilter;
7
use PHPUnit_Framework_TestCase;
8
use SplDoublyLinkedList;
9
use stdClass;
10
11
/**
12
 * @covers \DeepCopy\TypeFilter\Spl\SplDoublyLinkedListFilter
13
 */
14
class SplDoublyLinkedListFilterTest extends PHPUnit_Framework_TestCase
15
{
16
    public function test_it_deep_copies_a_doubly_linked_spl_list()
17
    {
18
        $foo = new stdClass();
19
20
        $list = new SplDoublyLinkedList();
21
        $list->push($foo);
22
23
        $filter = new SplDoublyLinkedListFilter(new FakeDeepCopy());
24
25
        $newList = $filter->apply($list);
26
27
        $this->assertSame(1, count($newList));
28
        $this->assertNotSame($foo, $newList->next());
29
    }
30
}
31
32
class FakeDeepCopy extends DeepCopy
33
{
34
    /**
35
     * @inheritdoc
36
     */
37
    public function copy($object)
38
    {
39
        return new stdClass();
40
    }
41
}
42