PhpFilesExtractorQueryHandlerTest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 5

Importance

Changes 0
Metric Value
wmc 2
c 0
b 0
f 0
lcom 1
cbo 5
dl 0
loc 25
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 4 1
A itShouldReturnArrayPhpFilesResponse() 0 9 1
1
<?php
2
3
namespace PhpGitHooks\Module\Files\Tests\Behaviour;
4
5
use PhpGitHooks\Module\Files\Contract\Query\PhpFilesExtractor;
6
use PhpGitHooks\Module\Files\Contract\Query\PhpFilesExtractorHandler;
7
use PhpGitHooks\Module\Files\Contract\Response\PhpFilesResponse;
8
use PhpGitHooks\Module\Files\Tests\Infrastructure\FilesUnitTestCase;
9
use PhpGitHooks\Module\Git\Tests\Stub\FilesCommittedStub;
10
11
class PhpFilesExtractorQueryHandlerTest extends FilesUnitTestCase
12
{
13
    /**
14
     * @var PhpFilesExtractorHandler
15
     */
16
    private $phpFilesExtractorQueryHandler;
17
18
    protected function setUp(): void
19
    {
20
        $this->phpFilesExtractorQueryHandler = new PhpFilesExtractorHandler();
21
    }
22
23
    /**
24
     * @test
25
     */
26
    public function itShouldReturnArrayPhpFilesResponse()
27
    {
28
        $files = $this->phpFilesExtractorQueryHandler->handle(
29
            new PhpFilesExtractor(FilesCommittedStub::createAllFiles())
30
        );
31
32
        $this->assertInstanceOf(PhpFilesResponse::class, $files);
33
        $this->assertSame(5, count($files->getFiles()));
34
    }
35
}
36