Test Failed
Branch master (5e8424)
by Randy
02:43
created

ObjectEnsuranceTest::testImplements()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 0
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
use PHPUnit\Framework\TestCase;
4
use function Dgame\Ensurance\ensure;
5
6
class EA
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
7
{
8
    public $test;
9
10
    public function foo()
11
    {
12
    }
13
}
14
15
class EB extends EA
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class should be in its own file to aid autoloaders.

Having each class in a dedicated file usually plays nice with PSR autoloaders and is therefore a well established practice. If you use other autoloaders, you might not want to follow this rule.

Loading history...
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
16
{
17
}
18
19
interface EI
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class should be in its own file to aid autoloaders.

Having each class in a dedicated file usually plays nice with PSR autoloaders and is therefore a well established practice. If you use other autoloaders, you might not want to follow this rule.

Loading history...
Coding Style Compatibility introduced by
Each interface must be in a namespace of at least one level (a top-level vendor name)

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
20
{
21
}
22
23
class EC implements EI
0 ignored issues
show
Coding Style Compatibility introduced by
Each interface must be in a file by itself

Having each class in a dedicated file usually plays nice with PSR autoloaders and is therefore a well established practice. If you use other autoloaders, you might not want to follow this rule.

Loading history...
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
24
{
25
}
26
27
trait ET
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class should be in its own file to aid autoloaders.

Having each class in a dedicated file usually plays nice with PSR autoloaders and is therefore a well established practice. If you use other autoloaders, you might not want to follow this rule.

Loading history...
Coding Style Compatibility introduced by
Each trait must be in a namespace of at least one level (a top-level vendor name)

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
28
{
29
}
30
31
class ED
0 ignored issues
show
Coding Style Compatibility introduced by
Each trait must be in a file by itself

Having each class in a dedicated file usually plays nice with PSR autoloaders and is therefore a well established practice. If you use other autoloaders, you might not want to follow this rule.

Loading history...
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
32
{
33
    use ET;
34
}
35
36
class ObjectEnsuranceTest extends TestCase
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class should be in its own file to aid autoloaders.

Having each class in a dedicated file usually plays nice with PSR autoloaders and is therefore a well established practice. If you use other autoloaders, you might not want to follow this rule.

Loading history...
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
37
{
38
    public function testIsInstanceOf()
39
    {
40
        $ea = new EA();
41
42
        ensure($ea)->isObject()->isInstanceOf(EA::class);
43
    }
44
45
    public function testIs()
46
    {
47
        $ea = new EA();
48
49
        ensure($ea)->isObject()->is(EA::class);
50
    }
51
52
    public function testIsSome()
53
    {
54
        $eb = new EB();
55
56
        ensure($eb)->isObject()->isSome(EA::class);
57
    }
58
59
    public function testExtends()
60
    {
61
        $eb = new EB();
62
63
        ensure($eb)->isObject()->extends(EA::class);
64
    }
65
66
    public function testImplements()
67
    {
68
        $ec = new EC();
69
70
        ensure($ec)->isObject()->implements(EI::class);
71
    }
72
73
    public function testIsParentOf()
74
    {
75
        $ea = new EA();
76
77
        ensure($ea)->isObject()->isParentOf(EB::class);
78
    }
79
80
    public function testUses()
81
    {
82
        $ed = new ED();
83
84
        ensure($ed)->isObject()->uses(ET::class);
85
    }
86
87
    public function testHasProperty()
88
    {
89
        $ea = new EA();
90
91
        ensure($ea)->isObject()->hasProperty('test');
92
    }
93
94
    public function testHasMethod()
95
    {
96
        $ea = new EA();
97
98
        ensure($ea)->isObject()->hasMethod('foo');
99
    }
100
}