BlacklistTest::testCaseInsensitiveHit()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 8
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
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 SebastianFeldmann\Git\CommitMessage;
15
use PHPUnit\Framework\TestCase;
16
17
class BlacklistTest extends TestCase
18
{
19
    public function testCaseInsensitiveHit(): void
20
    {
21
        $msg  = new CommitMessage('Foo bar baz' . PHP_EOL . PHP_EOL . 'Some Body text that is longer');
22
        $list = new Blacklist(false);
23
        $list->setBodyBlacklist(['body']);
24
        $list->setSubjectBlacklist(['Fiz']);
25
26
        $this->assertFalse($list->pass($msg));
27
    }
28
29
    public function testCaseSensitiveMiss(): void
30
    {
31
        $msg  = new CommitMessage('Foo bar baz' . PHP_EOL . PHP_EOL . 'Some Body text that is longer');
32
        $list = new Blacklist(true);
33
        $list->setBodyBlacklist(['body']);
34
        $list->setSubjectBlacklist(['Fiz']);
35
36
        $this->assertTrue($list->pass($msg));
37
    }
38
}
39