Completed
Branch guard_coverage (f2aaf0)
by Pablo
03:07
created

PhpGuardCoverageGitIgnoreConfiguratorTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 6

Importance

Changes 1
Bugs 1 Features 0
Metric Value
wmc 3
c 1
b 1
f 0
lcom 1
cbo 6
dl 0
loc 37
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 7 1
A itShouldWriteEntry() 0 9 1
A itShouldNotWriteEntry() 0 6 1
1
<?php
2
3
namespace PhpGitHooks\Module\Configuration\Tests\Behaviour;
4
5
use PhpGitHooks\Module\Configuration\Service\PhpGuardCoverageGitIgnoreConfigurator;
6
use PhpGitHooks\Module\Configuration\Tests\Infrastructure\ConfigurationUnitTestCase;
7
use PhpGitHooks\Module\Git\Contract\Command\GitIgnoreWriterCommand;
8
use PhpGitHooks\Module\Git\Contract\Query\GitIgnoreExtractorQuery;
9
use PhpGitHooks\Module\Git\Tests\Stub\GitIgnoreDataResponseStub;
10
11
class PhpGuardCoverageGitIgnoreConfiguratorTest extends ConfigurationUnitTestCase
12
{
13
    /**
14
     * @var PhpGuardCoverageGitIgnoreConfigurator
15
     */
16
    private $phpGuardCoverageGitIgnoreConfigurator;
17
18
    protected function setUp()
19
    {
20
        $this->phpGuardCoverageGitIgnoreConfigurator = new PhpGuardCoverageGitIgnoreConfigurator(
21
            $this->getQueryBus(),
0 ignored issues
show
Bug introduced by
It seems like $this->getQueryBus() targeting PhpGitHooks\Module\Share...BusTrait::getQueryBus() can also be of type object<Mockery\MockInterface>; however, PhpGitHooks\Module\Confi...igurator::__construct() does only seem to accept object<PhpGitHooks\Infra...dBus\QueryBus\QueryBus>, maybe add an additional type check?

This check looks at variables that are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
22
            $this->getCommandBus()
0 ignored issues
show
Bug introduced by
It seems like $this->getCommandBus() targeting PhpGitHooks\Module\Share...sTrait::getCommandBus() can also be of type object<Mockery\MockInterface>; however, PhpGitHooks\Module\Confi...igurator::__construct() does only seem to accept object<PhpGitHooks\Infra...\CommandBus\CommandBus>, maybe add an additional type check?

This check looks at variables that are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
23
        );
24
    }
25
26
    /**
27
     * @test
28
     */
29
    public function itShouldWriteEntry()
30
    {
31
        $content = GitIgnoreDataResponseStub::random();
32
33
        $this->shouldHandleQuery(new GitIgnoreExtractorQuery(), $content);
34
        $this->shouldHandleCommand(new GitIgnoreWriterCommand($content->getContent()));
35
36
        $this->phpGuardCoverageGitIgnoreConfigurator->configure();
37
    }
38
    /**
39
     * @test
40
     */
41
    public function itShouldNotWriteEntry()
42
    {
43
        $this->shouldHandleQuery(new GitIgnoreExtractorQuery(), GitIgnoreDataResponseStub::randomWithGuardCoverage());
44
45
        $this->phpGuardCoverageGitIgnoreConfigurator->configure();
46
    }
47
}
48