GetMethodIfExistsTest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 2
dl 0
loc 16
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testGetExistingMethod() 0 8 1
A testGetNonExistingMethod() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace ProxyManagerTest\ProxyGenerator\Util;
6
7
use PHPUnit\Framework\TestCase;
8
use ProxyManager\ProxyGenerator\Util\GetMethodIfExists;
9
use ReflectionClass;
10
use ReflectionMethod;
11
use function uniqid;
12
13
/**
14
 * Tests for {@see \ProxyManager\ProxyGenerator\Util\GetMethodIfExists}
15
 *
16
 * @covers \ProxyManager\ProxyGenerator\Util\GetMethodIfExists
17
 * @group Coverage
18
 */
19
final class GetMethodIfExistsTest extends TestCase
20
{
21
    public function testGetExistingMethod() : void
22
    {
23
        $method = GetMethodIfExists::get(new ReflectionClass(self::class), 'testGetExistingMethod');
24
25
        self::assertInstanceOf(ReflectionMethod::class, $method);
0 ignored issues
show
Bug introduced by
The method assertInstanceOf() does not seem to exist on object<ProxyManagerTest\...\GetMethodIfExistsTest>.

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...
26
        self::assertSame('testGetExistingMethod', $method->getName());
0 ignored issues
show
Bug introduced by
The method assertSame() does not seem to exist on object<ProxyManagerTest\...\GetMethodIfExistsTest>.

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...
27
        self::assertSame(self::class, $method->getDeclaringClass()->getName());
0 ignored issues
show
Bug introduced by
The method assertSame() does not seem to exist on object<ProxyManagerTest\...\GetMethodIfExistsTest>.

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...
28
    }
29
30
    public function testGetNonExistingMethod() : void
31
    {
32
        self::assertNull(GetMethodIfExists::get(new ReflectionClass(self::class), uniqid('nonExisting', true)));
0 ignored issues
show
Bug introduced by
The method assertNull() does not seem to exist on object<ProxyManagerTest\...\GetMethodIfExistsTest>.

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
    }
34
}
35