Completed
Push — master ( cd2604...399c1f )
by Matthieu
03:36
created

DeepCopyTest/Reflection/ReflectionHelperTest.php (1 issue)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
namespace DeepCopyTest\Reflection;
3
4
use DeepCopy\Reflection\ReflectionHelper;
5
6
/**
7
 * Test ReflectionHelper
8
 */
9
class ReflectionHelperTest extends \PHPUnit_Framework_TestCase
10
{
11
    public function testMaintainPropertiesKey()
12
    {
13
        $child = new ReflectionHelperTestChild();
14
        $ref = new \ReflectionClass($child);
15
16
        $expectedProps = array(
17
            'a1',
18
            'a2',
19
            'a3',
20
            'a4',
21
            'a5',
22
            'a6',
23
            'a7',
24
            'a8',
25
            'a9',
26
        );
27
28
        $actualProps = ReflectionHelper::getProperties($ref);
29
30
        $this->assertSame($expectedProps, array_keys($actualProps));
31
    }
32
}
33
34
class ReflectionHelperTestParent {
35
    public $a1;
36
    protected $a2;
37
    private $a3;
38
39
    public $a4;
40
    protected $a5;
41
    private $a6;
42
}
43
44
class ReflectionHelperTestChild extends ReflectionHelperTestParent {
45
    public $a1;
46
    protected $a2;
47
    private $a3;
0 ignored issues
show
Comprehensibility introduced by Filippo Tessarotto
Consider using a different property name as you override a private property of the parent class.
Loading history...
48
49
    public $a7;
50
    protected $a8;
51
    private $a9;
52
}
53