SuccessTest   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 9
c 1
b 0
f 0
dl 0
loc 17
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A testPreCommitSuccess() 0 15 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\Integration\PreCommit;
13
14
use CaptainHook\App\Integration\IntegrationTestCase;
15
16
class SuccessTest extends IntegrationTestCase
17
{
18
    public function testPreCommitSuccess(): void
19
    {
20
        $repoPath = $this->setUpRepository();
21
22
        $this->enableHook($repoPath, 'pre-commit', [
23
            ['action' => 'echo "test action placeholder {$STAGED_FILES|of-type:html}" > html.log']
24
        ]);
25
26
        $this->filesystem()->touch($repoPath . '/foo.html');
27
        $this->mustRunInShell(['git', 'add', 'foo.html'], $repoPath);
28
        $this->mustRunInShell(['git', 'commit', '-m', 'Test successful pre-commit execution'], $repoPath);
29
30
        $log = file_get_contents($repoPath . '/html.log');
31
32
        $this->assertStringContainsString("foo.html", $log);
33
    }
34
}
35