Code Duplication    Length = 10-12 lines in 4 locations

eZ/Bundle/EzPublishRestBundle/Tests/Functional/ContentTest.php 2 locations

@@ 261-271 (lines=11) @@
258
     *
259
     * @return string the ID of the created version (/content/objects/<contentId>/versions/<versionNumber>
260
     */
261
    public function testCreateDraftFromCurrentVersion($restContentHref)
262
    {
263
        $response = $this->sendHttpRequest(
264
            $this->createHttpRequest('COPY', "$restContentHref/currentversion")
265
        );
266
267
        self::assertHttpResponseCodeEquals($response, 201);
268
        self::assertHttpResponseHasHeader($response, 'Location');
269
270
        return $response->getHeader('Location')[0];
271
    }
272
273
    /**
274
     * @depends testCreateDraftFromCurrentVersion
@@ 793-804 (lines=12) @@
790
     *
791
     * @return string Content Version Draft REST resource link
792
     */
793
    private function createDraftFromVersion($restContentVersionHref)
794
    {
795
        $response = $this->sendHttpRequest(
796
            $this->createHttpRequest('COPY', $restContentVersionHref)
797
        );
798
        self::assertHttpResponseCodeEquals($response, 201);
799
800
        $href = $response->getHeader('Location')[0];
801
        self::assertNotEmpty($href);
802
803
        return $href;
804
    }
805
806
    /**
807
     * Publish Content Version Draft given by REST resource link.

eZ/Bundle/EzPublishRestBundle/Tests/Functional/LocationTest.php 1 location

@@ 86-97 (lines=12) @@
83
     * @depends testCreateLocation
84
     * Covers GET /content/locations?urlAlias=<Path/To-Content>
85
     */
86
    public function testRedirectLocationByURLAlias($locationHref)
87
    {
88
        $testUrlAlias = 'firstPart/secondPart/testUrlAlias';
89
        $this->createUrlAlias($locationHref, $testUrlAlias);
90
91
        $response = $this->sendHttpRequest(
92
            $this->createHttpRequest('GET', "/api/ezp/v2/content/locations?urlAlias={$testUrlAlias}")
93
        );
94
95
        self::assertHttpResponseCodeEquals($response, 307);
96
        self::assertHttpResponseHasHeader($response, 'Location', $locationHref);
97
    }
98
99
    /**
100
     * @depends testCreateLocation

eZ/Bundle/EzPublishRestBundle/Tests/Functional/TestCase.php 1 location

@@ 363-372 (lines=10) @@
360
     *
361
     * @return array
362
     */
363
    protected function getContentLocations($contentHref)
364
    {
365
        $response = $this->sendHttpRequest(
366
            $this->createHttpRequest('GET', "$contentHref/locations", '', 'LocationList+json')
367
        );
368
        self::assertHttpResponseCodeEquals($response, 200);
369
        $folderLocations = json_decode($response->getBody(), true);
370
371
        return $folderLocations;
372
    }
373
374
    protected function addTestSuffix($string)
375
    {