Passed
Push — add-command-list-modules ( fd1ae6 )
by Chema
11:55
created

MakeExceptionCommandTest::setUp()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace GacelaTest\Feature\Console\CodeGenerator;
6
7
use Gacela\Console\Domain\ConsoleException;
8
use Gacela\Console\Infrastructure\Command\MakeFileCommand;
9
use Gacela\Console\Infrastructure\Command\MakeModuleCommand;
10
use Gacela\Framework\Gacela;
11
use PHPUnit\Framework\TestCase;
12
use Symfony\Component\Console\Input\StringInput;
13
use Symfony\Component\Console\Output\BufferedOutput;
14
15
final class MakeExceptionCommandTest extends TestCase
16
{
17
    protected function setUp(): void
18
    {
19
        Gacela::bootstrap(__DIR__ . '/undefined-folder/');
20
    }
21
22
    public function test_make_module_exception_when_composer_file_not_found(): void
23
    {
24
        $this->expectExceptionObject(ConsoleException::composerJsonNotFound());
25
26
        $input = new StringInput('Psr4CodeGenerator/TestModule');
27
        $bootstrap = new MakeModuleCommand();
28
        $bootstrap->run($input, new BufferedOutput());
29
    }
30
31
    public function test_make_file_exception_when_composer_file_not_found(): void
32
    {
33
        $this->expectExceptionObject(ConsoleException::composerJsonNotFound());
34
35
        $input = new StringInput('Psr4CodeGenerator/TestModule facade');
36
        $bootstrap = new MakeFileCommand();
37
        $bootstrap->run($input, new BufferedOutput());
38
    }
39
}
40