Passed
Push — feature/allow-using-interface-... ( 231f23 )
by Chema
04:54
created

test_service_as_interface()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 3
c 0
b 0
f 0
dl 0
loc 6
rs 10
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\Gacela;
8
use PHPUnit\Framework\TestCase;
9
10
final class DocBlockResolverCustomServicesAwareTest extends TestCase
11
{
12
    protected function setUp(): void
13
    {
14
        Gacela::bootstrap(__DIR__);
15
    }
16
17
    public function test_existing_service(): void
18
    {
19
        $dummy = new DummyDocBlockResolverAware();
20
        $actual = $dummy->getRepository()->findName();
21
22
        self::assertSame('name', $actual);
23
    }
24
25
    public function test_service_as_interface(): void
26
    {
27
        $dummy = new DummyDocBlockResolverAware();
28
        $actual = $dummy->getService()->getName();
29
30
        self::assertSame('fake-service.name', $actual);
31
    }
32
33
    public function test_non_existing_service(): void
34
    {
35
        $this->expectExceptionMessage('Missing the concrete return type for the method `getRepository()`');
36
37
        $dummy = new BadDummyDocBlockResolverAware();
38
        $dummy->getRepository();
39
    }
40
}
41