@@ -81,6 +81,7 @@ public function testOpenApiSpecMatchesSnapshot() {
8181 * @throws TransportExceptionInterface
8282 */
8383 #[DataProvider('getCollectionEndpoints ' )]
84+ #[DataProvider('getCollectionEndpointsFiltered ' )]
8485 public function testGetCollectionMatchesStructure (Client $ client , string $ endpoint ) {
8586 $ response = $ client ->request ('GET ' , $ endpoint );
8687
@@ -116,7 +117,9 @@ public static function getCollectionEndpoints() {
116117 '/auth/reset_password ' => false ,
117118 '/auth/resend_activation ' => false ,
118119 '/content_nodes ' => false ,
120+ '/checklist_items ' => false ,
119121 '/invitations ' => false ,
122+ '/material_items ' => false ,
120123 '/personal_invitations ' => false ,
121124 '/token/refresh ' => false ,
122125 '/users ' => false ,
@@ -135,6 +138,26 @@ public static function getCollectionEndpoints() {
135138 return $ withUrlAsKey ;
136139 }
137140
141+ /**
142+ * @throws RedirectionExceptionInterface
143+ * @throws DecodingExceptionInterface
144+ * @throws ClientExceptionInterface
145+ * @throws TransportExceptionInterface
146+ * @throws ServerExceptionInterface
147+ */
148+ public static function getCollectionEndpointsFiltered () {
149+ static ::bootKernel ();
150+ $ client = static ::createClientWithCredentials ();
151+ $ client ->disableReboot ();
152+ $ response = $ client ->request ('GET ' , '/ ' );
153+
154+ return [
155+ [$ client , '/content_nodes?camp=/camps/ ' .self ::getFixtureFor ('/camps ' )->getId ()],
156+ [$ client , '/checklist_items?checklist=/checklists/ ' .self ::getFixtureFor ('/checklists ' )->getId ()],
157+ [$ client , '/material_items?camp=/camps/ ' .self ::getFixtureFor ('/camps ' )->getId ()],
158+ ];
159+ }
160+
138161 /**
139162 * @throws ClientExceptionInterface
140163 * @throws DecodingExceptionInterface
@@ -145,7 +168,7 @@ public static function getCollectionEndpoints() {
145168 #[DataProvider('getItemEndpoints ' )]
146169 public function testGetItemMatchesStructure (Client $ client , string $ endpoint ) {
147170 /** @var BaseEntity $fixtureFor */
148- $ fixtureFor = $ this -> getFixtureFor ($ endpoint );
171+ $ fixtureFor = self :: getFixtureFor ($ endpoint );
149172
150173 $ itemResponse = $ client ->request ('GET ' , "{$ endpoint }/ {$ fixtureFor ->getId ()}" );
151174
@@ -163,7 +186,6 @@ public function testGetItemMatchesStructure(Client $client, string $endpoint) {
163186 public static function getItemEndpoints () {
164187 return array_filter (self ::getCollectionEndpoints (), function (array $ endpoint ) {
165188 return match ($ endpoint [1 ]) {
166- '/content_nodes ' => false ,
167189 default => true ,
168190 };
169191 });
@@ -179,7 +201,7 @@ public static function getItemEndpoints() {
179201 #[DataProvider('getPatchEndpoints ' )]
180202 public function testPatchResponseMatchesGetItemResponse (Client $ client , string $ endpoint ) {
181203 /** @var BaseEntity $fixtureFor */
182- $ fixtureFor = $ this -> getFixtureFor ($ endpoint );
204+ $ fixtureFor = self :: getFixtureFor ($ endpoint );
183205
184206 $ itemResponse = $ client ->request ('GET ' , "{$ endpoint }/ {$ fixtureFor ->getId ()}" );
185207 assertThat ($ itemResponse ->getStatusCode (), equalTo (200 ));
@@ -238,7 +260,7 @@ public static function getPatchEndpoints() {
238260 #[TestWith(['/periods ' , '/days ' ], '/periods_{campId}_days ' )]
239261 #[TestWith(['/periods ' , '/schedule_entries ' ], '/periods_{campId}_schedule_entries ' )]
240262 public function testSubResourceUrlMatchesSnapshot (string $ endpoint , string $ subresource ) {
241- $ fixture = $ this -> getFixtureFor ($ endpoint );
263+ $ fixture = self :: getFixtureFor ($ endpoint );
242264 $ uri = "{$ endpoint }/ {$ fixture ->getId ()}{$ subresource }" ;
243265
244266 $ response = static ::createClientWithCredentials ()->request ('GET ' , $ uri );
@@ -247,7 +269,7 @@ public function testSubResourceUrlMatchesSnapshot(string $endpoint, string $subr
247269 $ this ->assertMatchesEscapedResponseSnapshot ($ response );
248270 }
249271
250- private function getFixtureFor (string $ collectionEndpoint ) {
272+ private static function getFixtureFor (string $ collectionEndpoint ) {
251273 $ fixtures = FixtureStore::getFixtures ();
252274
253275 return ReadItemFixtureMap::get ($ collectionEndpoint , $ fixtures );
0 commit comments