-
Notifications
You must be signed in to change notification settings - Fork 0
/
DisallowOwnerPropertySniffTest.php
43 lines (37 loc) · 1.43 KB
/
DisallowOwnerPropertySniffTest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php
namespace Silverstripe\Sniffs\Extension;
use SlevomatCodingStandard\Sniffs\TestCase;
class DisallowOwnerPropertySniffTest extends TestCase
{
public function testNoErrors(): void
{
$report = self::checkFile(
__DIR__ . '/data/DisallowOwnerPropertySniff_NoErrors.php',
[],
[],
[
'--standard=' . __DIR__ . '/../../../src/ruleset.xml'
]
);
self::assertNoSniffErrorInFile($report);
}
public function testErrors(): void
{
$report = self::checkFile(
__DIR__ . '/data/DisallowOwnerPropertySniff_Errors.php',
[],
[],
[
'--standard=' . __DIR__ . '/../../../src/ruleset.xml'
]
);
self::assertSame(6, $report->getErrorCount());
self::assertSniffError($report, 11, DisallowOwnerPropertySniff::CODE_OWNER_PROPERTY);
self::assertSniffError($report, 13, DisallowOwnerPropertySniff::CODE_OWNER_PROPERTY);
self::assertSniffError($report, 25, DisallowOwnerPropertySniff::CODE_OWNER_PROPERTY);
self::assertSniffError($report, 27, DisallowOwnerPropertySniff::CODE_OWNER_PROPERTY);
self::assertSniffError($report, 39, DisallowOwnerPropertySniff::CODE_OWNER_PROPERTY);
self::assertSniffError($report, 41, DisallowOwnerPropertySniff::CODE_OWNER_PROPERTY);
self::assertAllFixedInFile($report);
}
}