Passed
Push — feature/custom-services-v2 ( f3d61c...0bc47e )
by Chema
03:49
created

DocBlockParserTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 13
c 1
b 0
f 0
dl 0
loc 25
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 3 1
A test_get_class_from_method() 0 10 1
A test_get_class_from_empty_doc_block() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace GacelaTest\Unit\Framework\ClassResolver\CustomService;
6
7
use Gacela\Framework\ClassResolver\CustomService\DocBlockParser;
8
use PHPUnit\Framework\TestCase;
9
10
final class DocBlockParserTest extends TestCase
11
{
12
    private DocBlockParser $parser;
13
14
    protected function setUp(): void
15
    {
16
        $this->parser = new DocBlockParser();
17
    }
18
19
    public function test_get_class_from_empty_doc_block(): void
20
    {
21
        $input = '';
22
        self::assertSame('', $this->parser->getClassFromMethod($input, 'getClass()'));
23
    }
24
25
    public function test_get_class_from_method(): void
26
    {
27
        $input = <<<TXT
28
/**
29
 * @method \App\Module\ClassName getClass()
30
 */
31
TXT;
32
        self::assertSame(
33
            '\App\Module\ClassName',
34
            $this->parser->getClassFromMethod($input, 'getClass()')
35
        );
36
    }
37
}
38