@@ -165,6 +165,8 @@ public function testLoadContentTypeGroupList()
165165 */
166166 public function testLoadContentTypeGroupListExcludesSystemByDefault (): void
167167 {
168+ $ systemIdentifier = $ this ->createSystemContentTypeGroup ();
169+
168170 $ response = $ this ->sendHttpRequest (
169171 $ this ->createHttpRequest (
170172 'GET ' ,
@@ -177,14 +179,16 @@ public function testLoadContentTypeGroupListExcludesSystemByDefault(): void
177179
178180 $ identifiers = $ this ->getContentTypeGroupIdentifiers ($ response );
179181
180- self ::assertNotContains (' system ' , $ identifiers );
182+ self ::assertNotContains ($ systemIdentifier , $ identifiers );
181183 }
182184
183185 /**
184186 * Covers GET /content/typegroups?includeSystem=true.
185187 */
186188 public function testLoadContentTypeGroupListIncludesSystemGroups (): void
187189 {
190+ $ systemIdentifier = $ this ->createSystemContentTypeGroup ();
191+
188192 $ response = $ this ->sendHttpRequest (
189193 $ this ->createHttpRequest (
190194 'GET ' ,
@@ -197,7 +201,7 @@ public function testLoadContentTypeGroupListIncludesSystemGroups(): void
197201
198202 $ identifiers = $ this ->getContentTypeGroupIdentifiers ($ response );
199203
200- self ::assertContains (' system ' , $ identifiers );
204+ self ::assertContains ($ systemIdentifier , $ identifiers );
201205 }
202206
203207 /**
@@ -213,6 +217,25 @@ public function testLoadContentTypeGroupListWithIdentifier()
213217 self ::assertHttpResponseCodeEquals ($ response , 307 );
214218 }
215219
220+ public function testCreateSystemContentTypeGroup (): void
221+ {
222+ $ identifier = $ this ->createSystemContentTypeGroup ();
223+
224+ $ response = $ this ->sendHttpRequest (
225+ $ this ->createHttpRequest (
226+ 'GET ' ,
227+ '/api/ibexa/v2/content/typegroups?includeSystem=true ' ,
228+ '' ,
229+ 'ContentTypeGroupList+json '
230+ )
231+ );
232+ self ::assertHttpResponseCodeEquals ($ response , 200 );
233+
234+ $ identifiers = $ this ->getContentTypeGroupIdentifiers ($ response );
235+
236+ self ::assertContains ($ identifier , $ identifiers );
237+ }
238+
216239 /**
217240 * @depends testUpdateContentTypeGroup
218241 * Covers GET /content/typegroups/<contentTypeGroupId>
@@ -734,6 +757,34 @@ static function (array $group): string {
734757 $ groupList
735758 );
736759 }
760+
761+ private function createSystemContentTypeGroup (): string
762+ {
763+ $ identifier = $ this ->addTestSuffix ('system_group_ ' . uniqid ());
764+ $ body = <<< XML
765+ <?xml version="1.0" encoding="UTF-8"?>
766+ <ContentTypeGroupInput>
767+ <identifier> {$ identifier }</identifier>
768+ <isSystem>true</isSystem>
769+ </ContentTypeGroupInput>
770+ XML ;
771+
772+ $ request = $ this ->createHttpRequest (
773+ 'POST ' ,
774+ '/api/ibexa/v2/content/typegroups ' ,
775+ 'ContentTypeGroupInput+xml ' ,
776+ 'ContentTypeGroup+json ' ,
777+ $ body
778+ );
779+
780+ $ response = $ this ->sendHttpRequest ($ request );
781+ self ::assertHttpResponseCodeEquals ($ response , 201 );
782+ self ::assertHttpResponseHasHeader ($ response , 'Location ' );
783+
784+ $ this ->addCreatedElement ($ response ->getHeader ('Location ' )[0 ]);
785+
786+ return $ identifier ;
787+ }
737788}
738789
739790class_alias (ContentTypeTest::class, 'EzSystems\EzPlatformRestBundle\Tests\Functional\ContentTypeTest ' );
0 commit comments