| @@ 53-61 (lines=9) @@ | ||
| 50 | * @depends testCreateLocation |
|
| 51 | * Covers GET /content/locations?remoteId=<locationRemoteId> |
|
| 52 | */ |
|
| 53 | public function testRedirectLocationByRemoteId($locationHref) |
|
| 54 | { |
|
| 55 | $response = $this->sendHttpRequest( |
|
| 56 | $this->createHttpRequest('GET', '/api/ezp/v2/content/locations?remoteId=' . $this->addTestSuffix('testCreateLocation')) |
|
| 57 | ); |
|
| 58 | ||
| 59 | self::assertHttpResponseCodeEquals($response, 307); |
|
| 60 | self::assertHttpResponseHasHeader($response, 'Location', $locationHref); |
|
| 61 | } |
|
| 62 | ||
| 63 | /** |
|
| 64 | * @depends testCreateLocation |
|
| @@ 229-237 (lines=9) @@ | ||
| 226 | * @depends testCreateUser |
|
| 227 | * Covers GET /user/users?remoteId={userRemoteId} |
|
| 228 | */ |
|
| 229 | public function testLoadUserByRemoteId() |
|
| 230 | { |
|
| 231 | $remoteId = $this->addTestSuffix('testCreateUser'); |
|
| 232 | $response = $this->sendHttpRequest( |
|
| 233 | $this->createHttpRequest('GET', "/api/ezp/v2/user/users?remoteId=$remoteId") |
|
| 234 | ); |
|
| 235 | ||
| 236 | self::assertHttpResponseCodeEquals($response, 200); |
|
| 237 | } |
|
| 238 | ||
| 239 | /** |
|
| 240 | * Covers GET /user/groups. |
|
| @@ 255-263 (lines=9) @@ | ||
| 252 | * @depends testCreateUserGroup |
|
| 253 | * Covers GET /user/groups?remoteId={groupRemoteId} |
|
| 254 | */ |
|
| 255 | public function testLoadUserGroupByRemoteId($groupHref) |
|
| 256 | { |
|
| 257 | $remoteId = $this->addTestSuffix('testCreateUserGroup'); |
|
| 258 | $response = $this->sendHttpRequest( |
|
| 259 | $this->createHttpRequest('GET', "/api/ezp/v2/user/groups?remoteId=$remoteId") |
|
| 260 | ); |
|
| 261 | ||
| 262 | self::assertHttpResponseCodeEquals($response, 200); |
|
| 263 | } |
|
| 264 | ||
| 265 | /** |
|
| 266 | * Covers GET /user/users/{userId}/drafts. |
|
| @@ 21-27 (lines=7) @@ | ||
| 18 | parent::setUp(); |
|
| 19 | } |
|
| 20 | ||
| 21 | public function testCreateSessionBadCredentials() |
|
| 22 | { |
|
| 23 | $request = $this->createHttpRequest('POST', '/api/ezp/v2/user/sessions', 'SessionInput+json', 'Session+json'); |
|
| 24 | $this->setSessionInput($request, 'badpassword'); |
|
| 25 | $response = $this->sendHttpRequest($request); |
|
| 26 | self::assertHttpResponseCodeEquals($response, 401); |
|
| 27 | } |
|
| 28 | ||
| 29 | /** |
|
| 30 | * @return \stdClass The login request's response |
|
| @@ 83-91 (lines=9) @@ | ||
| 80 | * @depends testPublishContent |
|
| 81 | * Covers GET /content/objects?remoteId=<remoteId> |
|
| 82 | */ |
|
| 83 | public function testRedirectContent($restContentHref) |
|
| 84 | { |
|
| 85 | $response = $this->sendHttpRequest( |
|
| 86 | $this->createHttpRequest('GET', '/api/ezp/v2/content/objects?remoteId=' . $this->addTestSuffix('testCreateContent')) |
|
| 87 | ); |
|
| 88 | ||
| 89 | self::assertHttpResponseCodeEquals($response, 307); |
|
| 90 | self::assertEquals($response->getHeader('Location'), $restContentHref); |
|
| 91 | } |
|
| 92 | ||
| 93 | /** |
|
| 94 | * @depends testPublishContent |
|
| @@ 132-142 (lines=11) @@ | ||
| 129 | * |
|
| 130 | * @return string ContentVersion REST ID |
|
| 131 | */ |
|
| 132 | public function testCreateDraftFromVersion($restContentHref) |
|
| 133 | { |
|
| 134 | $response = $this->sendHttpRequest( |
|
| 135 | $this->createHttpRequest('COPY', "{$restContentHref}/versions/1") |
|
| 136 | ); |
|
| 137 | ||
| 138 | self::assertHttpResponseCodeEquals($response, 201); |
|
| 139 | self::assertEquals($response->getHeader('Location'), "{$restContentHref}/versions/2"); |
|
| 140 | ||
| 141 | return $response->getHeader('Location'); |
|
| 142 | } |
|
| 143 | ||
| 144 | /** |
|
| 145 | * @depends testPublishContent |
|
| @@ 235-245 (lines=11) @@ | ||
| 232 | * |
|
| 233 | * @return string the ID of the created version (/content/objects/<contentId>/versions/<versionNumber> |
|
| 234 | */ |
|
| 235 | public function testCreateDraftFromCurrentVersion($restContentHref) |
|
| 236 | { |
|
| 237 | $response = $this->sendHttpRequest( |
|
| 238 | $this->createHttpRequest('COPY', "$restContentHref/currentversion") |
|
| 239 | ); |
|
| 240 | ||
| 241 | self::assertHttpResponseCodeEquals($response, 201); |
|
| 242 | self::assertHttpResponseHasHeader($response, 'Location'); |
|
| 243 | ||
| 244 | return $response->getHeader('Location'); |
|
| 245 | } |
|
| 246 | ||
| 247 | /** |
|
| 248 | * @depends testCreateDraftFromCurrentVersion |
|