Code Duplication    Length = 14-14 lines in 5 locations

tests/CaptainHook/Runner/Action/CliTest.php 1 location

@@ 40-53 (lines=14) @@
37
     *
38
     * @expectedException \Exception
39
     */
40
    public function testExecuteFailure()
41
    {
42
        $config = $this->getConfigMock();
43
        $io     = $this->getIOMock();
44
        $repo   = $this->getRepositoryMock();
45
        $action = $this->getActionConfigMock();
46
47
        $cmd = HMU_PATH_FILES . '/bin/failure';
48
49
        $action->expects($this->once())->method('getAction')->willReturn($cmd);
50
51
        $cli = new Cli();
52
        $cli->execute($config, $io, $repo, $action);
53
    }
54
}
55

tests/CaptainHook/Runner/Action/PHPTest.php 4 locations

@@ 23-36 (lines=14) @@
20
    /**
21
     * Tests PHP::execute
22
     */
23
    public function testExecuteSuccess()
24
    {
25
        $config = $this->getConfigMock();
26
        $io     = $this->getIOMock();
27
        $repo   = $this->getRepositoryMock();
28
        $action = $this->getActionConfigMock();
29
30
        $class = '\\CaptainHook\\App\\Runner\\Action\\DummyPHPSuccess';
31
32
        $action->expects($this->once())->method('getAction')->willReturn($class);
33
34
        $php = new PHP();
35
        $php->execute($config, $io, $repo, $action);
36
    }
37
38
    /**
39
     * Tests PHP::execute
@@ 43-56 (lines=14) @@
40
     *
41
     * @expectedException \Exception
42
     */
43
    public function testExecuteFailure()
44
    {
45
        $config = $this->getConfigMock();
46
        $io     = $this->getIOMock();
47
        $repo   = $this->getRepositoryMock();
48
        $action = $this->getActionConfigMock();
49
50
        $class = '\\CaptainHook\\App\\Runner\\Action\\DummyPHPFailure';
51
52
        $action->expects($this->once())->method('getAction')->willReturn($class);
53
54
        $php = new PHP();
55
        $php->execute($config, $io, $repo, $action);
56
    }
57
58
    /**
59
     * Tests PHP::execute
@@ 63-76 (lines=14) @@
60
     *
61
     * @expectedException \Exception
62
     */
63
    public function testExecuteError()
64
    {
65
        $config = $this->getConfigMock();
66
        $io     = $this->getIOMock();
67
        $repo   = $this->getRepositoryMock();
68
        $action = $this->getActionConfigMock();
69
70
        $class = '\\CaptainHook\\App\\Runner\\Action\\DummyPHPError';
71
72
        $action->expects($this->once())->method('getAction')->willReturn($class);
73
74
        $php = new PHP();
75
        $php->execute($config, $io, $repo, $action);
76
    }
77
78
    /**
79
     * Tests PHP::execute
@@ 83-96 (lines=14) @@
80
     *
81
     * @expectedException \Exception
82
     */
83
    public function testExecuteNoAction()
84
    {
85
        $config = $this->getConfigMock();
86
        $io     = $this->getIOMock();
87
        $repo   = $this->getRepositoryMock();
88
        $action = $this->getActionConfigMock();
89
90
        $class = '\\CaptainHook\\App\\Runner\\Action\\DummyNoAction';
91
92
        $action->expects($this->once())->method('getAction')->willReturn($class);
93
94
        $php = new PHP();
95
        $php->execute($config, $io, $repo, $action);
96
    }
97
}
98
99
class DummyPHPSuccess implements ActionInterface