SetConsoleOutputEventSubscriberTest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 6

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 6
dl 0
loc 34
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 6 1
A testDispatching() 0 15 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Zenify\DoctrineMigrations\Tests\EventSubscriber;
6
7
use PHPUnit_Framework_Assert;
8
use Symfony\Component\Console\Input\ArrayInput;
9
use Symfony\Component\Console\Output\BufferedOutput;
10
use Symfony\Component\Console\Output\OutputInterface;
11
use Zenify\DoctrineMigrations\OutputWriter;
12
13
14
final class SetConsoleOutputEventSubscriberTest extends AbstractEventSubscriberTest
15
{
16
17
	/**
18
	 * @var OutputWriter
19
	 */
20
	private $outputWriter;
21
22
23
	protected function setUp()
24
	{
25
		parent::setUp();
26
27
		$this->outputWriter = $this->container->getByType(OutputWriter::class);
28
	}
29
30
31
	public function testDispatching()
32
	{
33
		$this->assertNull(
34
			PHPUnit_Framework_Assert::getObjectAttribute($this->outputWriter, 'consoleOutput')
35
		);
36
37
		$input = new ArrayInput(['command' => 'migrations:status']);
38
		$output = new BufferedOutput;
39
		$this->application->run($input, $output);
40
41
		$this->assertInstanceOf(
42
			OutputInterface::class,
43
			PHPUnit_Framework_Assert::getObjectAttribute($this->outputWriter, 'consoleOutput')
44
		);
45
	}
46
47
}
48