Completed
Push — develop ( 73bd0a...ccb498 )
by Tom
05:04
created

MakeCommandCommandTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 2
Bugs 0 Features 2
Metric Value
wmc 1
c 2
b 0
f 2
lcom 1
cbo 3
dl 0
loc 35
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
B testOutput() 0 29 1
1
<?php
2
3
namespace N98\Magento\Command\Developer\Console;
4
5
6
use Magento\Framework\Filesystem\Directory\WriteInterface;
7
use N98\Magento\Command\Developer\Console\Util\Config\DiFileWriter;
8
9
class MakeCommandCommandTest extends TestCase
10
{
11
    /**
12
     * @test
13
     */
14
    public function testOutput()
15
    {
16
        $diFileWriterMock = $this->getMockBuilder(DiFileWriter::class)
17
            ->setMethods(['save'])
18
            ->getMock();
19
        $diFileWriterMock->loadXml('<config />');
20
21
22
        $command = $this->getMock(MakeCommandCommand::class, ['createDiFileWriter']);
23
        $command
24
            ->expects($this->once())
25
            ->method('createDiFileWriter')
26
            ->will($this->returnValue($diFileWriterMock));
27
28
        $commandTester = $this->createCommandTester($command);
29
        $command->setCurrentModuleName('N98_Dummy');
30
31
        $writerMock = $this->getMock(WriteInterface::class);
32
        $writerMock
33
            ->expects($this->once())
34
            ->method('writeFile')
35
            ->with(
36
                $this->anything(), // param 1
37
                $this->equalTo(file_get_contents(__DIR__ . '/_files/reference_command.php'))
38
            );
39
40
        $command->setCurrentModuleDirectoryWriter($writerMock);
41
        $commandTester->execute(['classpath' => 'foo.bar.baz']);
42
    }
43
}