-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCommandClassShouldBeHelpCommandHandlerClassTest.php
More file actions
59 lines (51 loc) · 1.82 KB
/
CommandClassShouldBeHelpCommandHandlerClassTest.php
File metadata and controls
59 lines (51 loc) · 1.82 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
<?php
declare(strict_types=1);
namespace Simtel\PHPStanRules\Tests\Rules;
use PHPStan\PhpDocParser\Lexer\Lexer;
use PHPStan\PhpDocParser\Parser\ConstExprParser;
use PHPStan\PhpDocParser\Parser\PhpDocParser;
use PHPStan\PhpDocParser\Parser\TypeParser;
use PHPStan\PhpDocParser\ParserConfig;
use PHPStan\Rules\Rule;
use PHPStan\Testing\RuleTestCase;
use Simtel\PHPStanRules\Rule\CommandClassShouldBeHelpCommandHandlerClass;
class CommandClassShouldBeHelpCommandHandlerClassTest extends RuleTestCase
{
/**
* @inheritDoc
*/
protected function getRule(): Rule
{
$config = new ParserConfig(usedAttributes: []);
$constExprParser = new ConstExprParser($config);
return new CommandClassShouldBeHelpCommandHandlerClass(
new PhpDocParser($config, new TypeParser($config, $constExprParser), $constExprParser),
new Lexer($config)
);
}
public function testCorrectSeeAttribute(): void
{
$this->analyse([__DIR__ . '/../data/command_handler_data1.php'], [
[
'PhpDoc command class should be include @see attribute with CommandHandler class name, but include TestClassCommand',
10
]
]);
}
public function testExistsSeeAttribute(): void
{
$this->analyse([__DIR__ . '/../data/command_handler_data2.php'], [
['PhpDoc command class should be include @see attribute with CommandHandler class name', 10]
]);
}
public function testExistsPhpDoc(): void
{
$this->analyse([__DIR__ . '/../data/command_handler_data3.php'], [
['Command class should be include phpDoc with @see attribute', 7]
]);
}
public function testIfExistInvokeMethod(): void
{
$this->analyse([__DIR__ . '/../data/command_handler_data4.php'], []);
}
}