InBetweenMethodSpacingSniffTest::testDetection()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 8
Ratio 100 %

Importance

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