Code Duplication    Length = 27-27 lines in 3 locations

tests/Cornford/Packtpublr/PacktpublrTest.php 3 locations

@@ 175-201 (lines=27) @@
172
        $this->assertTrue($instance->logout());
173
    }
174
175
    public function testRun()
176
    {
177
        $instance = new Packtpublr(['email' => '[email protected]', 'password' => 'Password123']);
178
179
        $client = Mockery::mock('GuzzleHttp\Client');
180
181
        $body = Mockery::mock('stdClass');
182
        $body->shouldReceive('__toString')->andReturn(self::BODY_STRING);
183
184
        $response = Mockery::mock('GuzzleHttp\Message\Response');
185
        $response->shouldReceive('getStatusCode')->andReturn(self::HTTP_RESPONSE_SUCCESS);
186
        $response->shouldReceive('getHeaders')->andReturn([]);
187
        $response->shouldReceive('getBody')->andReturn($body);
188
189
        $client->shouldReceive('get')->andReturn($response);
190
191
        $client->shouldReceive('post')->andReturn($response);
192
193
        $instance->setHttpClient($client);
194
195
        $consoleOutput = Mockery::mock('Symfony\Component\Console\Output\ConsoleOutput');
196
        $consoleOutput->shouldReceive('writeln')->andReturn(null);
197
198
        $instance->setConsoleOutput($consoleOutput);
199
200
        $this->assertTrue($instance->run());
201
    }
202
203
    /**
204
     * @outputBuffering enabled
@@ 206-232 (lines=27) @@
203
    /**
204
     * @outputBuffering enabled
205
     */
206
    public function testRunWithConsoleArgument()
207
    {
208
        $instance = new Packtpublr(['email' => '[email protected]', 'password' => 'Password123']);
209
210
        $client = Mockery::mock('GuzzleHttp\Client');
211
212
        $body = Mockery::mock('stdClass');
213
        $body->shouldReceive('__toString')->andReturn(self::BODY_STRING);
214
215
        $response = Mockery::mock('GuzzleHttp\Message\Response');
216
        $response->shouldReceive('getStatusCode')->andReturn(self::HTTP_RESPONSE_SUCCESS);
217
        $response->shouldReceive('getHeaders')->andReturn([]);
218
        $response->shouldReceive('getBody')->andReturn($body);
219
220
        $client->shouldReceive('get')->andReturn($response);
221
222
        $client->shouldReceive('post')->andReturn($response);
223
224
        $instance->setHttpClient($client);
225
226
        $consoleOutput = Mockery::mock('Symfony\Component\Console\Output\ConsoleOutput');
227
        $consoleOutput->shouldReceive('writeln')->andReturn(null);
228
229
        $instance->setConsoleOutput($consoleOutput);
230
231
        $this->assertTrue($instance->run());
232
    }
233
234
    public function testRunWithOptionalArguments()
235
    {
@@ 234-260 (lines=27) @@
231
        $this->assertTrue($instance->run());
232
    }
233
234
    public function testRunWithOptionalArguments()
235
    {
236
        $instance = new Packtpublr(['email' => '[email protected]', 'password' => 'Password123']);
237
238
        $client = Mockery::mock('GuzzleHttp\Client');
239
240
        $body = Mockery::mock('stdClass');
241
        $body->shouldReceive('__toString')->andReturn(self::BODY_STRING);
242
243
        $response = Mockery::mock('GuzzleHttp\Message\Response');
244
        $response->shouldReceive('getStatusCode')->andReturn(self::HTTP_RESPONSE_SUCCESS);
245
        $response->shouldReceive('getHeaders')->andReturn([]);
246
        $response->shouldReceive('getBody')->andReturn($body);
247
248
        $client->shouldReceive('get')->andReturn($response);
249
250
        $client->shouldReceive('post')->andReturn($response);
251
252
        $instance->setHttpClient($client);
253
254
        $consoleOutput = Mockery::mock('Symfony\Component\Console\Output\ConsoleOutput');
255
        $consoleOutput->shouldReceive('writeln')->andReturn(null);
256
257
        $instance->setConsoleOutput($consoleOutput);
258
259
        $this->assertTrue($instance->run('[email protected]', 'Password123'));
260
    }
261
262
    public function testSetAndGetHttpClient()
263
    {