Completed
Push — master ( aaccd5...c6e65b )
by Jonathan
10s
created

ConsoleTest::setUp()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 0
dl 0
loc 7
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace ChangelogGenerator\Tests\Functional;
6
7
use ChangelogGenerator\ChangelogGenerator;
8
use ChangelogGenerator\Command\GenerateChangelogCommand;
9
use PackageVersions\Versions;
10
use PHPUnit\Framework\TestCase;
11
use Symfony\Component\Console\Application;
12
use Symfony\Component\Console\Input\ArrayInput;
13
use Symfony\Component\Console\Output\OutputInterface;
14
15
final class ConsoleTest extends TestCase
16
{
17
    /** @var \PHPUnit_Framework_MockObject_MockObject|ChangelogGenerator */
18
    private $changelogGenerator;
19
20
    /** @var Application */
21
    private $application;
22
23
    public function testGenerate() : void
24
    {
25
        $input = new ArrayInput([
26
            'command' => 'generate',
27
            '--user' => 'jwage',
28
            '--repository' => 'changelog-generator',
29
            '--milestone' => '1.0',
30
        ]);
31
32
        $output = $this->createMock(OutputInterface::class);
33
34
        $this->changelogGenerator->expects($this->once())
35
            ->method('generate')
36
            ->with('jwage', 'changelog-generator', '1.0');
37
38
        $this->application->run($input, $output);
39
    }
40
41
    protected function setUp() : void
42
    {
43
        $this->changelogGenerator = $this->createMock(ChangelogGenerator::class);
44
45
        $this->application = new Application('Changelog Generator', Versions::getVersion('jwage/changelog-generator'));
46
        $this->application->setAutoExit(false);
47
        $this->application->add(new GenerateChangelogCommand($this->changelogGenerator));
48
    }
49
}
50