Code Duplication    Length = 7-12 lines in 10 locations

tests/unit/ConfigurationInjectionTest.php 3 locations

@@ 24-32 (lines=9) @@
21
        $this->runner = new \Robo\Runner('\Robo\RoboFileFixture');
22
    }
23
24
    public function testNoOptionsNoConfiguration()
25
    {
26
        // Run without any config and without any options
27
        $argv = ['placeholder', 'test:simple-list'];
28
        $result = $this->runner->execute($argv, null, null, $this->guy->capturedOutputStream());
29
30
        $this->guy->seeInOutput("a: '1'");
31
        $this->guy->seeInOutput("b: '2'");
32
    }
33
34
    public function testOptionsButNoConfiguration()
35
    {
@@ 34-42 (lines=9) @@
31
        $this->guy->seeInOutput("b: '2'");
32
    }
33
34
    public function testOptionsButNoConfiguration()
35
    {
36
        // Set one option, but provide no config
37
        $argv = ['placeholder', 'test:simple-list', '--b=3'];
38
        $result = $this->runner->execute($argv, null, null, $this->guy->capturedOutputStream());
39
40
        $this->guy->seeInOutput("a: '1'");
41
        $this->guy->seeInOutput("b: '3'");
42
    }
43
44
    public function testWithConfigurationButNoOptions()
45
    {
@@ 56-63 (lines=8) @@
53
        $this->guy->seeInOutput("b: '5'");
54
    }
55
56
    public function testHelpWithoutConfiguration()
57
    {
58
        $argv = ['placeholder', 'help', 'test:simple-list'];
59
        $result = $this->runner->execute($argv, null, null, $this->guy->capturedOutputStream());
60
61
        $this->guy->seeInOutput('[default: "1"]');
62
        $this->guy->seeInOutput('[default: "2"]');
63
    }
64
65
    public function testHelpWithConfigurationButNoOptions()
66
    {

tests/unit/RunnerTest.php 7 locations

@@ 69-80 (lines=12) @@
66
        $this->guy->seeInOutput('Some text in section one.');
67
    }
68
69
    public function testCommandEventHook()
70
    {
71
        $argv = ['placeholder', 'test:command-event'];
72
        $this->runner->execute($argv, null, null, $this->guy->capturedOutputStream());
73
74
        $expected = <<<EOT
75
 This is the command-event hook for the test:command-event command.
76
 This is the main method for the test:command-event command.
77
 This is the post-command hook for the test:command-event command.
78
EOT;
79
        $this->guy->seeInOutput($expected);
80
    }
81
82
    public function testCustomEventHook()
83
    {
@@ 82-89 (lines=8) @@
79
        $this->guy->seeInOutput($expected);
80
    }
81
82
    public function testCustomEventHook()
83
    {
84
        $argv = ['placeholder', 'test:custom-event'];
85
        $this->runner->execute($argv, null, null, $this->guy->capturedOutputStream());
86
87
        $expected = 'one,two';
88
        $this->guy->seeInOutput($expected);
89
    }
90
91
    public function testRoboStaticRunMethod()
92
    {
@@ 99-105 (lines=7) @@
96
        $this->guy->seeInOutput('Some text in section one.');
97
    }
98
99
    public function testDeploy()
100
    {
101
        $argv = ['placeholder', 'test:deploy', '--simulate'];
102
        $this->runner->execute($argv, null, null, $this->guy->capturedOutputStream());
103
        $this->guy->seeInOutput('[Simulator] Simulating Remote\\Ssh(\'mysite.com\', null)');
104
        $this->guy->seeInOutput('[Simulator] Running ssh mysite.com \'cd "/var/www/somesite" && git pull\'');
105
    }
106
107
    public function testRunnerTryError()
108
    {
@@ 107-114 (lines=8) @@
104
        $this->guy->seeInOutput('[Simulator] Running ssh mysite.com \'cd "/var/www/somesite" && git pull\'');
105
    }
106
107
    public function testRunnerTryError()
108
    {
109
        $argv = ['placeholder', 'test:error'];
110
        $result = $this->runner->execute($argv, null, null, $this->guy->capturedOutputStream());
111
112
        $this->guy->seeInOutput('[Exec] Running ls xyzzy');
113
        $this->assertTrue($result > 0);
114
    }
115
116
    public function testRunnerTrySimulatedError()
117
    {
@@ 116-123 (lines=8) @@
113
        $this->assertTrue($result > 0);
114
    }
115
116
    public function testRunnerTrySimulatedError()
117
    {
118
        $argv = ['placeholder', 'test:error', '--simulate'];
119
        $result = $this->runner->execute($argv, null, null, $this->guy->capturedOutputStream());
120
121
        $this->guy->seeInOutput('Simulating Exec');
122
        $this->assertEquals(0, $result);
123
    }
124
125
    public function testRunnerTryException()
126
    {
@@ 125-132 (lines=8) @@
122
        $this->assertEquals(0, $result);
123
    }
124
125
    public function testRunnerTryException()
126
    {
127
        $argv = ['placeholder', 'test:exception', '--task'];
128
        $result = $this->runner->execute($argv, null, null, $this->guy->capturedOutputStream());
129
130
        $this->guy->seeInOutput('Task failed with an exception');
131
        $this->assertEquals(1, $result);
132
    }
133
134
    public function testInitCommand()
135
    {
@@ 151-158 (lines=8) @@
148
        $this->assertContains('class RoboTestClass', $commandContents);
149
    }
150
151
    public function testTasksStopOnFail()
152
    {
153
        $argv = ['placeholder', 'test:stop-on-fail'];
154
        $result = $this->runner->execute($argv, null, null, $this->guy->capturedOutputStream());
155
156
        $this->guy->seeInOutput('[');
157
        $this->assertTrue($result > 0);
158
    }
159
160
    public function testInvalidRoboDirectory()
161
    {