1313
1414class BookmarkTest extends RESTFunctionalTestCase
1515{
16+ /**
17+ * @throws \Psr\Http\Client\ClientExceptionInterface
18+ */
1619 public function testCreateBookmark (): int
1720 {
1821 $ content = $ this ->createFolder (__FUNCTION__ , '/api/ibexa/v2/content/locations/1/2 ' );
@@ -28,13 +31,15 @@ public function testCreateBookmark(): int
2831
2932 $ response = $ this ->sendHttpRequest ($ request );
3033
31- self :: assertHttpResponseCodeEquals ($ response , Response::HTTP_CREATED );
34+ $ this -> assertHttpResponseCodeEquals ($ response , Response::HTTP_CREATED );
3235
3336 return $ locationId ;
3437 }
3538
3639 /**
3740 * @depends testCreateBookmark
41+ *
42+ * @throws \Psr\Http\Client\ClientExceptionInterface
3843 */
3944 public function testCreateBookmarkIfAlreadyExists (int $ locationId ): void
4045 {
@@ -45,11 +50,13 @@ public function testCreateBookmarkIfAlreadyExists(int $locationId): void
4550
4651 $ response = $ this ->sendHttpRequest ($ request );
4752
48- self :: assertHttpResponseCodeEquals ($ response , Response::HTTP_CONFLICT );
53+ $ this -> assertHttpResponseCodeEquals ($ response , Response::HTTP_CONFLICT );
4954 }
5055
5156 /**
5257 * @depends testCreateBookmark
58+ *
59+ * @throws \Psr\Http\Client\ClientExceptionInterface
5360 */
5461 public function testIsBookmarked (int $ locationId ): void
5562 {
@@ -60,27 +67,32 @@ public function testIsBookmarked(int $locationId): void
6067
6168 $ response = $ this ->sendHttpRequest ($ request );
6269
63- self :: assertHttpResponseCodeEquals ($ response , Response::HTTP_OK );
70+ $ this -> assertHttpResponseCodeEquals ($ response , Response::HTTP_OK );
6471 }
6572
66- public function testIsBookmarkedReturnsNotFound (): void
73+ /**
74+ * @depends testDeleteBookmark
75+ *
76+ * @throws \Psr\Http\Client\ClientExceptionInterface
77+ */
78+ public function testIsBookmarkedReturnsNotFound (int $ locationId ): void
6779 {
68- $ locationId = 43 ;
69-
7080 $ request = $ this ->createHttpRequest (
7181 'HEAD ' ,
7282 '/api/ibexa/v2/bookmark/ ' . $ locationId
7383 );
7484
7585 $ response = $ this ->sendHttpRequest ($ request );
7686
77- self :: assertHttpResponseCodeEquals ($ response , Response::HTTP_NOT_FOUND );
87+ $ this -> assertHttpResponseCodeEquals ($ response , Response::HTTP_NOT_FOUND );
7888 }
7989
8090 /**
8191 * @depends testCreateBookmark
92+ *
93+ * @throws \Psr\Http\Client\ClientExceptionInterface
8294 */
83- public function testDeleteBookmark (int $ locationId ): void
95+ public function testDeleteBookmark (int $ locationId ): int
8496 {
8597 $ request = $ this ->createHttpRequest (
8698 'DELETE ' ,
@@ -89,9 +101,14 @@ public function testDeleteBookmark(int $locationId): void
89101
90102 $ response = $ this ->sendHttpRequest ($ request );
91103
92- self ::assertHttpResponseCodeEquals ($ response , Response::HTTP_NO_CONTENT );
104+ $ this ->assertHttpResponseCodeEquals ($ response , Response::HTTP_NO_CONTENT );
105+
106+ return $ locationId ;
93107 }
94108
109+ /**
110+ * @throws \Psr\Http\Client\ClientExceptionInterface
111+ */
95112 public function testLoadBookmarks (): void
96113 {
97114 $ request = $ this ->createHttpRequest (
@@ -103,20 +120,23 @@ public function testLoadBookmarks(): void
103120
104121 $ response = $ this ->sendHttpRequest ($ request );
105122
106- self :: assertHttpResponseCodeEquals ($ response , Response::HTTP_OK );
123+ $ this -> assertHttpResponseCodeEquals ($ response , Response::HTTP_OK );
107124 }
108125
109- public function testDeleteBookmarkReturnNotFound (): void
126+ /**
127+ * @depends testDeleteBookmark
128+ *
129+ * @throws \Psr\Http\Client\ClientExceptionInterface
130+ */
131+ public function testDeleteBookmarkReturnNotFound (int $ locationId ): void
110132 {
111- $ locationId = 43 ;
112-
113133 $ request = $ this ->createHttpRequest (
114134 'DELETE ' ,
115135 '/api/ibexa/v2/bookmark/ ' . $ locationId
116136 );
117137
118138 $ response = $ this ->sendHttpRequest ($ request );
119139
120- self :: assertHttpResponseCodeEquals ($ response , Response::HTTP_NOT_FOUND );
140+ $ this -> assertHttpResponseCodeEquals ($ response , Response::HTTP_NOT_FOUND );
121141 }
122142}
0 commit comments