Test Setup Failed
Push — feature/custom-services-cache ( f75830 )
by Chema
29:27
created

test_existing_service_cached()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
dl 0
loc 9
rs 10
c 1
b 0
f 0
cc 1
nc 1
nop 0
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
    protected function setUp(): void
14
    {
15
        Gacela::bootstrap(__DIR__);
16
    }
17
18
    public function test_existing_service(): void
19
    {
20
        $dummy = new DummyDocBlockResolverAware();
21
        $actual = $dummy->getRepository()->findName();
22
23
        self::assertSame('name', $actual);
24
    }
25
26
    /**
27
     * @depends test_existing_service
28
     */
29
    public function test_existing_service_cached(): void
30
    {
31
        self::assertCount(1, CustomServicesCache::getAll());
32
33
        $dummy = new DummyDocBlockResolverAware();
34
        $dummy->getRepository()->findName();
35
        $dummy->getRepository()->findName();
36
37
        self::assertCount(1, CustomServicesCache::getAll());
38
    }
39
40
    public function test_non_existing_service(): void
41
    {
42
        $this->expectExceptionMessage('Missing the concrete return type for the method `getRepository()`');
43
44
        $dummy = new BadDummyDocBlockResolverAware();
45
        $dummy->getRepository();
46
    }
47
}
48