ManualUsageTest   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 40
Duplicated Lines 50 %

Coupling/Cohesion

Components 1
Dependencies 6

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 6
dl 20
loc 40
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 5 1
A testStatus() 10 10 1
A testMigrate() 10 10 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
3
declare(strict_types=1);
4
5
namespace Zenify\DoctrineMigrations\Tests;
6
7
use PHPUnit\Framework\TestCase;
8
use Symfony\Component\Console\Application;
9
use Symfony\Component\Console\Input\ArrayInput;
10
use Symfony\Component\Console\Output\BufferedOutput;
11
12
13
final class ManualUsageTest extends TestCase
14
{
15
16
	/**
17
	 * @var Application
18
	 */
19
	private $consoleApplication;
20
21
22
	protected function setUp()
23
	{
24
		$container = (new ContainerFactory)->createWithConfig(__DIR__ . '/config/manualUsage.neon');
25
		$this->consoleApplication = $container->getByType(Application::class);
26
	}
27
28
29 View Code Duplication
	public function testStatus()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
30
	{
31
		$input = new ArrayInput(['command' => 'migrations:status']);
32
		$output = new BufferedOutput;
33
34
		$status = $this->consoleApplication->run($input, $output);
35
36
		$this->assertSame(0, $status);
37
		$this->assertContains('Configuration', $output->fetch());
38
	}
39
40
41 View Code Duplication
	public function testMigrate()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
42
	{
43
		$input = new ArrayInput(['command' => 'migrations:migrate']);
44
		$input->setInteractive(FALSE);
45
46
		$output = new BufferedOutput;
47
48
		$status = $this->consoleApplication->run($input, $output);
49
		$this->assertSame(0, $status);
50
	}
51
52
}
53