Code Duplication    Length = 21-21 lines in 2 locations

test/functional/RequestFunctionalTest.php 2 locations

@@ 137-157 (lines=21) @@
134
        $this->assertEquals(null, $response->getRpcErrorData());
135
    }
136
137
    public function testFooAsyncRequest()
138
    {
139
        $id = 'abc';
140
        $method = 'foo';
141
        $request = $this->client->request($id, $method, []);
142
        $promise = $this->client->sendAsync($request);
143
144
        $promise->then(function ($response) use ($request, $id, $method) {
145
            $this->assertEquals(ClientInterface::SPEC, $request->getRpcVersion());
146
            $this->assertEquals($id, $request->getRpcId());
147
            $this->assertEquals($method, $request->getRpcMethod());
148
            $this->assertEquals(null, $request->getRpcParams());
149
150
            $this->assertEquals(ClientInterface::SPEC, $response->getRpcVersion());
151
            $this->assertEquals('foo', $response->getRpcResult());
152
            $this->assertEquals($id, $response->getRpcId());
153
            $this->assertEquals(null, $response->getRpcErrorCode());
154
            $this->assertEquals(null, $response->getRpcErrorMessage());
155
            $this->assertEquals(null, $response->getRpcErrorData());
156
        })->wait();
157
    }
158
159
    public function testBarRequest()
160
    {
@@ 179-199 (lines=21) @@
176
        $this->assertEquals(null, $response->getRpcErrorData());
177
    }
178
179
    public function testBarAsyncRequest()
180
    {
181
        $id = 'abc';
182
        $method = 'bar';
183
        $request = $this->client->request($id, $method, []);
184
        $promise = $this->client->sendAsync($request);
185
186
        $promise->then(function ($response) use ($request, $id, $method) {
187
            $this->assertEquals(ClientInterface::SPEC, $request->getRpcVersion());
188
            $this->assertEquals($id, $request->getRpcId());
189
            $this->assertEquals($method, $request->getRpcMethod());
190
            $this->assertEquals(null, $request->getRpcParams());
191
192
            $this->assertEquals(ClientInterface::SPEC, $response->getRpcVersion());
193
            $this->assertEquals(null, $response->getRpcResult());
194
            $this->assertEquals($id, $response->getRpcId());
195
            $this->assertTrue(is_int($response->getRpcErrorCode()));
196
            $this->assertTrue(is_string($response->getRpcErrorMessage()));
197
            $this->assertEquals(null, $response->getRpcErrorData());
198
        })->wait();
199
    }
200
201
    /**
202
     * @expectedException \Graze\GuzzleHttp\JsonRpc\Exception\ClientException