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

itShouldWriteData()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

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