Code Duplication    Length = 10-15 lines in 6 locations

tests/CaptainHook/Hook/Message/BeamsTest.php 2 locations

@@ 45-55 (lines=11) @@
42
    /**
43
     * Tests Beams::execute
44
     */
45
    public function testExecute()
46
    {
47
        $io     = new NullIO();
48
        $config = new Config(HMU_PATH_FILES . '/captainhook.json');
49
        $action = new Config\Action('php', '\\CaptainHook\\App\\Hook\\Message\\Beams');
50
        $repo   = new Repository($this->repo->getPath());
51
        $repo->setCommitMsg(new CommitMessage('Foo bar baz'));
52
53
        $standard = new Beams();
54
        $standard->execute($config, $io, $repo, $action);
55
    }
56
57
    /**
58
     * Tests Beams::execute
@@ 62-72 (lines=11) @@
59
     *
60
     * @expectedException \Exception
61
     */
62
    public function testExecuteFail()
63
    {
64
        $io     = new NullIO();
65
        $config = new Config(HMU_PATH_FILES . '/captainhook.json');
66
        $action = new Config\Action('php', '\\CaptainHook\\App\\Hook\\Message\\Beams');
67
        $repo   = new Repository($this->repo->getPath());
68
        $repo->setCommitMsg(new CommitMessage('foo bar baz.'));
69
70
        $standard = new Beams();
71
        $standard->execute($config, $io, $repo, $action);
72
    }
73
}
74

tests/CaptainHook/Hook/Message/RulebookTest.php 4 locations

@@ 45-55 (lines=11) @@
42
    /**
43
     * Tests Rulebook::execute
44
     */
45
    public function testExecute()
46
    {
47
        $io     = new NullIO();
48
        $config = new Config(HMU_PATH_FILES . '/captainhook.json');
49
        $action = new Config\Action('php', '\\CaptainHook\\App\\Hook\\Message\\Beams');
50
        $repo   = new Repository($this->repo->getPath());
51
        $repo->setCommitMsg(new CommitMessage('Foo bar baz'));
52
53
        $standard = new Beams();
54
        $standard->execute($config, $io, $repo, $action);
55
    }
56
57
    /**
58
     * Tests Rulebook::execute
@@ 62-71 (lines=10) @@
59
     *
60
     * @expectedException \Exception
61
     */
62
    public function testExecuteClassNotFound()
63
    {
64
        $io     = new NullIO();
65
        $config = new Config(HMU_PATH_FILES . '/captainhook.json');
66
        $action = new Config\Action('php', '\\CaptainHook\\App\\Hook\\Message\\Rulebook', ['\\CaptainHook\\App\\Foo']);
67
        $repo   = new Repository($this->repo->getPath());
68
69
        $standard = new Rulebook();
70
        $standard->execute($config, $io, $repo, $action);
71
    }
72
73
    /**
74
     * Tests Rulebook::execute
@@ 78-91 (lines=14) @@
75
     *
76
     * @expectedException \Exception
77
     */
78
    public function testExecuteInvalidClass()
79
    {
80
        $io     = new NullIO();
81
        $config = new Config(HMU_PATH_FILES . '/captainhook.json');
82
        $action = new Config\Action(
83
            'php',
84
            '\\CaptainHook\\App\\Hook\\Message\\Rulebook',
85
            ['\\CaptainHook\\App\\Hook\\Message\\Validator']
86
        );
87
        $repo   = new Repository($this->repo->getPath());
88
89
        $standard = new Rulebook();
90
        $standard->execute($config, $io, $repo, $action);
91
    }
92
93
    /**
94
     * Tests Rulebook::execute
@@ 96-110 (lines=15) @@
93
    /**
94
     * Tests Rulebook::execute
95
     */
96
    public function testExecuteValidRule()
97
    {
98
        $io     = new NullIO();
99
        $config = new Config(HMU_PATH_FILES . '/captainhook.json');
100
        $action = new Config\Action(
101
            'php',
102
            '\\CaptainHook\\App\\Hook\\Message\\Rulebook',
103
            ['\\CaptainHook\\App\\Hook\\Message\\Validator\\Rule\\CapitalizeSubject']
104
        );
105
        $repo   = new Repository($this->repo->getPath());
106
        $repo->setCommitMsg(new CommitMessage('Foo bar baz'));
107
108
        $standard = new Rulebook();
109
        $standard->execute($config, $io, $repo, $action);
110
    }
111
}
112