BlockPropertyCommentSniffTest::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\Commenting\BlockPropertyComment;
6
7
use PHPUnit\Framework\TestCase;
8
use Zenify\CodingStandard\Tests\CodeSnifferRunner;
9
use ZenifyCodingStandard\Sniffs\Commenting\BlockPropertyCommentSniff;
10
11
12
/**
13
 * @covers \ZenifyCodingStandard\Sniffs\Commenting\BlockPropertyCommentSniff
14
 */
15
final class BlockPropertyCommentSniffTest extends TestCase
16
{
17
18 View Code Duplication
	public function testDetection()
19
	{
20
		$codeSnifferRunner = new CodeSnifferRunner(BlockPropertyCommentSniff::NAME);
21
22
		$this->assertSame(0, $codeSnifferRunner->getErrorCountInFile(__DIR__ . '/correct.php'));
23
		$this->assertSame(0, $codeSnifferRunner->getErrorCountInFile(__DIR__ . '/correct2.php'));
24
		$this->assertSame(1, $codeSnifferRunner->getErrorCountInFile(__DIR__ . '/wrong.php'));
25
	}
26
27
28
	public function testFixing()
29
	{
30
		$codeSnifferRunner = new CodeSnifferRunner('ZenifyCodingStandard.Commenting.BlockPropertyComment');
31
32
		$fixedContent = $codeSnifferRunner->getFixedContent(__DIR__ . '/wrong.php');
33
		$this->assertSame(file_get_contents(__DIR__ . '/wrong-fixed.php'), $fixedContent);
34
	}
35
36
}
37