forked from phpstan/phpstan-phpunit
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAssertEqualsIsDiscouragedRuleTest.php
41 lines (34 loc) · 1.01 KB
/
AssertEqualsIsDiscouragedRuleTest.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
<?php declare(strict_types = 1);
namespace PHPStan\Rules\PHPUnit;
use PHPStan\Rules\Rule;
use PHPStan\Testing\RuleTestCase;
/**
* @extends RuleTestCase<AssertEqualsIsDiscouragedRule>
*/
final class AssertEqualsIsDiscouragedRuleTest extends RuleTestCase
{
private const ERROR_MESSAGE = 'You should use assertSame() instead of assertEquals(), because both values are scalars of the same type';
public function testRule(): void
{
$this->analyse([__DIR__ . '/data/assert-equals-is-discouraged.php'], [
[self::ERROR_MESSAGE, 19],
[self::ERROR_MESSAGE, 22],
[self::ERROR_MESSAGE, 23],
[self::ERROR_MESSAGE, 24],
[self::ERROR_MESSAGE, 25],
[self::ERROR_MESSAGE, 26],
[self::ERROR_MESSAGE, 27],
[self::ERROR_MESSAGE, 28],
[self::ERROR_MESSAGE, 29],
[self::ERROR_MESSAGE, 30],
[self::ERROR_MESSAGE, 32],
[self::ERROR_MESSAGE, 37],
[self::ERROR_MESSAGE, 38],
[self::ERROR_MESSAGE, 39],
]);
}
protected function getRule(): Rule
{
return new AssertEqualsIsDiscouragedRule();
}
}