GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( 4a329e...1320b2 )
by Lukáš
03:00
created

GenerateProxiesCommandTest   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 30
Duplicated Lines 20 %

Coupling/Cohesion

Components 0
Dependencies 5

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
B testCommand() 6 27 5

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
declare(strict_types=1);
3
4
namespace Lookyman\Nette\Proxy\Tests\Console;
5
6
use Kdyby\Console\Application;
7
use Nette\Configurator;
8
use Symfony\Component\Console\Tester\CommandTester;
9
10
class GenerateProxiesCommandTest extends \PHPUnit_Framework_TestCase
11
{
12
	public function testCommand()
13
	{
14
		$tempDir = __DIR__ . '/../temp/Console';
15 View Code Duplication
		if (!@mkdir($tempDir, 0777, true) && !is_dir($tempDir)) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across 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...
16
			throw new \RuntimeException(sprintf('Cannot create temp directory %s', $tempDir));
17
		}
18
19
		/** @var \SplFileInfo $entry */
20 View Code Duplication
		foreach (new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($tempDir, \RecursiveDirectoryIterator::SKIP_DOTS), \RecursiveIteratorIterator::CHILD_FIRST) as $entry) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across 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...
21
			$entry->isDir() ? rmdir((string) $entry) : unlink((string) $entry);
22
		}
23
24
		$container = (new Configurator())
25
			->setTempDirectory($tempDir)
26
			->setDebugMode(true)
27
			->addConfig(__DIR__ . '/../config/config.neon')
28
			->createContainer();
29
		$container->initialize();
30
31
		/** @var Application $application */
32
		$application = $container->getByType(Application::class);
33
		$tester = new CommandTester($application->find('lookyman:nette-proxy:generate'));
34
		$tester->execute(['command' => 'lookyman:nette-proxy:generate']);
35
36
		self::assertFileExists(__DIR__ . '/../temp/proxies/ProxyManagerGeneratedProxy__PM__LookymanNetteProxyTestsMockIService2FactoryGeneratedee1449ea0da0fdbf038d28254e9c7b3f.php');
37
		self::assertFileExists(__DIR__ . '/../temp/proxies/ProxyManagerGeneratedProxy__PM__LookymanNetteProxyTestsMockService1Generateda427b08305d9796d18525e91e7b08e56.php');
38
	}
39
}
40