UseImperativeMoodTest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 12
dl 0
loc 24
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testPass() 0 6 1
A passProvider() 0 9 1
1
<?php
2
3
/**
4
 * This file is part of CaptainHook
5
 *
6
 * (c) Sebastian Feldmann <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace CaptainHook\App\Hook\Message\Rule;
13
14
use PHPUnit\Framework\Attributes\DataProvider;
0 ignored issues
show
Bug introduced by
The type PHPUnit\Framework\Attributes\DataProvider was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
15
use SebastianFeldmann\Git\CommitMessage;
16
use PHPUnit\Framework\TestCase;
17
18
class UseImperativeMoodTest extends TestCase
19
{
20
    /**
21
     * @param string $string
22
     * @param bool   $begin
23
     * @param bool   $expectedResult
24
     */
25
    #[DataProvider('passProvider')]
26
    public function testPass(string $string, bool $begin, bool $expectedResult): void
27
    {
28
        $msg  = new CommitMessage($string);
29
        $rule = new UseImperativeMood($begin);
30
        $this->assertSame($expectedResult, $rule->pass($msg));
31
    }
32
33
    public static function passProvider(): array
34
    {
35
        return [
36
            ['foo bar baz', true, true],
37
            ['foo bar baz', false, true],
38
            ['fixed soemthing something', false, false],
39
            ['fixed soemthing something', true, false],
40
            ['soemthing fixed something', false, false],
41
            ['soemthing fixed something', true, true],
42
        ];
43
    }
44
}
45