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

MakeCommandCommandTest::testOutput()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 29
Code Lines 21

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 2
Metric Value
c 2
b 0
f 2
dl 0
loc 29
rs 8.8571
cc 1
eloc 21
nc 1
nop 0
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
}