Code Duplication    Length = 7-12 lines in 9 locations

tests/unit/RunnerTest.php 9 locations

@@ 118-129 (lines=12) @@
115
        $this->guy->seeInOutput('Some text in section one.');
116
    }
117
118
    public function testCommandEventHook()
119
    {
120
        $argv = ['placeholder', 'test:command-event'];
121
        $this->runner->execute($argv, null, null, $this->guy->capturedOutputStream());
122
123
        $expected = <<<EOT
124
 This is the command-event hook for the test:command-event command.
125
 This is the main method for the test:command-event command.
126
 This is the post-command hook for the test:command-event command.
127
EOT;
128
        $this->guy->seeInOutput($expected);
129
    }
130
131
    public function testCustomEventHook()
132
    {
@@ 131-138 (lines=8) @@
128
        $this->guy->seeInOutput($expected);
129
    }
130
131
    public function testCustomEventHook()
132
    {
133
        $argv = ['placeholder', 'test:custom-event'];
134
        $this->runner->execute($argv, null, null, $this->guy->capturedOutputStream());
135
136
        $expected = 'one,two';
137
        $this->guy->seeInOutput($expected);
138
    }
139
140
    public function testRoboStaticRunMethod()
141
    {
@@ 148-154 (lines=7) @@
145
        $this->guy->seeInOutput('Some text in section one.');
146
    }
147
148
    public function testDeploy()
149
    {
150
        $argv = ['placeholder', 'test:deploy', '--simulate'];
151
        $this->runner->execute($argv, null, null, $this->guy->capturedOutputStream());
152
        $this->guy->seeInOutput('[Simulator] Simulating Remote\\Ssh(\'mysite.com\', null)');
153
        $this->guy->seeInOutput('[Simulator] Running ssh mysite.com \'cd "/var/www/somesite" && git pull\'');
154
    }
155
156
    public function testRunnerTryError()
157
    {
@@ 156-163 (lines=8) @@
153
        $this->guy->seeInOutput('[Simulator] Running ssh mysite.com \'cd "/var/www/somesite" && git pull\'');
154
    }
155
156
    public function testRunnerTryError()
157
    {
158
        $argv = ['placeholder', 'test:error'];
159
        $result = $this->runner->execute($argv, null, null, $this->guy->capturedOutputStream());
160
161
        $this->guy->seeInOutput('[Exec] Running ls xyzzy');
162
        $this->assertTrue($result > 0);
163
    }
164
165
    public function testRunnerTrySimulatedError()
166
    {
@@ 165-172 (lines=8) @@
162
        $this->assertTrue($result > 0);
163
    }
164
165
    public function testRunnerTrySimulatedError()
166
    {
167
        $argv = ['placeholder', 'test:error', '--simulate'];
168
        $result = $this->runner->execute($argv, null, null, $this->guy->capturedOutputStream());
169
170
        $this->guy->seeInOutput('Simulating Exec');
171
        $this->assertEquals(0, $result);
172
    }
173
174
    public function testRunnerTryException()
175
    {
@@ 174-181 (lines=8) @@
171
        $this->assertEquals(0, $result);
172
    }
173
174
    public function testRunnerTryException()
175
    {
176
        $argv = ['placeholder', 'test:exception', '--task'];
177
        $result = $this->runner->execute($argv, null, null, $this->guy->capturedOutputStream());
178
179
        $this->guy->seeInOutput('Task failed with an exception');
180
        $this->assertEquals(1, $result);
181
    }
182
183
    public function testInitCommand()
184
    {
@@ 200-207 (lines=8) @@
197
        $this->assertContains('class RoboTestClass', $commandContents);
198
    }
199
200
    public function testTasksStopOnFail()
201
    {
202
        $argv = ['placeholder', 'test:stop-on-fail'];
203
        $result = $this->runner->execute($argv, null, null, $this->guy->capturedOutputStream());
204
205
        $this->guy->seeInOutput('[');
206
        $this->assertTrue($result > 0);
207
    }
208
209
    public function testInvalidRoboDirectory()
210
    {
@@ 313-321 (lines=9) @@
310
        $this->assertEquals(0, $result);
311
    }
312
313
    public function testNoOptionsNoConfiguration()
314
    {
315
        // Run without any config and without any options
316
        $argv = ['placeholder', 'test:simple-list'];
317
        $result = $this->runner->execute($argv, null, null, $this->guy->capturedOutputStream());
318
319
        $this->guy->seeInOutput("a: '1'");
320
        $this->guy->seeInOutput("b: '2'");
321
    }
322
323
    public function testOptionsButNoConfiguration()
324
    {
@@ 323-331 (lines=9) @@
320
        $this->guy->seeInOutput("b: '2'");
321
    }
322
323
    public function testOptionsButNoConfiguration()
324
    {
325
        // Set one option, but provide no config
326
        $argv = ['placeholder', 'test:simple-list', '--b=3'];
327
        $result = $this->runner->execute($argv, null, null, $this->guy->capturedOutputStream());
328
329
        $this->guy->seeInOutput("a: '1'");
330
        $this->guy->seeInOutput("b: '3'");
331
    }
332
333
    public function testWithConfigurationButNoOptions()
334
    {