Code Duplication    Length = 16-17 lines in 5 locations

tests/JCRequestTest.php 5 locations

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