Code Duplication    Length = 9-11 lines in 5 locations

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

@@ 134-144 (lines=11) @@
131
     *
132
     * @return string ContentVersion REST ID
133
     */
134
    public function testCreateDraftFromVersion($restContentHref)
135
    {
136
        $response = $this->sendHttpRequest(
137
            $this->createHttpRequest('COPY', "{$restContentHref}/versions/1")
138
        );
139
140
        self::assertHttpResponseCodeEquals($response, 201);
141
        self::assertEquals($response->getHeader('Location'), "{$restContentHref}/versions/2");
142
143
        return $response->getHeader('Location');
144
    }
145
146
    /**
147
     * @depends testPublishContent
@@ 237-247 (lines=11) @@
234
     *
235
     * @return string the ID of the created version (/content/objects/<contentId>/versions/<versionNumber>
236
     */
237
    public function testCreateDraftFromCurrentVersion($restContentHref)
238
    {
239
        $response = $this->sendHttpRequest(
240
            $this->createHttpRequest('COPY', "$restContentHref/currentversion")
241
        );
242
243
        self::assertHttpResponseCodeEquals($response, 201);
244
        self::assertHttpResponseHasHeader($response, 'Location');
245
246
        return $response->getHeader('Location');
247
    }
248
249
    /**
250
     * @depends testCreateDraftFromCurrentVersion

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

@@ 116-124 (lines=9) @@
113
     * @covers MOVE /content/locations/{locationPath}
114
     * @depends testCopySubtree
115
     */
116
    public function testMoveSubtree($locationHref)
117
    {
118
        $request = $this->createHttpRequest('MOVE', $locationHref);
119
        $request->addHeader('Destination: /api/ezp/v2/content/locations/1/5');
120
        $response = $this->sendHttpRequest($request);
121
122
        self::assertHttpResponseCodeEquals($response, 201);
123
        self::assertHttpResponseHasHeader($response, 'Location');
124
    }
125
126
    /**
127
     * @depends testCreateLocation

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

@@ 201-210 (lines=10) @@
198
     *
199
     * @return array
200
     */
201
    protected function getContentLocations($contentHref)
202
    {
203
        $response = $this->sendHttpRequest(
204
            $this->createHttpRequest('GET', "$contentHref/locations", '', 'LocationList+json')
205
        );
206
        self::assertHttpResponseCodeEquals($response, 200);
207
        $folderLocations = json_decode($response->getContent(), true);
208
209
        return $folderLocations;
210
    }
211
212
    protected function addTestSuffix($string)
213
    {

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

@@ 548-558 (lines=11) @@
545
     * @covers DELETE /user/roles/{roleId}/draft
546
     * @depends testCreateRoleDraft
547
     */
548
    public function testDeleteRoleDraft($roleHref)
549
    {
550
        // we need to create a role draft first since we published the previous one in testPublishRoleDraft
551
        $roleDraftHref = $this->testCreateRoleDraft(str_replace('/draft', '', $roleHref));
552
553
        $response = $this->sendHttpRequest(
554
            $this->createHttpRequest('DELETE', $roleDraftHref)
555
        );
556
557
        self::assertHttpResponseCodeEquals($response, 204);
558
    }
559
}
560