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

GitIgnoreWriterCommandHandlerTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 6

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A itShouldWriteData() 0 11 1
1
<?php
2
3
namespace PhpGitHooks\Module\Git\Tests\Behaviour;
4
5
use PhpGitHooks\Module\Git\Contract\Command\GitIgnoreWriterCommand;
6
use PhpGitHooks\Module\Git\Contract\CommandHandler\GitIgnoreWriterCommandHandler;
7
use PhpGitHooks\Module\Git\Service\GitIgnoreWriter;
8
use PhpGitHooks\Module\Git\Tests\Infrastructure\GitUnitTestCase;
9
use PhpGitHooks\Module\Tests\Infrastructure\Stub\StubCreator;
10
11
class GitIgnoreWriterCommandHandlerTest extends GitUnitTestCase
12
{
13
    /**
14
     * @test
15
     */
16
    public function itShouldWriteData()
17
    {
18
        $content = StubCreator::faker()->text();
19
20
        $this->shouldWriteData($content);
21
22
        $commandHandler = new GitIgnoreWriterCommandHandler(
23
            new GitIgnoreWriter($this->getWriter())
0 ignored issues
show
Bug introduced by
It seems like $this->getWriter() targeting PhpGitHooks\Module\Git\T...rfaceTrait::getWriter() can also be of type object<Mockery\MockInterface>; however, PhpGitHooks\Module\Git\S...reWriter::__construct() does only seem to accept object<PhpGitHooks\Modul...\Model\WriterInterface>, 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...
24
        );
25
        $commandHandler->handle(new GitIgnoreWriterCommand($content));
26
    }
27
}
28