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

GenerateCommandTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 11
dl 0
loc 19
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A testCall() 0 17 2
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