ClassGeneratorTest::testExtendedClassesAreFQCNs()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 12
rs 9.8666
c 0
b 0
f 0
cc 2
nc 2
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace ProxyManagerTest\Generator;
6
7
use Countable;
8
use PHPUnit\Framework\TestCase;
9
use ProxyManager\Generator\ClassGenerator;
10
use stdClass;
11
12
/**
13
 * Tests for {@see \ProxyManager\Generator\ClassGenerator}
14
 *
15
 * @group Coverage
16
 */
17
final class ClassGeneratorTest extends TestCase
18
{
19
    /**
20
     * @covers \ProxyManager\Generator\ClassGenerator::setExtendedClass
21
     */
22
    public function testExtendedClassesAreFQCNs() : void
23
    {
24
        $desiredFqcn     = '\\stdClass';
25
        $classNameInputs = [stdClass::class, '\\stdClass\\'];
26
27
        foreach ($classNameInputs as $className) {
28
            $classGenerator = new ClassGenerator();
29
            $classGenerator->setExtendedClass($className);
30
31
            self::assertEquals($desiredFqcn, $classGenerator->getExtendedClass());
0 ignored issues
show
Bug introduced by
The method assertEquals() does not seem to exist on object<ProxyManagerTest\...tor\ClassGeneratorTest>.

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
        }
33
    }
34
35
    /**
36
     * @covers \ProxyManager\Generator\ClassGenerator::setImplementedInterfaces
37
     */
38
    public function testImplementedInterfacesAreFQCNs() : void
39
    {
40
        $desiredFqcns        = ['\\Countable'];
41
        $interfaceNameInputs = [[Countable::class], ['\\Countable\\']];
42
43
        foreach ($interfaceNameInputs as $interfaceNames) {
44
            $classGenerator = new ClassGenerator();
45
            $classGenerator->setImplementedInterfaces($interfaceNames);
46
47
            self::assertEquals($desiredFqcns, $classGenerator->getImplementedInterfaces());
0 ignored issues
show
Bug introduced by
The method assertEquals() does not seem to exist on object<ProxyManagerTest\...tor\ClassGeneratorTest>.

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...
48
        }
49
    }
50
}
51