Code Duplication    Length = 16-16 lines in 5 locations

tests/JCRequestTest.php 5 locations

@@ 30-45 (lines=16) @@
27
        ];
28
    }
29
30
    public function testGet()
31
    {
32
        $url = $this->baseUrl . '/get?a=1';
33
34
        $response = JCRequest::get($url, $this->params, $this->headers);
35
        $this->assertEquals(200, $response->status());
36
37
        $responseData = json_decode($response->body());
38
        $this->assertEquals('https://httpbin.org/get?a=1&b=2&c=3', $responseData->url);
39
        $this->assertEquals(1, $responseData->args->a);
40
        $this->assertEquals(2, $responseData->args->b);
41
        $this->assertEquals(3, $responseData->args->c);
42
43
        $this->assertEquals('Jared Chu', $responseData->headers->{'User-Agent'});
44
        $this->assertEquals('application/json', $responseData->headers->{'Accept'});
45
    }
46
47
    public function testPost()
48
    {
@@ 47-62 (lines=16) @@
44
        $this->assertEquals('application/json', $responseData->headers->{'Accept'});
45
    }
46
47
    public function testPost()
48
    {
49
        $url = $this->baseUrl . '/post?a=1';
50
51
        $response = JCRequest::post($url, $this->params, $this->headers);
52
        $this->assertEquals(200, $response->status());
53
54
        $responseData = json_decode($response->body());
55
        $this->assertEquals('https://httpbin.org/post?a=1', $responseData->url);
56
        $this->assertEquals(1, $responseData->args->a);
57
        $this->assertEquals(2, $responseData->form->b);
58
        $this->assertEquals(3, $responseData->form->c);
59
60
        $this->assertEquals('Jared Chu', $responseData->headers->{'User-Agent'});
61
        $this->assertEquals('application/json', $responseData->headers->{'Accept'});
62
    }
63
64
    public function testPut()
65
    {
@@ 64-79 (lines=16) @@
61
        $this->assertEquals('application/json', $responseData->headers->{'Accept'});
62
    }
63
64
    public function testPut()
65
    {
66
        $url = $this->baseUrl . '/put?a=1';
67
68
        $response = JCRequest::put($url, $this->params, $this->headers);
69
        $this->assertEquals(200, $response->status());
70
71
        $responseData = json_decode($response->body());
72
        $this->assertEquals('https://httpbin.org/put?a=1', $responseData->url);
73
        $this->assertEquals(1, $responseData->args->a);
74
        $this->assertEquals(2, $responseData->form->b);
75
        $this->assertEquals(3, $responseData->form->c);
76
77
        $this->assertEquals('Jared Chu', $responseData->headers->{'User-Agent'});
78
        $this->assertEquals('application/json', $responseData->headers->{'Accept'});
79
    }
80
81
    public function testPatch()
82
    {
@@ 81-96 (lines=16) @@
78
        $this->assertEquals('application/json', $responseData->headers->{'Accept'});
79
    }
80
81
    public function testPatch()
82
    {
83
        $url = $this->baseUrl . '/patch?a=1';
84
85
        $response = JCRequest::patch($url, $this->params, $this->headers);
86
        $this->assertEquals(200, $response->status());
87
88
        $responseData = json_decode($response->body());
89
        $this->assertEquals('https://httpbin.org/patch?a=1', $responseData->url);
90
        $this->assertEquals(1, $responseData->args->a);
91
        $this->assertEquals(2, $responseData->form->b);
92
        $this->assertEquals(3, $responseData->form->c);
93
94
        $this->assertEquals('Jared Chu', $responseData->headers->{'User-Agent'});
95
        $this->assertEquals('application/json', $responseData->headers->{'Accept'});
96
    }
97
98
    public function testDelete()
99
    {
@@ 98-113 (lines=16) @@
95
        $this->assertEquals('application/json', $responseData->headers->{'Accept'});
96
    }
97
98
    public function testDelete()
99
    {
100
        $url = $this->baseUrl . '/delete?a=1';
101
102
        $response = JCRequest::delete($url, $this->params, $this->headers);
103
        $this->assertEquals(200, $response->status());
104
105
        $responseData = json_decode($response->body());
106
        $this->assertEquals('https://httpbin.org/delete?a=1', $responseData->url);
107
        $this->assertEquals(1, $responseData->args->a);
108
        $this->assertEquals(2, $responseData->form->b);
109
        $this->assertEquals(3, $responseData->form->c);
110
111
        $this->assertEquals('Jared Chu', $responseData->headers->{'User-Agent'});
112
        $this->assertEquals('application/json', $responseData->headers->{'Accept'});
113
    }
114
115
    public function testHead()
116
    {