Code Duplication    Length = 22-22 lines in 2 locations

test/functional/RequestFunctionalTest.php 2 locations

@@ 54-75 (lines=22) @@
51
        $this->assertEquals(null, $response->getRpcErrorData());
52
    }
53
54
    public function testConcatAsyncRequest()
55
    {
56
        $id = 123;
57
        $method = 'concat';
58
        $params = ['foo'=>'abc', 'bar'=>'def'];
59
        $request = $this->client->request($id, $method, $params);
60
        $this->promise = $this->client->sendAsync($request);
61
62
        $this->promise->then(function ($response) use ($request, $id, $method, $params) {
63
            $this->assertEquals(ClientInterface::SPEC, $request->getRpcVersion());
64
            $this->assertEquals($id, $request->getRpcId());
65
            $this->assertEquals($method, $request->getRpcMethod());
66
            $this->assertEquals($params, $request->getRpcParams());
67
68
            $this->assertEquals(ClientInterface::SPEC, $response->getRpcVersion());
69
            $this->assertEquals(implode('', $params), $response->getRpcResult());
70
            $this->assertEquals($id, $response->getRpcId());
71
            $this->assertEquals(null, $response->getRpcErrorCode());
72
            $this->assertEquals(null, $response->getRpcErrorMessage());
73
            $this->assertEquals(null, $response->getRpcErrorData());
74
        });
75
    }
76
77
    public function testSumRequest()
78
    {
@@ 98-119 (lines=22) @@
95
        $this->assertEquals(null, $response->getRpcErrorData());
96
    }
97
98
    public function testSumAsyncRequest()
99
    {
100
        $id = 'abc';
101
        $method = 'sum';
102
        $params = ['foo'=>123, 'bar'=>456];
103
        $request = $this->client->request($id, $method, $params);
104
        $this->promise = $this->client->sendAsync($request);
105
106
        $this->promise->then(function ($response) use ($request, $id, $method, $params) {
107
            $this->assertEquals(ClientInterface::SPEC, $request->getRpcVersion());
108
            $this->assertEquals($id, $request->getRpcId());
109
            $this->assertEquals($method, $request->getRpcMethod());
110
            $this->assertEquals($params, $request->getRpcParams());
111
112
            $this->assertEquals(ClientInterface::SPEC, $response->getRpcVersion());
113
            $this->assertEquals(array_sum($params), $response->getRpcResult());
114
            $this->assertEquals($id, $response->getRpcId());
115
            $this->assertEquals(null, $response->getRpcErrorCode());
116
            $this->assertEquals(null, $response->getRpcErrorMessage());
117
            $this->assertEquals(null, $response->getRpcErrorData());
118
        });
119
    }
120
121
    public function testFooRequest()
122
    {