-
Notifications
You must be signed in to change notification settings - Fork 56
Expand file tree
/
Copy pathAssertSameWithCountRuleTest.php
More file actions
60 lines (52 loc) · 1.4 KB
/
AssertSameWithCountRuleTest.php
File metadata and controls
60 lines (52 loc) · 1.4 KB
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<?php declare(strict_types = 1);
namespace PHPStan\Rules\PHPUnit;
use PHPStan\Rules\Rule;
use PHPStan\Testing\RuleTestCase;
/**
* @extends RuleTestCase<AssertSameWithCountRule>
*/
class AssertSameWithCountRuleTest extends RuleTestCase
{
protected function getRule(): Rule
{
return new AssertSameWithCountRule();
}
public function testRule(): void
{
$this->analyse([__DIR__ . '/data/assert-same-count.php'], [
[
'You should use assertCount($expectedCount, $variable) instead of assertSame($expectedCount, count($variable)).',
10,
],
[
'You should use assertCount($expectedCount, $variable) instead of assertSame($expectedCount, count($variable)).',
22,
],
[
'You should use assertCount($expectedCount, $variable) instead of assertSame($expectedCount, $variable->count()).',
30,
],
[
'You should use assertCount($expectedCount, $variable) instead of assertSame($expectedCount, count($variable)).',
40,
],
[
'You should use assertCount($expectedCount, $variable) instead of assertSame($expectedCount, count($variable)).',
45,
],
]);
}
public function testFix(): void
{
$this->fix(__DIR__ . '/data/assert-same-count-fixable.php', __DIR__ . '/data/assert-same-count-fixable.php.fixed');
}
/**
* @return string[]
*/
public static function getAdditionalConfigFiles(): array
{
return [
__DIR__ . '/../../../extension.neon',
];
}
}