testClassWithPublicProperties()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 25

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 25
rs 9.52
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace ProxyManagerTest\ProxyGenerator\PropertyGenerator;
6
7
use PHPUnit\Framework\TestCase;
8
use ProxyManager\ProxyGenerator\PropertyGenerator\PublicPropertiesMap;
9
use ProxyManager\ProxyGenerator\Util\Properties;
10
use ProxyManagerTestAsset\ClassWithMixedProperties;
11
use ProxyManagerTestAsset\ClassWithPublicProperties;
12
use ProxyManagerTestAsset\EmptyClass;
13
use ReflectionClass;
14
15
/**
16
 * Tests for {@see \ProxyManager\ProxyGenerator\PropertyGenerator\PublicPropertiesMap}
17
 *
18
 * @covers \ProxyManager\ProxyGenerator\PropertyGenerator\PublicPropertiesMap
19
 * @group Coverage
20
 */
21
final class PublicPropertiesMapTest extends TestCase
22
{
23
    public function testEmptyClass() : void
24
    {
25
        $publicProperties = new PublicPropertiesMap(
26
            Properties::fromReflectionClass(new ReflectionClass(EmptyClass::class))
27
        );
28
29
        self::assertIsArray($publicProperties->getDefaultValue()->getValue());
0 ignored issues
show
Bug introduced by
The method assertIsArray() does not seem to exist on object<ProxyManagerTest\...ublicPropertiesMapTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
30
        self::assertEmpty($publicProperties->getDefaultValue()->getValue());
0 ignored issues
show
Bug introduced by
The method assertEmpty() does not seem to exist on object<ProxyManagerTest\...ublicPropertiesMapTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
31
        self::assertTrue($publicProperties->isStatic());
0 ignored issues
show
Bug introduced by
The method assertTrue() does not seem to exist on object<ProxyManagerTest\...ublicPropertiesMapTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
32
        self::assertSame('private', $publicProperties->getVisibility());
0 ignored issues
show
Bug introduced by
The method assertSame() does not seem to exist on object<ProxyManagerTest\...ublicPropertiesMapTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
33
        self::assertTrue($publicProperties->isEmpty());
0 ignored issues
show
Bug introduced by
The method assertTrue() does not seem to exist on object<ProxyManagerTest\...ublicPropertiesMapTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
34
    }
35
36
    public function testClassWithPublicProperties() : void
37
    {
38
        $publicProperties = new PublicPropertiesMap(
39
            Properties::fromReflectionClass(new ReflectionClass(ClassWithPublicProperties::class))
40
        );
41
42
        self::assertTrue($publicProperties->isStatic());
0 ignored issues
show
Bug introduced by
The method assertTrue() does not seem to exist on object<ProxyManagerTest\...ublicPropertiesMapTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
43
        self::assertSame('private', $publicProperties->getVisibility());
0 ignored issues
show
Bug introduced by
The method assertSame() does not seem to exist on object<ProxyManagerTest\...ublicPropertiesMapTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
44
        self::assertFalse($publicProperties->isEmpty());
0 ignored issues
show
Bug introduced by
The method assertFalse() does not seem to exist on object<ProxyManagerTest\...ublicPropertiesMapTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
45
        self::assertSame(
0 ignored issues
show
Bug introduced by
The method assertSame() does not seem to exist on object<ProxyManagerTest\...ublicPropertiesMapTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
46
            [
47
                'property0' => true,
48
                'property1' => true,
49
                'property2' => true,
50
                'property3' => true,
51
                'property4' => true,
52
                'property5' => true,
53
                'property6' => true,
54
                'property7' => true,
55
                'property8' => true,
56
                'property9' => true,
57
            ],
58
            $publicProperties->getDefaultValue()->getValue()
59
        );
60
    }
61
62
    public function testClassWithMixedProperties() : void
63
    {
64
        self::assertSame(
0 ignored issues
show
Bug introduced by
The method assertSame() does not seem to exist on object<ProxyManagerTest\...ublicPropertiesMapTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
65
            [
66
                'publicProperty0' => true,
67
                'publicProperty1' => true,
68
                'publicProperty2' => true,
69
            ],
70
            (new PublicPropertiesMap(
71
                Properties::fromReflectionClass(new ReflectionClass(ClassWithMixedProperties::class))
72
            ))->getDefaultValue()->getValue()
73
        );
74
    }
75
}
76