| @@ 38-47 (lines=10) @@ | ||
| 35 | /** |
|
| 36 | * @depends testCreateBookmark |
|
| 37 | */ |
|
| 38 | public function testCreateBookmarkIfAlreadyExists(int $locationId): void |
|
| 39 | { |
|
| 40 | $request = $this->createHttpRequest( |
|
| 41 | 'POST', '/api/ezp/v2/bookmark/' . $locationId |
|
| 42 | ); |
|
| 43 | ||
| 44 | $response = $this->sendHttpRequest($request); |
|
| 45 | ||
| 46 | self::assertHttpResponseCodeEquals($response, Response::HTTP_CONFLICT); |
|
| 47 | } |
|
| 48 | ||
| 49 | /** |
|
| 50 | * @depends testCreateBookmark |
|
| @@ 52-61 (lines=10) @@ | ||
| 49 | /** |
|
| 50 | * @depends testCreateBookmark |
|
| 51 | */ |
|
| 52 | public function testIsBookmarked(int $locationId): void |
|
| 53 | { |
|
| 54 | $request = $this->createHttpRequest( |
|
| 55 | 'HEAD', '/api/ezp/v2/bookmark/' . $locationId |
|
| 56 | ); |
|
| 57 | ||
| 58 | $response = $this->sendHttpRequest($request); |
|
| 59 | ||
| 60 | self::assertHttpResponseCodeEquals($response, Response::HTTP_OK); |
|
| 61 | } |
|
| 62 | ||
| 63 | public function testIsBookmarkedReturnsNotFound(): void |
|
| 64 | { |
|
| @@ 63-74 (lines=12) @@ | ||
| 60 | self::assertHttpResponseCodeEquals($response, Response::HTTP_OK); |
|
| 61 | } |
|
| 62 | ||
| 63 | public function testIsBookmarkedReturnsNotFound(): void |
|
| 64 | { |
|
| 65 | $locationId = 43; |
|
| 66 | ||
| 67 | $request = $this->createHttpRequest( |
|
| 68 | 'HEAD', '/api/ezp/v2/bookmark/' . $locationId |
|
| 69 | ); |
|
| 70 | ||
| 71 | $response = $this->sendHttpRequest($request); |
|
| 72 | ||
| 73 | self::assertHttpResponseCodeEquals($response, Response::HTTP_NOT_FOUND); |
|
| 74 | } |
|
| 75 | ||
| 76 | /** |
|
| 77 | * @depends testCreateBookmark |
|
| @@ 79-88 (lines=10) @@ | ||
| 76 | /** |
|
| 77 | * @depends testCreateBookmark |
|
| 78 | */ |
|
| 79 | public function testDeleteBookmark(int $locationId): void |
|
| 80 | { |
|
| 81 | $request = $this->createHttpRequest( |
|
| 82 | 'DELETE', '/api/ezp/v2/bookmark/' . $locationId |
|
| 83 | ); |
|
| 84 | ||
| 85 | $response = $this->sendHttpRequest($request); |
|
| 86 | ||
| 87 | self::assertHttpResponseCodeEquals($response, Response::HTTP_NO_CONTENT); |
|
| 88 | } |
|
| 89 | ||
| 90 | public function testLoadBookmarks(): void |
|
| 91 | { |
|
| @@ 90-102 (lines=13) @@ | ||
| 87 | self::assertHttpResponseCodeEquals($response, Response::HTTP_NO_CONTENT); |
|
| 88 | } |
|
| 89 | ||
| 90 | public function testLoadBookmarks(): void |
|
| 91 | { |
|
| 92 | $request = $this->createHttpRequest( |
|
| 93 | 'GET', |
|
| 94 | '/api/ezp/v2/bookmark?offset=1&limit=100', |
|
| 95 | 'BookmarkList+xml', |
|
| 96 | 'BookmarkList+xml' |
|
| 97 | ); |
|
| 98 | ||
| 99 | $response = $this->sendHttpRequest($request); |
|
| 100 | ||
| 101 | self::assertHttpResponseCodeEquals($response, Response::HTTP_OK); |
|
| 102 | } |
|
| 103 | ||
| 104 | public function testDeleteBookmarkReturnNotFound(): void |
|
| 105 | { |
|
| @@ 104-115 (lines=12) @@ | ||
| 101 | self::assertHttpResponseCodeEquals($response, Response::HTTP_OK); |
|
| 102 | } |
|
| 103 | ||
| 104 | public function testDeleteBookmarkReturnNotFound(): void |
|
| 105 | { |
|
| 106 | $locationId = 43; |
|
| 107 | ||
| 108 | $request = $this->createHttpRequest( |
|
| 109 | 'DELETE', '/api/ezp/v2/bookmark/' . $locationId |
|
| 110 | ); |
|
| 111 | ||
| 112 | $response = $this->sendHttpRequest($request); |
|
| 113 | ||
| 114 | self::assertHttpResponseCodeEquals($response, Response::HTTP_NOT_FOUND); |
|
| 115 | } |
|
| 116 | } |
|
| 117 | ||