Completed
Push — master ( 39044b...ce5fed )
by Oleg
02:16
created

DeleteCestTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 16
dl 0
loc 34
rs 10
c 0
b 0
f 0
wmc 2

4 Methods

Rating   Name   Duplication   Size   Complexity  
A hp$0 ➔ testExecuteForce() 0 19 1
testExecuteForce() 0 19 ?
A hp$0 ➔ write() 0 3 1
A testExecuteDryRun() 0 11 1
1
<?php
2
declare(strict_types=1);
3
4
namespace SlayerBirden\DFCodeGeneration\Command\Tests\Api;
5
6
use PHPUnit\Framework\TestCase;
7
use SlayerBirden\DFCodeGeneration\Command\Hubby;
8
use SlayerBirden\DFCodeGeneration\Writer\WriteInterface;
9
use Symfony\Component\Console\Tester\CommandTester;
10
11
final class DeleteCestTest extends TestCase
12
{
13
    public function testExecuteDryRun()
14
    {
15
        $writer = $this->prophesize(WriteInterface::class);
16
        $tester = new CommandTester(new DeleteTestCommand(null, $writer->reveal()));
17
        $tester->execute([
18
            'entity' => Hubby::class,
19
        ]);
20
21
        $display = $tester->getDisplay();
22
23
        $this->assertContains('DeleteCest', $display);
24
    }
25
26
    public function testExecuteForce()
27
    {
28
        $writer = new class implements WriteInterface {
0 ignored issues
show
Coding Style introduced by
This class is not in CamelCase format.

Classes in PHP are usually named in CamelCase.

In camelCase names are written without any punctuation, the start of each new word being marked by a capital letter. The whole name starts with a capital letter as well.

Thus the name database provider becomes DatabaseProvider.

Loading history...
29
            public $content = '';
30
31
            public function write(string $content, string $fileName): void
32
            {
33
                $this->content .= $content;
34
            }
35
        };
36
        $tester = new CommandTester(new DeleteTestCommand(null, $writer));
37
        $tester->execute([
38
            'entity' => Hubby::class,
39
            '--force' => true,
40
        ]);
41
42
        $content = $writer->content;
43
44
        $this->assertContains('DeleteCest', $content);
45
    }
46
}
47