Passed
Pull Request — master (#171)
by ARP
03:23
created

GenerateCommandTest::getInputDefinition()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
eloc 1
nc 1
nop 0
1
<?php
2
declare(strict_types=1);
3
4
namespace TheCodingMachine\TDBM\Commands;
5
6
use TheCodingMachine\TDBM\Configuration;
7
use TheCodingMachine\TDBM\TDBMAbstractServiceTest;
8
use Symfony\Component\Console\Command\Command;
9
use Symfony\Component\Console\Input\ArrayInput;
10
use Symfony\Component\Console\Input\InputDefinition;
11
use Symfony\Component\Console\Input\InputInterface;
12
use Symfony\Component\Console\Output\BufferedOutput;
13
use Symfony\Component\Console\Output\OutputInterface;
14
15
class GenerateCommandTest extends TDBMAbstractServiceTest
16
{
17
    public function testCall(): void
18
    {
19
        $input = new ArrayInput([], new InputDefinition([]));
20
        $output = new BufferedOutput();
21
        $output->setVerbosity(OutputInterface::VERBOSITY_DEBUG);
22
23
        //let's delete the lock file
24
        $schemaFilePath = Configuration::getDefaultLockFilePath();
25
        if (file_exists($schemaFilePath)) {
26
            unlink($schemaFilePath);
27
        }
28
        (new GenerateCommand($this->getConfiguration()))->run($input, $output);
29
        $result = $output->fetch();
30
31
        $this->assertContains('Finished regenerating DAOs and beans', $result);
32
        //Check that the lock file was generated
33
        $this->assertFileExists($schemaFilePath);
34
    }
35
}
36