-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathDisallowDebugStaticCallRuleTest.php
More file actions
55 lines (50 loc) · 2 KB
/
DisallowDebugStaticCallRuleTest.php
File metadata and controls
55 lines (50 loc) · 2 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
<?php
declare(strict_types=1);
namespace CakeDC\PHPStan\Test\TestCase\Rule\Debug;
use CakeDC\PHPStan\Rule\Debug\DisallowDebugStaticCallRule;
use PHPStan\Rules\Rule;
use PHPStan\Testing\RuleTestCase;
class DisallowDebugStaticCallRuleTest extends RuleTestCase
{
/**
* @return \PHPStan\Rules\Rule
*/
protected function getRule(): Rule
{
return new DisallowDebugStaticCallRule();
}
/**
* @return void
*/
public function testRule(): void
{
// first argument: path to the example file that contains some errors that should be reported by MyRule
// second argument: an array of expected errors,
// each error consists of the asserted error message, and the asserted error file line
$this->analyse([__DIR__ . '/Fake/FailingDebugStaticUseLogic.php'], [
[
'Use of debug method "Cake\Error\Debugger::dump" is not allowed. The use in shipped code is discouraged because they can leak sensitive information or clutter output.',
16, // asserted error line
],
[
'Use of debug method "Cake\Error\Debugger::printVar" is not allowed. The use in shipped code is discouraged because they can leak sensitive information or clutter output.',
17, // asserted error line
],
[
'Use of debug method "DebugKit\DebugSql::sql" is not allowed. The use in shipped code is discouraged because they can leak sensitive information or clutter output.',
18, // asserted error line
],
[
'Use of debug method "DebugKit\DebugSql::sqld" is not allowed. The use in shipped code is discouraged because they can leak sensitive information or clutter output.',
19, // asserted error line
],
]);
}
/**
* @inheritDoc
*/
public static function getAdditionalConfigFiles(): array
{
return [__DIR__ . '/../../../../extension.neon'];
}
}