Completed
Push — master ( 2704f9...f273e8 )
by Tomáš
02:19
created

SetConsoleOutputEventSubscriberTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 5

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
lcom 1
cbo 5
dl 0
loc 39
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 6 1
A testDispatching() 0 15 1
1
<?php
2
3
namespace Zenify\DoctrineMigrations\Tests\EventSubscriber;
4
5
use PHPUnit_Framework_Assert;
6
use PHPUnit_Framework_TestCase;
7
use Symfony\Component\Console\Application;
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
use Zenify\DoctrineMigrations\Tests\ContainerFactory;
0 ignored issues
show
Coding Style introduced by Tomas Votruba
As per PSR2, there should be exactly one blank line after the last USE statement, 2 were found though.
Loading history...
13
14
15
final class SetConsoleOutputEventSubscriberTest extends PHPUnit_Framework_TestCase
16
{
17
18
	/**
19
	 * @var Application
20
	 */
21
	private $application;
22
23
	/**
24
	 * @var OutputWriter
25
	 */
26
	private $outputWriter;
27
28
29
	protected function setUp()
30
	{
31
		$container = (new ContainerFactory)->create();
32
		$this->application = $container->getByType(Application::class);
33
		$this->outputWriter = $container->getByType(OutputWriter::class);
34
	}
35
36
37
	public function testDispatching()
38
	{
39
		$this->assertNull(
40
			PHPUnit_Framework_Assert::getObjectAttribute($this->outputWriter, 'consoleOutput')
41
		);
42
43
		$input = new ArrayInput(['command' => 'migrations:status']);
44
		$output = new BufferedOutput;
45
		$this->application->run($input, $output);
46
47
		$this->assertInstanceOf(
48
			OutputInterface::class,
49
			PHPUnit_Framework_Assert::getObjectAttribute($this->outputWriter, 'consoleOutput')
50
		);
51
	}
52
53
}
1 ignored issue
show
Coding Style introduced by Tomas Votruba
According to PSR2, the closing brace of classes should be placed on the next line directly after the body.

Below you find some examples:

// Incorrect placement according to PSR2
class MyClass
{
    public function foo()
    {

    }
    // This blank line is not allowed.

}

// Correct
class MyClass
{
    public function foo()
    {

    } // No blank lines after this line.
}
Loading history...
54