Completed
Push — master ( c4513b...cc10a3 )
by Harry
03:02
created

RequestFactoryMiddlewareTest::testApplyResponse()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
/*
3
 * This file is part of Guzzle HTTP JSON-RPC
4
 *
5
 * Copyright (c) 2014 Nature Delivered Ltd. <http://graze.com>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 *
10
 * @see  http://github.com/graze/guzzle-jsonrpc/blob/master/LICENSE
11
 * @link http://github.com/graze/guzzle-jsonrpc
12
 */
13
namespace Graze\GuzzleHttp\JsonRpc\Middleware;
14
15
use Graze\GuzzleHttp\JsonRpc\Test\UnitTestCase;
16
17
class RequestFactoryMiddlewareTest extends UnitTestCase
18
{
19
    /** @var mixed */
20
    private $request;
21
    /** @var mixed */
22
    private $response;
23
    /** @var mixed */
24
    private $factory;
25
    /** @var RequestFactoryMiddleware */
26
    private $middleware;
27
28 View Code Duplication
    public function setUp()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
29
    {
30
        $this->request = $this->mockRequest();
31
        $this->response = $this->mockResponse();
32
        $this->factory = $this->mockMessageFactory();
33
34
        $this->middleware = new RequestFactoryMiddleware($this->factory);
35
    }
36
37 View Code Duplication
    public function testApplyRequest()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
38
    {
39
        $newRequest = clone $this->request;
40
        $this->factory->shouldReceive('fromRequest')->once()->with($this->request)->andReturn($newRequest);
41
42
        $this->assertSame($newRequest, $this->middleware->applyRequest($this->request, []));
43
    }
44
45
    public function testApplyResponse()
46
    {
47
        $this->assertSame($this->response, $this->middleware->applyResponse($this->request, $this->response, []));
48
    }
49
}
50