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

PhpGuardCoverageGitIgnoreConfiguratorTest::setUp()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 1 Features 0
Metric Value
c 1
b 1
f 0
dl 0
loc 7
rs 9.4285
cc 1
eloc 4
nc 1
nop 0
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