Test Setup Failed
Push — feature/custom-services-cache ( f75830...3d5331 )
by Chema
50:45 queued 22:25
created

DocBlockResolverAwareTest   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Importance

Changes 5
Bugs 0 Features 0
Metric Value
wmc 5
eloc 14
c 5
b 0
f 0
dl 0
loc 40
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A test_non_existing_service() 0 6 1
A test_existing_service_cached() 0 9 1
A setUpBeforeClass() 0 3 1
A setUp() 0 3 1
A test_existing_service() 0 6 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace GacelaTest\Integration\Framework\DocBlockResolverAware;
6
7
use Gacela\Framework\ClassResolver\DocBlockService\CustomServicesCache;
8
use Gacela\Framework\Gacela;
9
use PHPUnit\Framework\TestCase;
10
11
final class DocBlockResolverAwareTest extends TestCase
12
{
13
    public static function setUpBeforeClass(): void
14
    {
15
        CustomServicesCache::resetCache();
16
    }
17
18
    protected function setUp(): void
19
    {
20
        Gacela::bootstrap(__DIR__);
21
    }
22
23
    public function test_existing_service(): void
24
    {
25
        $dummy = new DummyDocBlockResolverAware();
26
        $actual = $dummy->getRepository()->findName();
27
28
        self::assertSame('name', $actual);
29
    }
30
31
    /**
32
     * @depends test_existing_service
33
     */
34
    public function test_existing_service_cached(): void
35
    {
36
        self::assertCount(1, CustomServicesCache::getAll());
37
38
        $dummy = new DummyDocBlockResolverAware();
39
        $dummy->getRepository()->findName();
40
        $dummy->getRepository()->findName();
41
42
        self::assertCount(1, CustomServicesCache::getAll());
43
    }
44
45
    public function test_non_existing_service(): void
46
    {
47
        $this->expectExceptionMessage('Missing the concrete return type for the method `getRepository()`');
48
49
        $dummy = new BadDummyDocBlockResolverAware();
50
        $dummy->getRepository();
51
    }
52
}
53