Code Duplication    Length = 23-23 lines in 3 locations

tests/Cornford/Packtpublr/PacktpublrTest.php 3 locations

@@ 286-308 (lines=23) @@
283
        $this->assertEquals($instance->getCookieSubscriber(), $cookie);
284
    }
285
286
    public function testGetResponseBody()
287
    {
288
        $instance = new Packtpublr(['email' => '[email protected]', 'password' => 'Password123']);
289
290
        $client = Mockery::mock('GuzzleHttp\Client');
291
292
        $body = Mockery::mock('stdClass');
293
        $body->shouldReceive('__toString')->andReturn(self::BODY_STRING);
294
295
        $response = Mockery::mock('GuzzleHttp\Message\Response');
296
        $response->shouldReceive('getStatusCode')->andReturn(self::HTTP_RESPONSE_SUCCESS);
297
        $response->shouldReceive('getHeaders')->andReturn([]);
298
        $response->shouldReceive('getBody')->andReturn($body);
299
300
        $client->shouldReceive('post')->andReturn($response);
301
        $client->shouldReceive('get')->andReturn($response);
302
303
        $instance->setHttpClient($client);
304
305
        $instance->redeem();
306
307
        $this->assertEquals($instance->getResponseBody(), self::BODY_STRING);
308
    }
309
310
    public function testGetResponseCode()
311
    {
@@ 310-332 (lines=23) @@
307
        $this->assertEquals($instance->getResponseBody(), self::BODY_STRING);
308
    }
309
310
    public function testGetResponseCode()
311
    {
312
        $instance = new Packtpublr(['email' => '[email protected]', 'password' => 'Password123']);
313
314
        $client = Mockery::mock('GuzzleHttp\Client');
315
316
        $body = Mockery::mock('stdClass');
317
        $body->shouldReceive('__toString')->andReturn(self::BODY_STRING);
318
319
        $response = Mockery::mock('GuzzleHttp\Message\Response');
320
        $response->shouldReceive('getStatusCode')->andReturn(self::HTTP_RESPONSE_SUCCESS);
321
        $response->shouldReceive('getHeaders')->andReturn([]);
322
        $response->shouldReceive('getBody')->andReturn($body);
323
324
        $client->shouldReceive('post')->andReturn($response);
325
        $client->shouldReceive('get')->andReturn($response);
326
327
        $instance->setHttpClient($client);
328
329
        $instance->redeem();
330
331
        $this->assertEquals($instance->getResponseCode(), self::HTTP_RESPONSE_SUCCESS);
332
    }
333
334
    public function testGetResponseHeaders()
335
    {
@@ 334-356 (lines=23) @@
331
        $this->assertEquals($instance->getResponseCode(), self::HTTP_RESPONSE_SUCCESS);
332
    }
333
334
    public function testGetResponseHeaders()
335
    {
336
        $instance = new Packtpublr(['email' => '[email protected]', 'password' => 'Password123']);
337
338
        $client = Mockery::mock('GuzzleHttp\Client');
339
340
        $body = Mockery::mock('stdClass');
341
        $body->shouldReceive('__toString')->andReturn(self::BODY_STRING);
342
343
        $response = Mockery::mock('GuzzleHttp\Message\Response');
344
        $response->shouldReceive('getStatusCode')->andReturn(self::HTTP_RESPONSE_SUCCESS);
345
        $response->shouldReceive('getHeaders')->andReturn(['Content-Type: text/html']);
346
        $response->shouldReceive('getBody')->andReturn($body);
347
348
        $client->shouldReceive('post')->andReturn($response);
349
        $client->shouldReceive('get')->andReturn($response);
350
351
        $instance->setHttpClient($client);
352
353
        $instance->redeem();
354
355
        $this->assertEquals($instance->getResponseHeaders(), ['Content-Type: text/html']);
356
    }
357
    
358
}