Passed
Push — master ( 813fe9...62056b )
by Sebastian
06:01
created

testPassSuccessWithBody()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 6
rs 9.4285
cc 1
eloc 4
nc 1
nop 0
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\Validator\Rule;
11
12
use CaptainHook\App\Git\CommitMessage;
13
14
class SeparateSubjectFromBodyWithBlankLineTest extends \PHPUnit_Framework_TestCase
15
{
16
    /**
17
     * Tests SeparateSubjectFromBodyWithBlankLine::pass
18
     */
19
    public function testPassSuccessOnSubjectOnly()
20
    {
21
        $msg  = new CommitMessage('Foo bar');
22
        $rule = new SeparateSubjectFromBodyWithBlankLine();
23
        $this->assertTrue($rule->pass($msg));
24
    }
25
26
    /**
27
     * Tests SeparateSubjectFromBodyWithBlankLine::pass
28
     */
29
    public function testPassSuccessWithBody()
30
    {
31
        $msg  = new CommitMessage('Foo bar' . PHP_EOL . PHP_EOL . 'Foo Bar Baz.');
32
        $rule = new SeparateSubjectFromBodyWithBlankLine();
33
        $this->assertTrue($rule->pass($msg));
34
    }
35
36
    /**
37
     * Tests SeparateSubjectFromBodyWithBlankLine::pass
38
     */
39
    public function testPassFailNoEmptyLine()
40
    {
41
        $msg  = new CommitMessage('Foo bar' . PHP_EOL . 'Foo Bar Baz.');
42
        $rule = new SeparateSubjectFromBodyWithBlankLine();
43
        $this->assertFalse($rule->pass($msg));
44
    }
45
}
46