Code Duplication    Length = 16-17 lines in 2 locations

src/ToneAnalyzer/tests/Api/ToneTest.php 2 locations

@@ 177-192 (lines=16) @@
174
        $this->assertNotEmpty($tones);
175
    }
176
177
    public function testAnalyzeHtml()
178
    {
179
        $rawResponse = '{"document_tone": {"tones": [{"score": 0.6165,"tone_id": "sadness","tone_name": "Sadness"}]}}';
180
181
        $this->httpClient->shouldReceive('sendRequest')->once()->andReturnUsing(function () use ($rawResponse) {
182
            return new Response(200, ['Content-Type' => 'application/json'], $rawResponse);
183
        });
184
185
        $tone = new Tone($this->httpClient, $this->hydrator, $this->requestBuilder);
186
187
        $response = $tone->analyze('<div>Some HTML to test</div>', ['is_html' => true]);
188
189
        $tones = $response->getDocumentAnalysis()->getTones();
190
191
        $this->assertNotEmpty($tones);
192
    }
193
194
    public function testAnalyzeJson()
195
    {
@@ 194-210 (lines=17) @@
191
        $this->assertNotEmpty($tones);
192
    }
193
194
    public function testAnalyzeJson()
195
    {
196
        $rawResponse = '{"document_tone": {"tones": [{"score": 0.6165,"tone_id": "sadness","tone_name": "Sadness"}]}}';
197
198
        $this->httpClient->shouldReceive('sendRequest')->once()->andReturnUsing(function () use ($rawResponse) {
199
            return new Response(200, ['Content-Type' => 'application/json'], $rawResponse);
200
        });
201
202
        $tone = new Tone($this->httpClient, $this->hydrator, $this->requestBuilder);
203
204
        $response = $tone->analyze('{"text": "Some text to analyze"}');
205
206
        $tones = $response->getDocumentAnalysis()->getTones();
207
208
        $this->assertNotEmpty($tones);
209
210
    }
211
}
212