Code Duplication    Length = 9-10 lines in 4 locations

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

@@ 31-40 (lines=10) @@
28
     * @expectedException \IBM\Watson\Common\Exception\InsufficientPrivilegesException
29
     * @expectedExceptionMessage Not Authorized
30
     */
31
    public function testUnauthorized()
32
    {
33
        $this->httpClient->shouldReceive('sendRequest')->once()->andReturnUsing(function () {
34
            return new Response(401, [], '{"error":"Not Authorized"}');
35
        });
36
37
        $tone = new Tone($this->httpClient, $this->hydrator, $this->requestBuilder);
38
39
        $tone->analyze('text');
40
    }
41
42
    /**
43
     * @expectedException \IBM\Watson\Common\Exception\NotFoundException
@@ 46-54 (lines=9) @@
43
     * @expectedException \IBM\Watson\Common\Exception\NotFoundException
44
     * @expectedExceptionMessage Not Found
45
     */
46
    public function testNotFound()
47
    {
48
        $this->httpClient->shouldReceive('sendRequest')->once()->andReturnUsing(function () {
49
            return new Response(404, [], '{"error":"Not Found"}');
50
        });
51
52
        $tone = new Tone($this->httpClient, $this->hydrator, $this->requestBuilder);
53
        $tone->analyze('text');
54
    }
55
56
    /**
57
     * @expectedException \IBM\Watson\Common\Exception\UnknownErrorException
@@ 60-68 (lines=9) @@
57
     * @expectedException \IBM\Watson\Common\Exception\UnknownErrorException
58
     * @expectedExceptionMessage Unknown Error
59
     */
60
    public function testUnknownError()
61
    {
62
        $this->httpClient->shouldReceive('sendRequest')->once()->andReturnUsing(function () {
63
            return new Response(900, [], '{"error":"Unknown Error"}');
64
        });
65
66
        $tone = new Tone($this->httpClient, $this->hydrator, $this->requestBuilder);
67
        $tone->analyze('text');
68
    }
69
70
    public function testDocumentToneAnalysis()
71
    {

src/ToneAnalyzer/tests/Api/ToneChatTest.php 1 location

@@ 76-84 (lines=9) @@
73
    /**
74
     * @expectedException \IBM\Watson\Common\Exception\UnknownErrorException
75
     */
76
    public function testToneChatErrors()
77
    {
78
        $this->httpClient->shouldReceive('sendRequest')->once()->andReturnUsing(function () {
79
            return new Response(900, [], '{"error":"Unknown Error"}');
80
        });
81
82
        $toneChat = new ToneChat($this->httpClient, $this->hydrator, $this->requestBuilder);
83
        $toneChat->analyze('text');
84
    }
85
}