Completed
Push — master ( 1a6e67...071a29 )
by Tomáš
02:38
created

testFixing()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 6

Duplication

Lines 10
Ratio 100 %

Importance

Changes 0
Metric Value
dl 10
loc 10
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 6
nc 1
nop 0
1
<?php
2
3
declare(strict_types = 1);
4
5
namespace Zenify\CodingStandard\Tests\Sniffs\WhiteSpace\PropertiesMethodsMutualSpacing;
6
7
use PHPUnit\Framework\TestCase;
8
use Zenify\CodingStandard\Tests\CodeSnifferRunner;
9
use ZenifyCodingStandard\Sniffs\WhiteSpace\PropertiesMethodsMutualSpacingSniff;
10
11
12 View Code Duplication
final class PropertiesMethodsMutualSpacingSniffTest extends TestCase
0 ignored issues
show
Duplication introduced by
This class 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...
13
{
14
15
	public function testDetection()
16
	{
17
		$codeSnifferRunner = new CodeSnifferRunner(PropertiesMethodsMutualSpacingSniff::NAME);
18
19
		$this->assertSame(1, $codeSnifferRunner->getErrorCountInFile(__DIR__ . '/wrong.php'));
20
		$this->assertSame(1, $codeSnifferRunner->getErrorCountInFile(__DIR__ . '/wrong2.php'));
21
		$this->assertSame(0, $codeSnifferRunner->getErrorCountInFile(__DIR__ . '/correct.php'));
22
		$this->assertSame(0, $codeSnifferRunner->getErrorCountInFile(__DIR__ . '/correct2.php'));
23
		$this->assertSame(0, $codeSnifferRunner->getErrorCountInFile(__DIR__ . '/correct3.php'));
24
	}
25
26
27
	public function testFixing()
28
	{
29
		$codeSnifferRunner = new CodeSnifferRunner(PropertiesMethodsMutualSpacingSniff::NAME);
30
31
		$fixedContent = $codeSnifferRunner->getFixedContent(__DIR__ . '/wrong.php');
32
		$this->assertSame(file_get_contents(__DIR__ . '/wrong-fixed.php'), $fixedContent);
33
34
		$fixedContent = $codeSnifferRunner->getFixedContent(__DIR__ . '/wrong2.php');
35
		$this->assertSame(file_get_contents(__DIR__ . '/wrong-fixed.php'), $fixedContent);
36
	}
37
38
}
39