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

DeepCopyTest/Matcher/PropertyTypeMatcherTest.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\Matcher;
3
4
use DeepCopy\Matcher\PropertyTypeMatcher;
5
6
/**
7
 * Test PropertyNameMatcher
8
 */
9
class PropertyTypeMatcherTest extends \PHPUnit_Framework_TestCase
10
{
11
    public function testMatches()
12
    {
13
        $matcher = new PropertyTypeMatcher('DeepCopyTest\Matcher\PropertyTypeMatcherTestFixture2');
0 ignored issues
show
Deprecated Code introduced by Matthieu Napoli
The class DeepCopy\Matcher\PropertyTypeMatcher has been deprecated with message: It is recommended to use {@see DeepCopy\TypeFilter\TypeFilter} instead, as it applies on all occurrences of given type in copied context (eg. array elements), not just on object properties.

This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.

Loading history...
14
15
        $o = new PropertyTypeMatcherTestFixture1();
16
        $this->assertFalse($matcher->matches($o, 'property1'));
17
18
        $o->property1 = new PropertyTypeMatcherTestFixture1();
19
        $this->assertFalse($matcher->matches($o, 'property1'));
20
21
        $o->property1 = new PropertyTypeMatcherTestFixture2();
22
        $this->assertTrue($matcher->matches($o, 'property1'));
23
    }
24
}
25
26
class PropertyTypeMatcherTestFixture1
27
{
28
    public $property1;
29
}
30
31
class PropertyTypeMatcherTestFixture2
32
{
33
}
34