Code Duplication    Length = 12-13 lines in 2 locations

tests/unit/RestfulServerTest.php 2 locations

@@ 241-252 (lines=12) @@
238
        unset($_SERVER['PHP_AUTH_PW']);
239
    }
240
241
    public function testPostWithoutBodyReturnsNoContent()
242
    {
243
        $_SERVER['PHP_AUTH_USER'] = '[email protected]';
244
        $_SERVER['PHP_AUTH_PW'] = 'editor';
245
246
        $url = "{$this->baseURI}/api/v1/" . RestfulServerTestComment::class;
247
        $response = Director::test($url, null, null, 'POST');
248
249
        $this->assertEquals('No Content', $response->getBody());
250
251
        unset($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']);
252
    }
253
254
    public function testPUTwithJSON()
255
    {
@@ 336-348 (lines=13) @@
333
        $this->assertEquals('application/json', $response->getHeader('Content-Type'));
334
    }
335
336
    public function testNotFound()
337
    {
338
        $_SERVER['PHP_AUTH_USER'] = '[email protected]';
339
        $_SERVER['PHP_AUTH_PW'] = 'user';
340
341
        $urlSafeClassname = $this->urlSafeClassname(RestfulServerTestComment::class);
342
        $url = "{$this->baseURI}/api/v1/$urlSafeClassname/99";
343
        $response = Director::test($url, null, null, 'GET');
344
        $this->assertEquals(404, $response->getStatusCode());
345
346
        unset($_SERVER['PHP_AUTH_USER']);
347
        unset($_SERVER['PHP_AUTH_PW']);
348
    }
349
350
    public function testMethodNotAllowed()
351
    {