RoaveBetterReflectionReflectorTest   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 11
dl 0
loc 27
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A itShouldReflectFileName() 0 6 1
A setUp() 0 6 1
A itShouldThrowExceptionWhenClassNotFound() 0 6 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Gember\FileReflectorRoave\Test;
6
7
use Gember\EventSourcing\Util\File\Reflector\ReflectionFailedException;
8
use Gember\FileReflectorRoave\RoaveBetterReflectionFactory;
0 ignored issues
show
Bug introduced by
The type Gember\FileReflectorRoav...BetterReflectionFactory was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
9
use Gember\FileReflectorRoave\RoaveBetterReflectionReflector;
0 ignored issues
show
Bug introduced by
The type Gember\FileReflectorRoav...tterReflectionReflector was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
10
use Gember\FileReflectorRoave\Test\TestDoubles\TestClass;
0 ignored issues
show
Bug introduced by
The type Gember\FileReflectorRoav...t\TestDoubles\TestClass was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
11
use PHPUnit\Framework\Attributes\Test;
0 ignored issues
show
Bug introduced by
The type PHPUnit\Framework\Attributes\Test was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
12
use PHPUnit\Framework\TestCase;
13
14
/**
15
 * @internal
16
 */
17
final class RoaveBetterReflectionReflectorTest extends TestCase
18
{
19
    private RoaveBetterReflectionReflector $reflector;
20
21
    protected function setUp(): void
22
    {
23
        parent::setUp();
24
25
        $this->reflector = new RoaveBetterReflectionReflector(
26
            new RoaveBetterReflectionFactory(),
27
        );
28
    }
29
30
    #[Test]
31
    public function itShouldReflectFileName(): void
32
    {
33
        $reflectionClass = $this->reflector->reflectClassFromFile(__DIR__ . '/TestDoubles/TestClass.php');
34
35
        self::assertSame(TestClass::class, $reflectionClass->getName());
36
    }
37
38
    #[Test]
39
    public function itShouldThrowExceptionWhenClassNotFound(): void
40
    {
41
        self::expectException(ReflectionFailedException::class);
0 ignored issues
show
Bug Best Practice introduced by
The method PHPUnit\Framework\TestCase::expectException() is not static, but was called statically. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

41
        self::/** @scrutinizer ignore-call */ 
42
              expectException(ReflectionFailedException::class);
Loading history...
42
43
        $this->reflector->reflectClassFromFile(__DIR__ . '/TestDoubles/no-class.php');
44
    }
45
}
46