Completed
Push — master ( deb1d5...3324ab )
by Pablo
04:13
created

PhpGuardCoverageGitIgnoreConfiguratorTest.php (2 issues)

Labels
Severity

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

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
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
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