ArraySnapshotTest::testDeepConstructor()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
/**
3
 * This file is part of the Totem package
4
 *
5
 * For the full copyright and license information, please view the LICENSE file
6
 * that was distributed with this source code.
7
 *
8
 * @copyright Baptiste Clavié <[email protected]>
9
 * @license   http://www.opensource.org/licenses/MIT-License MIT License
10
 */
11
12
namespace Totem\Snapshot;
13
14
use stdClass;
15
use ReflectionMethod;
16
17
use PHPUnit_Framework_TestCase;
18
19
class ArraySnapshotTest extends PHPUnit_Framework_TestCase
20
{
21
    /**
22
     * @dataProvider providerCompare
23
     */
24
    public function testCompare($compare, $expect)
25
    {
26
        $snapshot = new ArraySnapshot([]);
27
        $this->assertSame($expect, $snapshot->isComparable($compare));
28
    }
29
30
    public function providerCompare()
31
    {
32
        $snapshot = $this->getMockBuilder('Totem\\AbstractSnapshot')
33
                         ->disableOriginalConstructor()
34
                         ->getMock();
35
36
        return [[new ArraySnapshot([]), true],
37
                [$snapshot, false]];
38
    }
39
40
    /**
41
     * @dataProvider deepProvider
42
     */
43
    public function testDeepConstructor($value)
44
    {
45
        new ArraySnapshot(['foo' => $value]);
46
    }
47
48
    public function deepProvider()
49
    {
50
        return [[(object) ['bar' => 'baz']],
51
                [['bar' => 'baz']],
52
                ['fubar']];
53
    }
54
}
55
56