Passed
Push — master ( 7bee4d...457c92 )
by Sebastian
01:54
created

UseImperativeMoodTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 11
dl 0
loc 32
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testPass() 0 5 1
A passProvider() 0 9 1
1
<?php
2
/**
3
 * This file is part of CaptainHook.
4
 *
5
 * (c) Sebastian Feldmann <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
namespace CaptainHook\App\Hook\Message\Rule;
11
12
use SebastianFeldmann\Git\CommitMessage;
13
use PHPUnit\Framework\TestCase;
14
15
class UseImperativeMoodTest extends TestCase
16
{
17
    /**
18
     * Tests UseImperativeMood::pass
19
     *
20
     * @dataProvider passProvider
21
     *
22
     * @param string $string
23
     * @param bool   $begin
24
     * @param bool   $expectedResult
25
     */
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
    /**
34
     * The testPass data provider
35
     *
36
     * @return array
37
     */
38
    public function passProvider() : array
39
    {
40
        return [
41
            ['foo bar baz', true, true],
42
            ['foo bar baz', false, true],
43
            ['fixed soemthing something', false, false],
44
            ['fixed soemthing something', true, false],
45
            ['soemthing fixed something', false, false],
46
            ['soemthing fixed something', true, true],
47
        ];
48
    }
49
}
50