diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 192db119..2804d8f6 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -9620,156 +9620,6 @@ parameters: count: 1 path: tests/lib/Server/Output/ValueObjectVisitor/ResourceCreatedTest.php - - - message: "#^Method Ibexa\\\\Tests\\\\Rest\\\\Server\\\\Output\\\\ValueObjectVisitor\\\\RestContentTest\\:\\:getBasicRestContent\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/Server/Output/ValueObjectVisitor/RestContentTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Rest\\\\Server\\\\Output\\\\ValueObjectVisitor\\\\RestContentTest\\:\\:testAlwaysAvailableCorrect\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/Server/Output/ValueObjectVisitor/RestContentTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Rest\\\\Server\\\\Output\\\\ValueObjectVisitor\\\\RestContentTest\\:\\:testContentHrefCorrect\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/Server/Output/ValueObjectVisitor/RestContentTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Rest\\\\Server\\\\Output\\\\ValueObjectVisitor\\\\RestContentTest\\:\\:testContentIdCorrect\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/Server/Output/ValueObjectVisitor/RestContentTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Rest\\\\Server\\\\Output\\\\ValueObjectVisitor\\\\RestContentTest\\:\\:testContentMediaTypeWithVersionCorrect\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/Server/Output/ValueObjectVisitor/RestContentTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Rest\\\\Server\\\\Output\\\\ValueObjectVisitor\\\\RestContentTest\\:\\:testContentMediaTypeWithoutVersionCorrect\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/Server/Output/ValueObjectVisitor/RestContentTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Rest\\\\Server\\\\Output\\\\ValueObjectVisitor\\\\RestContentTest\\:\\:testContentRemoteIdCorrect\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/Server/Output/ValueObjectVisitor/RestContentTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Rest\\\\Server\\\\Output\\\\ValueObjectVisitor\\\\RestContentTest\\:\\:testContentTypeHrefCorrect\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/Server/Output/ValueObjectVisitor/RestContentTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Rest\\\\Server\\\\Output\\\\ValueObjectVisitor\\\\RestContentTest\\:\\:testContentTypeMediaTypeCorrect\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/Server/Output/ValueObjectVisitor/RestContentTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Rest\\\\Server\\\\Output\\\\ValueObjectVisitor\\\\RestContentTest\\:\\:testCurrentVersionHrefCorrect\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/Server/Output/ValueObjectVisitor/RestContentTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Rest\\\\Server\\\\Output\\\\ValueObjectVisitor\\\\RestContentTest\\:\\:testCurrentVersionMediaTypeCorrect\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/Server/Output/ValueObjectVisitor/RestContentTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Rest\\\\Server\\\\Output\\\\ValueObjectVisitor\\\\RestContentTest\\:\\:testCurrentVersionNoCorrect\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/Server/Output/ValueObjectVisitor/RestContentTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Rest\\\\Server\\\\Output\\\\ValueObjectVisitor\\\\RestContentTest\\:\\:testEmbeddedCurrentVersionHrefCorrect\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/Server/Output/ValueObjectVisitor/RestContentTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Rest\\\\Server\\\\Output\\\\ValueObjectVisitor\\\\RestContentTest\\:\\:testEmbeddedCurrentVersionMediaTypeCorrect\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/Server/Output/ValueObjectVisitor/RestContentTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Rest\\\\Server\\\\Output\\\\ValueObjectVisitor\\\\RestContentTest\\:\\:testIsHiddenCorrect\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/Server/Output/ValueObjectVisitor/RestContentTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Rest\\\\Server\\\\Output\\\\ValueObjectVisitor\\\\RestContentTest\\:\\:testLastModificationDateCorrect\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/Server/Output/ValueObjectVisitor/RestContentTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Rest\\\\Server\\\\Output\\\\ValueObjectVisitor\\\\RestContentTest\\:\\:testLocationsHrefCorrect\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/Server/Output/ValueObjectVisitor/RestContentTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Rest\\\\Server\\\\Output\\\\ValueObjectVisitor\\\\RestContentTest\\:\\:testLocationsMediaTypeCorrect\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/Server/Output/ValueObjectVisitor/RestContentTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Rest\\\\Server\\\\Output\\\\ValueObjectVisitor\\\\RestContentTest\\:\\:testMainLanguageCodeCorrect\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/Server/Output/ValueObjectVisitor/RestContentTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Rest\\\\Server\\\\Output\\\\ValueObjectVisitor\\\\RestContentTest\\:\\:testMainLocationHrefCorrect\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/Server/Output/ValueObjectVisitor/RestContentTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Rest\\\\Server\\\\Output\\\\ValueObjectVisitor\\\\RestContentTest\\:\\:testMainLocationMediaTypeCorrect\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/Server/Output/ValueObjectVisitor/RestContentTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Rest\\\\Server\\\\Output\\\\ValueObjectVisitor\\\\RestContentTest\\:\\:testNameCorrect\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/Server/Output/ValueObjectVisitor/RestContentTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Rest\\\\Server\\\\Output\\\\ValueObjectVisitor\\\\RestContentTest\\:\\:testOwnerHrefCorrect\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/Server/Output/ValueObjectVisitor/RestContentTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Rest\\\\Server\\\\Output\\\\ValueObjectVisitor\\\\RestContentTest\\:\\:testOwnerMediaTypeCorrect\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/Server/Output/ValueObjectVisitor/RestContentTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Rest\\\\Server\\\\Output\\\\ValueObjectVisitor\\\\RestContentTest\\:\\:testSectionHrefCorrect\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/Server/Output/ValueObjectVisitor/RestContentTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Rest\\\\Server\\\\Output\\\\ValueObjectVisitor\\\\RestContentTest\\:\\:testSectionMediaTypeCorrect\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/Server/Output/ValueObjectVisitor/RestContentTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Rest\\\\Server\\\\Output\\\\ValueObjectVisitor\\\\RestContentTest\\:\\:testStatusCorrect\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/Server/Output/ValueObjectVisitor/RestContentTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Rest\\\\Server\\\\Output\\\\ValueObjectVisitor\\\\RestContentTest\\:\\:testTranslatedNameCorrect\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/Server/Output/ValueObjectVisitor/RestContentTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Rest\\\\Server\\\\Output\\\\ValueObjectVisitor\\\\RestContentTest\\:\\:testVersionsHrefCorrect\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/Server/Output/ValueObjectVisitor/RestContentTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Rest\\\\Server\\\\Output\\\\ValueObjectVisitor\\\\RestContentTest\\:\\:testVersionsMediaTypeCorrect\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/Server/Output/ValueObjectVisitor/RestContentTest.php - - message: "#^Method Ibexa\\\\Tests\\\\Rest\\\\Server\\\\Output\\\\ValueObjectVisitor\\\\RestContentTypeTest\\:\\:getBasicContentType\\(\\) has no return type specified\\.$#" count: 1 @@ -10325,151 +10175,6 @@ parameters: count: 1 path: tests/lib/Server/Output/ValueObjectVisitor/RestUserGroupRoleAssignmentTest.php - - - message: "#^Method Ibexa\\\\Tests\\\\Rest\\\\Server\\\\Output\\\\ValueObjectVisitor\\\\RestUserGroupTest\\:\\:getBasicRestUserGroup\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/Server/Output/ValueObjectVisitor/RestUserGroupTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Rest\\\\Server\\\\Output\\\\ValueObjectVisitor\\\\RestUserGroupTest\\:\\:testAlwaysAvailableCorrect\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/Server/Output/ValueObjectVisitor/RestUserGroupTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Rest\\\\Server\\\\Output\\\\ValueObjectVisitor\\\\RestUserGroupTest\\:\\:testLastModificationDateCorrect\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/Server/Output/ValueObjectVisitor/RestUserGroupTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Rest\\\\Server\\\\Output\\\\ValueObjectVisitor\\\\RestUserGroupTest\\:\\:testLocationsHrefCorrect\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/Server/Output/ValueObjectVisitor/RestUserGroupTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Rest\\\\Server\\\\Output\\\\ValueObjectVisitor\\\\RestUserGroupTest\\:\\:testLocationsMediaTypeCorrect\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/Server/Output/ValueObjectVisitor/RestUserGroupTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Rest\\\\Server\\\\Output\\\\ValueObjectVisitor\\\\RestUserGroupTest\\:\\:testMainLanguageCodeCorrect\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/Server/Output/ValueObjectVisitor/RestUserGroupTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Rest\\\\Server\\\\Output\\\\ValueObjectVisitor\\\\RestUserGroupTest\\:\\:testMainLocationHrefCorrect\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/Server/Output/ValueObjectVisitor/RestUserGroupTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Rest\\\\Server\\\\Output\\\\ValueObjectVisitor\\\\RestUserGroupTest\\:\\:testMainLocationMediaTypeCorrect\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/Server/Output/ValueObjectVisitor/RestUserGroupTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Rest\\\\Server\\\\Output\\\\ValueObjectVisitor\\\\RestUserGroupTest\\:\\:testNameCorrect\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/Server/Output/ValueObjectVisitor/RestUserGroupTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Rest\\\\Server\\\\Output\\\\ValueObjectVisitor\\\\RestUserGroupTest\\:\\:testOwnerHrefCorrect\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/Server/Output/ValueObjectVisitor/RestUserGroupTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Rest\\\\Server\\\\Output\\\\ValueObjectVisitor\\\\RestUserGroupTest\\:\\:testOwnerMediaTypeCorrect\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/Server/Output/ValueObjectVisitor/RestUserGroupTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Rest\\\\Server\\\\Output\\\\ValueObjectVisitor\\\\RestUserGroupTest\\:\\:testParentUserGroupHrefCorrect\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/Server/Output/ValueObjectVisitor/RestUserGroupTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Rest\\\\Server\\\\Output\\\\ValueObjectVisitor\\\\RestUserGroupTest\\:\\:testParentUserGroupMediaTypeCorrect\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/Server/Output/ValueObjectVisitor/RestUserGroupTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Rest\\\\Server\\\\Output\\\\ValueObjectVisitor\\\\RestUserGroupTest\\:\\:testRolesHrefCorrect\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/Server/Output/ValueObjectVisitor/RestUserGroupTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Rest\\\\Server\\\\Output\\\\ValueObjectVisitor\\\\RestUserGroupTest\\:\\:testRolesMediaTypeCorrect\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/Server/Output/ValueObjectVisitor/RestUserGroupTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Rest\\\\Server\\\\Output\\\\ValueObjectVisitor\\\\RestUserGroupTest\\:\\:testSectionHrefCorrect\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/Server/Output/ValueObjectVisitor/RestUserGroupTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Rest\\\\Server\\\\Output\\\\ValueObjectVisitor\\\\RestUserGroupTest\\:\\:testSectionMediaTypeCorrect\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/Server/Output/ValueObjectVisitor/RestUserGroupTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Rest\\\\Server\\\\Output\\\\ValueObjectVisitor\\\\RestUserGroupTest\\:\\:testSubgroupsHrefCorrect\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/Server/Output/ValueObjectVisitor/RestUserGroupTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Rest\\\\Server\\\\Output\\\\ValueObjectVisitor\\\\RestUserGroupTest\\:\\:testSubgroupsMediaTypeCorrect\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/Server/Output/ValueObjectVisitor/RestUserGroupTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Rest\\\\Server\\\\Output\\\\ValueObjectVisitor\\\\RestUserGroupTest\\:\\:testUserGroupHrefCorrect\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/Server/Output/ValueObjectVisitor/RestUserGroupTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Rest\\\\Server\\\\Output\\\\ValueObjectVisitor\\\\RestUserGroupTest\\:\\:testUserGroupIdCorrect\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/Server/Output/ValueObjectVisitor/RestUserGroupTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Rest\\\\Server\\\\Output\\\\ValueObjectVisitor\\\\RestUserGroupTest\\:\\:testUserGroupMediaTypeWithoutVersionCorrect\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/Server/Output/ValueObjectVisitor/RestUserGroupTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Rest\\\\Server\\\\Output\\\\ValueObjectVisitor\\\\RestUserGroupTest\\:\\:testUserGroupRemoteIdCorrect\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/Server/Output/ValueObjectVisitor/RestUserGroupTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Rest\\\\Server\\\\Output\\\\ValueObjectVisitor\\\\RestUserGroupTest\\:\\:testUserGroupTypeHrefCorrect\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/Server/Output/ValueObjectVisitor/RestUserGroupTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Rest\\\\Server\\\\Output\\\\ValueObjectVisitor\\\\RestUserGroupTest\\:\\:testUserGroupTypeMediaTypeCorrect\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/Server/Output/ValueObjectVisitor/RestUserGroupTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Rest\\\\Server\\\\Output\\\\ValueObjectVisitor\\\\RestUserGroupTest\\:\\:testUsersHrefCorrect\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/Server/Output/ValueObjectVisitor/RestUserGroupTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Rest\\\\Server\\\\Output\\\\ValueObjectVisitor\\\\RestUserGroupTest\\:\\:testUsersMediaTypeCorrect\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/Server/Output/ValueObjectVisitor/RestUserGroupTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Rest\\\\Server\\\\Output\\\\ValueObjectVisitor\\\\RestUserGroupTest\\:\\:testVersionsHrefCorrect\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/Server/Output/ValueObjectVisitor/RestUserGroupTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Rest\\\\Server\\\\Output\\\\ValueObjectVisitor\\\\RestUserGroupTest\\:\\:testVersionsMediaTypeCorrect\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/Server/Output/ValueObjectVisitor/RestUserGroupTest.php - - message: "#^Method Ibexa\\\\Tests\\\\Rest\\\\Output\\\\ValueObjectVisitorBaseTest\\:\\:assertXMLTag\\(\\) invoked with 4 parameters, 2\\-3 required\\.$#" count: 4 @@ -10495,131 +10200,11 @@ parameters: count: 1 path: tests/lib/Server/Output/ValueObjectVisitor/RestUserRoleAssignmentTest.php - - - message: "#^Method Ibexa\\\\Tests\\\\Rest\\\\Server\\\\Output\\\\ValueObjectVisitor\\\\RestUserTest\\:\\:getBasicRestUser\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/Server/Output/ValueObjectVisitor/RestUserTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Rest\\\\Server\\\\Output\\\\ValueObjectVisitor\\\\RestUserTest\\:\\:testAlwaysAvailableCorrect\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/Server/Output/ValueObjectVisitor/RestUserTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Rest\\\\Server\\\\Output\\\\ValueObjectVisitor\\\\RestUserTest\\:\\:testLastModificationDateCorrect\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/Server/Output/ValueObjectVisitor/RestUserTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Rest\\\\Server\\\\Output\\\\ValueObjectVisitor\\\\RestUserTest\\:\\:testLocationsHrefCorrect\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/Server/Output/ValueObjectVisitor/RestUserTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Rest\\\\Server\\\\Output\\\\ValueObjectVisitor\\\\RestUserTest\\:\\:testLocationsMediaTypeCorrect\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/Server/Output/ValueObjectVisitor/RestUserTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Rest\\\\Server\\\\Output\\\\ValueObjectVisitor\\\\RestUserTest\\:\\:testMainLanguageCodeCorrect\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/Server/Output/ValueObjectVisitor/RestUserTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Rest\\\\Server\\\\Output\\\\ValueObjectVisitor\\\\RestUserTest\\:\\:testMainLocationHrefCorrect\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/Server/Output/ValueObjectVisitor/RestUserTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Rest\\\\Server\\\\Output\\\\ValueObjectVisitor\\\\RestUserTest\\:\\:testMainLocationMediaTypeCorrect\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/Server/Output/ValueObjectVisitor/RestUserTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Rest\\\\Server\\\\Output\\\\ValueObjectVisitor\\\\RestUserTest\\:\\:testNameCorrect\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/Server/Output/ValueObjectVisitor/RestUserTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Rest\\\\Server\\\\Output\\\\ValueObjectVisitor\\\\RestUserTest\\:\\:testOwnerHrefCorrect\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/Server/Output/ValueObjectVisitor/RestUserTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Rest\\\\Server\\\\Output\\\\ValueObjectVisitor\\\\RestUserTest\\:\\:testOwnerMediaTypeCorrect\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/Server/Output/ValueObjectVisitor/RestUserTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Rest\\\\Server\\\\Output\\\\ValueObjectVisitor\\\\RestUserTest\\:\\:testRolesHrefCorrect\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/Server/Output/ValueObjectVisitor/RestUserTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Rest\\\\Server\\\\Output\\\\ValueObjectVisitor\\\\RestUserTest\\:\\:testRolesMediaTypeCorrect\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/Server/Output/ValueObjectVisitor/RestUserTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Rest\\\\Server\\\\Output\\\\ValueObjectVisitor\\\\RestUserTest\\:\\:testSectionHrefCorrect\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/Server/Output/ValueObjectVisitor/RestUserTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Rest\\\\Server\\\\Output\\\\ValueObjectVisitor\\\\RestUserTest\\:\\:testSectionMediaTypeCorrect\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/Server/Output/ValueObjectVisitor/RestUserTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Rest\\\\Server\\\\Output\\\\ValueObjectVisitor\\\\RestUserTest\\:\\:testUserGroupsHrefCorrect\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/Server/Output/ValueObjectVisitor/RestUserTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Rest\\\\Server\\\\Output\\\\ValueObjectVisitor\\\\RestUserTest\\:\\:testUserGroupsMediaTypeCorrect\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/Server/Output/ValueObjectVisitor/RestUserTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Rest\\\\Server\\\\Output\\\\ValueObjectVisitor\\\\RestUserTest\\:\\:testUserHrefCorrect\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/Server/Output/ValueObjectVisitor/RestUserTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Rest\\\\Server\\\\Output\\\\ValueObjectVisitor\\\\RestUserTest\\:\\:testUserIdCorrect\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/Server/Output/ValueObjectVisitor/RestUserTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Rest\\\\Server\\\\Output\\\\ValueObjectVisitor\\\\RestUserTest\\:\\:testUserMediaTypeWithoutVersionCorrect\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/Server/Output/ValueObjectVisitor/RestUserTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Rest\\\\Server\\\\Output\\\\ValueObjectVisitor\\\\RestUserTest\\:\\:testUserRemoteIdCorrect\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/Server/Output/ValueObjectVisitor/RestUserTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Rest\\\\Server\\\\Output\\\\ValueObjectVisitor\\\\RestUserTest\\:\\:testUserTypeHrefCorrect\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/Server/Output/ValueObjectVisitor/RestUserTest.php - - message: "#^Method Ibexa\\\\Tests\\\\Rest\\\\Server\\\\Output\\\\ValueObjectVisitor\\\\RestUserTest\\:\\:testUserTypeMediaTypeCorrect\\(\\) has no return type specified\\.$#" count: 1 path: tests/lib/Server/Output/ValueObjectVisitor/RestUserTest.php - - - message: "#^Method Ibexa\\\\Tests\\\\Rest\\\\Server\\\\Output\\\\ValueObjectVisitor\\\\RestUserTest\\:\\:testVersionsHrefCorrect\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/Server/Output/ValueObjectVisitor/RestUserTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Rest\\\\Server\\\\Output\\\\ValueObjectVisitor\\\\RestUserTest\\:\\:testVersionsMediaTypeCorrect\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/Server/Output/ValueObjectVisitor/RestUserTest.php - - message: "#^Method Ibexa\\\\Tests\\\\Rest\\\\Output\\\\ValueObjectVisitorBaseTest\\:\\:assertXMLTag\\(\\) invoked with 4 parameters, 2\\-3 required\\.$#" count: 3 diff --git a/phpunit.functional.xml b/phpunit.functional.xml index f76ae5ac..d3a8c8d3 100644 --- a/phpunit.functional.xml +++ b/phpunit.functional.xml @@ -4,6 +4,7 @@ bootstrap="vendor/autoload.php" beStrictAboutTestsThatDoNotTestAnything="false" colors="true" + failOnWarning="true" > diff --git a/phpunit.xml b/phpunit.xml index ef619ccf..c232eadb 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -4,6 +4,7 @@ bootstrap="vendor/autoload.php" beStrictAboutTestsThatDoNotTestAnything="false" colors="true" + failOnWarning="true" > diff --git a/tests/lib/Server/Output/ValueObjectVisitor/BaseContentValueObjectVisitorTestCase.php b/tests/lib/Server/Output/ValueObjectVisitor/BaseContentValueObjectVisitorTestCase.php new file mode 100644 index 00000000..62e94784 --- /dev/null +++ b/tests/lib/Server/Output/ValueObjectVisitor/BaseContentValueObjectVisitorTestCase.php @@ -0,0 +1,193 @@ + 22, + 'name' => 'Sindelfingen', + 'sectionId' => 23, + 'currentVersionNo' => 5, + 'published' => true, + 'ownerId' => 24, + 'modificationDate' => new DateTime('2012-09-05 15:27 Europe/Berlin'), + 'publishedDate' => new DateTime('2012-09-05 15:27 Europe/Berlin'), + 'alwaysAvailable' => true, + 'status' => ContentInfo::STATUS_PUBLISHED, + 'remoteId' => 'abc123', + 'mainLanguageCode' => 'eng-US', + 'mainLocationId' => 25, + 'contentTypeId' => 26, + 'contentType' => new ContentType(['id' => 26]), + 'isHidden' => true, + ] + ); + } + + /** + * @depends testVisitWithoutEmbeddedVersion + */ + public function testNameCorrect(DOMDocument $dom): void + { + $this->assertXPath($dom, sprintf('/%s/name[text()="Sindelfingen"]', $this->getXPathFirstElementName())); + } + + /** + * @depends testVisitWithoutEmbeddedVersion + */ + public function testVersionsHrefCorrect(DOMDocument $dom): void + { + $this->assertXPath($dom, sprintf('/%s/Versions[@href="/content/objects/22/versions"]', $this->getXPathFirstElementName())); + } + + /** + * @depends testVisitWithoutEmbeddedVersion + */ + public function testVersionsMediaTypeCorrect(DOMDocument $dom): void + { + $this->assertXPath($dom, sprintf('/%s/Versions[@media-type="application/vnd.ibexa.api.VersionList+xml"]', $this->getXPathFirstElementName())); + } + + /** + * @depends testVisitWithoutEmbeddedVersion + */ + public function testSectionHrefCorrect(DOMDocument $dom): void + { + $this->assertXPath($dom, sprintf('/%s/Section[@href="/content/sections/23"]', $this->getXPathFirstElementName())); + } + + /** + * @depends testVisitWithoutEmbeddedVersion + */ + public function testSectionMediaTypeCorrect(DOMDocument $dom): void + { + $this->assertXPath($dom, sprintf('/%s/Section[@media-type="application/vnd.ibexa.api.Section+xml"]', $this->getXPathFirstElementName())); + } + + /** + * @depends testVisitWithoutEmbeddedVersion + */ + public function testMainLocationHrefCorrect(DOMDocument $dom): void + { + $this->assertXPath($dom, sprintf('/%s/MainLocation[@href="/content/locations/1/2/23"]', $this->getXPathFirstElementName())); + } + + /** + * @depends testVisitWithoutEmbeddedVersion + */ + public function testMainLocationMediaTypeCorrect(DOMDocument $dom): void + { + $this->assertXPath($dom, sprintf('/%s/MainLocation[@media-type="application/vnd.ibexa.api.Location+xml"]', $this->getXPathFirstElementName())); + } + + /** + * @depends testVisitWithoutEmbeddedVersion + */ + public function testLocationsHrefCorrect(DOMDocument $dom): void + { + $this->assertXPath($dom, sprintf('/%s/Locations[@href="/content/objects/22/locations"]', $this->getXPathFirstElementName())); + } + + /** + * @depends testVisitWithoutEmbeddedVersion + */ + public function testLocationsMediaTypeCorrect(DOMDocument $dom): void + { + $this->assertXPath($dom, sprintf('/%s/Locations[@media-type="application/vnd.ibexa.api.LocationList+xml"]', $this->getXPathFirstElementName())); + } + + /** + * @depends testVisitWithoutEmbeddedVersion + */ + public function testOwnerHrefCorrect(DOMDocument $dom): void + { + $this->assertXPath($dom, sprintf('/%s/Owner[@href="/user/users/24"]', $this->getXPathFirstElementName())); + } + + /** + * @depends testVisitWithoutEmbeddedVersion + */ + public function testOwnerMediaTypeCorrect(DOMDocument $dom): void + { + $this->assertXPath($dom, sprintf('/%s/Owner[@media-type="application/vnd.ibexa.api.User+xml"]', $this->getXPathFirstElementName())); + } + + /** + * @depends testVisitWithoutEmbeddedVersion + */ + public function testLastModificationDateCorrect(DOMDocument $dom): void + { + $this->assertXPath($dom, sprintf('/%s/lastModificationDate[text()="2012-09-05T15:27:00+02:00"]', $this->getXPathFirstElementName())); + } + + /** + * @depends testVisitWithoutEmbeddedVersion + */ + public function testMainLanguageCodeCorrect(DOMDocument $dom): void + { + $this->assertXPath($dom, sprintf('/%s/mainLanguageCode[text()="eng-US"]', $this->getXPathFirstElementName())); + } + + /** + * @depends testVisitWithoutEmbeddedVersion + */ + public function testAlwaysAvailableCorrect(DOMDocument $dom): void + { + $this->assertXPath($dom, sprintf('/%s/alwaysAvailable[text()="true"]', $this->getXPathFirstElementName())); + } + + protected function addContentRouteExpectations(ContentInfo $contentInfo, Location $location): void + { + $contentId = $contentInfo->getId(); + $contentTypeId = $contentInfo->getContentType()->id; + $sectionId = $contentInfo->getSectionId(); + + $this->addRouteExpectation( + 'ibexa.rest.load_content_type', + ['contentTypeId' => $contentTypeId], + "/content/types/$contentTypeId" + ); + $this->addRouteExpectation( + 'ibexa.rest.load_content_versions', + ['contentId' => $contentId], + "/content/objects/$contentId/versions" + ); + $this->addRouteExpectation( + 'ibexa.rest.load_section', + ['sectionId' => $sectionId], + "/content/sections/$sectionId" + ); + $locationPath = trim($location->getPathString(), '/'); + $this->addRouteExpectation( + 'ibexa.rest.load_location', + ['locationPath' => $locationPath], + "/content/locations/$locationPath" + ); + $this->addRouteExpectation( + 'ibexa.rest.load_locations_for_content', + ['contentId' => $contentId], + "/content/objects/$contentId/locations" + ); + } +} diff --git a/tests/lib/Server/Output/ValueObjectVisitor/FieldTest.php b/tests/lib/Server/Output/ValueObjectVisitor/FieldTest.php index 6de3d346..f9187b9f 100644 --- a/tests/lib/Server/Output/ValueObjectVisitor/FieldTest.php +++ b/tests/lib/Server/Output/ValueObjectVisitor/FieldTest.php @@ -8,8 +8,10 @@ namespace Ibexa\Tests\Rest\Server\Output\ValueObjectVisitor; +use Ibexa\Contracts\Core\Repository\FieldType; +use Ibexa\Contracts\Core\Repository\FieldTypeService; use Ibexa\Contracts\Core\Repository\Values\Content\Field as ApiField; -use Ibexa\Contracts\Rest\Output\Generator; +use Ibexa\Rest\FieldTypeProcessorRegistry; use Ibexa\Rest\Output\FieldTypeSerializer; use Ibexa\Rest\Server\Output\ValueObjectVisitor\Field; use Ibexa\Tests\Rest\Output\ValueObjectVisitorBaseTest; @@ -19,14 +21,18 @@ */ final class FieldTest extends ValueObjectVisitorBaseTest { - /** @var \Ibexa\Rest\Output\FieldTypeSerializer&\PHPUnit\Framework\MockObject\MockObject */ - private FieldTypeSerializer $fieldTypeSerializer; + /** @var \Ibexa\Contracts\Core\Repository\FieldTypeService&\PHPUnit\Framework\MockObject\MockObject */ + private FieldTypeService $fieldTypeService; + + /** @var \Ibexa\Rest\FieldTypeProcessorRegistry&\PHPUnit\Framework\MockObject\MockObject */ + private FieldTypeProcessorRegistry $fieldTypeProcessorRegistry; protected function setUp(): void { parent::setUp(); - $this->fieldTypeSerializer = $this->createMock(FieldTypeSerializer::class); + $this->fieldTypeService = $this->createMock(FieldTypeService::class); + $this->fieldTypeProcessorRegistry = $this->createMock(FieldTypeProcessorRegistry::class); } public function testVisit(): void @@ -41,15 +47,11 @@ public function testVisit(): void 'fieldDefIdentifier' => 'foo', 'value' => 'foo', 'languageCode' => 'eng-GB', - 'fieldTypeIdentifier' => 'ezfoo', + 'fieldTypeIdentifier' => 'foo_field_type', ] ); - $this->mockFieldTypeSerializerSerializeContentFieldValue( - $generator, - $field, - 'foo' - ); + $this->mockSerializingFieldValue($field); $visitor->visit( $this->getVisitorMock(), @@ -67,25 +69,24 @@ public function testVisit(): void $this->assertContainsTag('fieldTypeIdentifier', $result); } - private function mockFieldTypeSerializerSerializeContentFieldValue( - Generator $generator, - ApiField $field, - string $value - ): void { - $this->fieldTypeSerializer - ->method('serializeContentFieldValue') - ->with( - $generator, - $field - ) - ->willReturn($value); + private function mockSerializingFieldValue(ApiField $field): void + { + $fieldTypeMock = $this->createMock(FieldType::class); + $fieldTypeIdentifier = $field->getFieldTypeIdentifier(); + + $fieldTypeMock->method('getFieldTypeIdentifier')->willReturn($fieldTypeIdentifier); + $fieldTypeMock->method('toHash')->with('foo')->willReturn(['value' => 'foo']); + + $this->fieldTypeProcessorRegistry->method('hasProcessor')->with($fieldTypeIdentifier)->willReturn(false); + + $this->fieldTypeService->method('getFieldType')->with($fieldTypeIdentifier)->willReturn($fieldTypeMock); } private function assertContainsTag( string $tag, string $result ): void { - $this->assertXMLTag( + self::assertXMLTag( [ 'tag' => $tag, ], @@ -96,6 +97,11 @@ private function assertContainsTag( protected function internalGetVisitor(): Field { - return new Field($this->fieldTypeSerializer); + return new Field( + new FieldTypeSerializer( + $this->fieldTypeService, + $this->fieldTypeProcessorRegistry + ) + ); } } diff --git a/tests/lib/Server/Output/ValueObjectVisitor/RestContentTest.php b/tests/lib/Server/Output/ValueObjectVisitor/RestContentTest.php index b5d5fb78..ccf12af7 100644 --- a/tests/lib/Server/Output/ValueObjectVisitor/RestContentTest.php +++ b/tests/lib/Server/Output/ValueObjectVisitor/RestContentTest.php @@ -6,6 +6,7 @@ */ namespace Ibexa\Tests\Rest\Server\Output\ValueObjectVisitor; +use DOMDocument; use Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo; use Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType; use Ibexa\Core\Helper\TranslationHelper; @@ -13,9 +14,8 @@ use Ibexa\Rest\Server\Output\ValueObjectVisitor; use Ibexa\Rest\Server\Values\RestContent; use Ibexa\Rest\Server\Values\Version; -use Ibexa\Tests\Rest\Output\ValueObjectVisitorBaseTest; -class RestContentTest extends ValueObjectVisitorBaseTest +class RestContentTest extends BaseContentValueObjectVisitorTestCase { /** @var \Ibexa\Core\Helper\TranslationHelper|\PHPUnit\Framework\MockObject\MockObject */ private $translationHelper; @@ -30,10 +30,7 @@ protected function setUp(): void }); } - /** - * @return \DOMDocument - */ - public function testVisitWithoutEmbeddedVersion() + public function testVisitWithoutEmbeddedVersion(): DOMDocument { $visitor = $this->getVisitor(); $generator = $this->getGenerator(); @@ -101,34 +98,16 @@ public function testVisitWithoutEmbeddedVersion() $this->assertNotNull($result); - $dom = new \DOMDocument(); + $dom = new DOMDocument(); $dom->loadXml($result); return $dom; } - protected function getBasicRestContent() + protected function getBasicRestContent(): RestContent { return new RestContent( - new ContentInfo( - [ - 'id' => 'content23', - 'name' => 'Sindelfingen', - 'sectionId' => 'section23', - 'currentVersionNo' => 5, - 'published' => true, - 'ownerId' => 'user23', - 'modificationDate' => new \DateTime('2012-09-05 15:27 Europe/Berlin'), - 'publishedDate' => null, - 'alwaysAvailable' => true, - 'status' => ContentInfo::STATUS_PUBLISHED, - 'remoteId' => 'abc123', - 'mainLanguageCode' => 'eng-US', - 'mainLocationId' => 'location23', - 'contentTypeId' => 'contentType23', - 'isHidden' => true, - ] - ), + $this->getContentInfoStub(), new Values\Content\Location( [ 'pathString' => '/1/2/23', @@ -139,269 +118,110 @@ protected function getBasicRestContent() } /** - * @param \DOMDocument $dom - * * @depends testVisitWithoutEmbeddedVersion */ - public function testContentHrefCorrect(\DOMDocument $dom) + public function testContentHrefCorrect(DOMDocument $dom): void { - $this->assertXPath($dom, '/Content[@href="/content/objects/content23"]'); + $this->assertXPath($dom, '/Content[@href="/content/objects/22"]'); } /** - * @param \DOMDocument $dom - * * @depends testVisitWithoutEmbeddedVersion */ - public function testContentIdCorrect(\DOMDocument $dom) + public function testContentIdCorrect(DOMDocument $dom): void { - $this->assertXPath($dom, '/Content[@id="content23"]'); + $this->assertXPath($dom, '/Content[@id="22"]'); } /** - * @param \DOMDocument $dom - * * @depends testVisitWithoutEmbeddedVersion */ - public function testContentMediaTypeWithoutVersionCorrect(\DOMDocument $dom) + public function testContentMediaTypeWithoutVersionCorrect(DOMDocument $dom): void { $this->assertXPath($dom, '/Content[@media-type="application/vnd.ibexa.api.ContentInfo+xml"]'); } /** - * @param \DOMDocument $dom - * * @depends testVisitWithoutEmbeddedVersion */ - public function testContentRemoteIdCorrect(\DOMDocument $dom) + public function testContentRemoteIdCorrect(DOMDocument $dom): void { $this->assertXPath($dom, '/Content[@remoteId="abc123"]'); } /** - * @param \DOMDocument $dom - * * @depends testVisitWithoutEmbeddedVersion */ - public function testContentTypeHrefCorrect(\DOMDocument $dom) + public function testContentTypeHrefCorrect(DOMDocument $dom): void { - $this->assertXPath($dom, '/Content/ContentType[@href="/content/types/contentType23"]'); + $this->assertXPath($dom, '/Content/ContentType[@href="/content/types/26"]'); } /** - * @param \DOMDocument $dom - * * @depends testVisitWithoutEmbeddedVersion */ - public function testContentTypeMediaTypeCorrect(\DOMDocument $dom) + public function testContentTypeMediaTypeCorrect(DOMDocument $dom): void { $this->assertXPath($dom, '/Content/ContentType[@media-type="application/vnd.ibexa.api.ContentType+xml"]'); } /** - * @param \DOMDocument $dom - * * @depends testVisitWithoutEmbeddedVersion */ - public function testNameCorrect(\DOMDocument $dom) + public function testNameCorrect(DOMDocument $dom): void { $this->assertXPath($dom, '/Content/Name[text()="Sindelfingen"]'); } /** - * @param \DOMDocument $dom - * * @depends testVisitWithoutEmbeddedVersion */ - public function testTranslatedNameCorrect(\DOMDocument $dom) + public function testTranslatedNameCorrect(DOMDocument $dom): void { $this->assertXPath($dom, '/Content/TranslatedName[text()="Sindelfingen (Translated)"]'); } /** - * @param \DOMDocument $dom - * - * @depends testVisitWithoutEmbeddedVersion - */ - public function testVersionsHrefCorrect(\DOMDocument $dom) - { - $this->assertXPath($dom, '/Content/Versions[@href="/content/objects/content23/versions"]'); - } - - /** - * @param \DOMDocument $dom - * * @depends testVisitWithoutEmbeddedVersion */ - public function testVersionsMediaTypeCorrect(\DOMDocument $dom) + public function testCurrentVersionHrefCorrect(DOMDocument $dom): void { - $this->assertXPath($dom, '/Content/Versions[@media-type="application/vnd.ibexa.api.VersionList+xml"]'); + $this->assertXPath($dom, '/Content/CurrentVersion[@href="/content/objects/22/currentversion"]'); } /** - * @param \DOMDocument $dom - * - * @depends testVisitWithoutEmbeddedVersion - */ - public function testCurrentVersionHrefCorrect(\DOMDocument $dom) - { - $this->assertXPath($dom, '/Content/CurrentVersion[@href="/content/objects/content23/currentversion"]'); - } - - /** - * @param \DOMDocument $dom - * * @depends testVisitWithoutEmbeddedVersion */ - public function testCurrentVersionMediaTypeCorrect(\DOMDocument $dom) + public function testCurrentVersionMediaTypeCorrect(DOMDocument $dom): void { $this->assertXPath($dom, '/Content/CurrentVersion[@media-type="application/vnd.ibexa.api.Version+xml"]'); } /** - * @param \DOMDocument $dom - * - * @depends testVisitWithoutEmbeddedVersion - */ - public function testSectionHrefCorrect(\DOMDocument $dom) - { - $this->assertXPath($dom, '/Content/Section[@href="/content/sections/section23"]'); - } - - /** - * @param \DOMDocument $dom - * - * @depends testVisitWithoutEmbeddedVersion - */ - public function testSectionMediaTypeCorrect(\DOMDocument $dom) - { - $this->assertXPath($dom, '/Content/Section[@media-type="application/vnd.ibexa.api.Section+xml"]'); - } - - /** - * @param \DOMDocument $dom - * - * @depends testVisitWithoutEmbeddedVersion - */ - public function testMainLocationHrefCorrect(\DOMDocument $dom) - { - $this->assertXPath($dom, '/Content/MainLocation[@href="/content/locations/1/2/23"]'); - } - - /** - * @param \DOMDocument $dom - * - * @depends testVisitWithoutEmbeddedVersion - */ - public function testMainLocationMediaTypeCorrect(\DOMDocument $dom) - { - $this->assertXPath($dom, '/Content/MainLocation[@media-type="application/vnd.ibexa.api.Location+xml"]'); - } - - /** - * @param \DOMDocument $dom - * - * @depends testVisitWithoutEmbeddedVersion - */ - public function testLocationsHrefCorrect(\DOMDocument $dom) - { - $this->assertXPath($dom, '/Content/Locations[@href="/content/objects/content23/locations"]'); - } - - /** - * @param \DOMDocument $dom - * * @depends testVisitWithoutEmbeddedVersion */ - public function testLocationsMediaTypeCorrect(\DOMDocument $dom) - { - $this->assertXPath($dom, '/Content/Locations[@media-type="application/vnd.ibexa.api.LocationList+xml"]'); - } - - /** - * @param \DOMDocument $dom - * - * @depends testVisitWithoutEmbeddedVersion - */ - public function testOwnerHrefCorrect(\DOMDocument $dom) - { - $this->assertXPath($dom, '/Content/Owner[@href="/user/users/user23"]'); - } - - /** - * @param \DOMDocument $dom - * - * @depends testVisitWithoutEmbeddedVersion - */ - public function testOwnerMediaTypeCorrect(\DOMDocument $dom) - { - $this->assertXPath($dom, '/Content/Owner[@media-type="application/vnd.ibexa.api.User+xml"]'); - } - - /** - * @param \DOMDocument $dom - * - * @depends testVisitWithoutEmbeddedVersion - */ - public function testLastModificationDateCorrect(\DOMDocument $dom) - { - $this->assertXPath($dom, '/Content/lastModificationDate[text()="2012-09-05T15:27:00+02:00"]'); - } - - /** - * @param \DOMDocument $dom - * - * @depends testVisitWithoutEmbeddedVersion - */ - public function testMainLanguageCodeCorrect(\DOMDocument $dom) - { - $this->assertXPath($dom, '/Content/mainLanguageCode[text()="eng-US"]'); - } - - /** - * @param \DOMDocument $dom - * - * @depends testVisitWithoutEmbeddedVersion - */ - public function testCurrentVersionNoCorrect(\DOMDocument $dom) + public function testCurrentVersionNoCorrect(DOMDocument $dom): void { $this->assertXPath($dom, '/Content/currentVersionNo[text()="5"]'); } /** - * @param \DOMDocument $dom - * - * @depends testVisitWithoutEmbeddedVersion - */ - public function testAlwaysAvailableCorrect(\DOMDocument $dom) - { - $this->assertXPath($dom, '/Content/alwaysAvailable[text()="true"]'); - } - - /** - * @param \DOMDocument $dom - * * @depends testVisitWithoutEmbeddedVersion */ - public function testIsHiddenCorrect(\DOMDocument $dom) + public function testIsHiddenCorrect(DOMDocument $dom): void { $this->assertXPath($dom, '/Content/isHidden[text()="true"]'); } /** - * @param \DOMDocument $dom - * * @depends testVisitWithoutEmbeddedVersion */ - public function testStatusCorrect(\DOMDocument $dom) + public function testStatusCorrect(DOMDocument $dom): void { $this->assertXPath($dom, '/Content/status[text()="PUBLISHED"]'); } - /** - * @return \DOMDocument - */ - public function testVisitWithEmbeddedVersion() + public function testVisitWithEmbeddedVersion(): DOMDocument { $visitor = $this->getVisitor(); $generator = $this->getGenerator(); @@ -445,27 +265,6 @@ public function testVisitWithEmbeddedVersion() "/content/objects/{$restContent->contentInfo->id}/currentversion" ); - $this->addRouteExpectation( - 'ibexa.rest.load_section', - ['sectionId' => $restContent->contentInfo->sectionId], - "/content/sections/{$restContent->contentInfo->sectionId}" - ); - $this->addRouteExpectation( - 'ibexa.rest.load_location', - ['locationPath' => $locationPath = trim($restContent->mainLocation->pathString, '/')], - "/content/locations/{$locationPath}" - ); - $this->addRouteExpectation( - 'ibexa.rest.load_locations_for_content', - ['contentId' => $restContent->contentInfo->id], - "/content/objects/{$restContent->contentInfo->id}/locations" - ); - $this->addRouteExpectation( - 'ibexa.rest.load_user', - ['userId' => $restContent->contentInfo->ownerId], - "/user/users/{$restContent->contentInfo->ownerId}" - ); - $visitor->visit( $this->getVisitorMock(), $generator, @@ -476,7 +275,7 @@ public function testVisitWithEmbeddedVersion() $this->assertNotNull($result); - $dom = new \DOMDocument(); + $dom = new DOMDocument(); $dom->loadXml($result); return $dom; @@ -487,7 +286,7 @@ public function testVisitWithEmbeddedVersion() * * @depends testVisitWithEmbeddedVersion */ - public function testContentMediaTypeWithVersionCorrect(\DOMDocument $dom) + public function testContentMediaTypeWithVersionCorrect(DOMDocument $dom): void { $this->assertXPath($dom, '/Content[@media-type="application/vnd.ibexa.api.Content+xml"]'); } @@ -497,9 +296,9 @@ public function testContentMediaTypeWithVersionCorrect(\DOMDocument $dom) * * @depends testVisitWithEmbeddedVersion */ - public function testEmbeddedCurrentVersionHrefCorrect(\DOMDocument $dom) + public function testEmbeddedCurrentVersionHrefCorrect(DOMDocument $dom): void { - $this->assertXPath($dom, '/Content/CurrentVersion[@href="/content/objects/content23/currentversion"]'); + $this->assertXPath($dom, '/Content/CurrentVersion[@href="/content/objects/22/currentversion"]'); } /** @@ -507,22 +306,25 @@ public function testEmbeddedCurrentVersionHrefCorrect(\DOMDocument $dom) * * @depends testVisitWithEmbeddedVersion */ - public function testEmbeddedCurrentVersionMediaTypeCorrect(\DOMDocument $dom) + public function testEmbeddedCurrentVersionMediaTypeCorrect(DOMDocument $dom): void { $this->assertXPath($dom, '/Content/CurrentVersion[@media-type="application/vnd.ibexa.api.Version+xml"]'); } /** * Get the Content visitor. - * - * @return \Ibexa\Rest\Server\Output\ValueObjectVisitor\RestContent */ - protected function internalGetVisitor() + protected function internalGetVisitor(): ValueObjectVisitor\RestContent { return new ValueObjectVisitor\RestContent( $this->translationHelper ); } + + protected function getXPathFirstElementName(): string + { + return 'Content'; + } } class_alias(RestContentTest::class, 'EzSystems\EzPlatformRest\Tests\Server\Output\ValueObjectVisitor\RestContentTest'); diff --git a/tests/lib/Server/Output/ValueObjectVisitor/RestUserGroupTest.php b/tests/lib/Server/Output/ValueObjectVisitor/RestUserGroupTest.php index ba18dc64..97ef3032 100644 --- a/tests/lib/Server/Output/ValueObjectVisitor/RestUserGroupTest.php +++ b/tests/lib/Server/Output/ValueObjectVisitor/RestUserGroupTest.php @@ -6,19 +6,15 @@ */ namespace Ibexa\Tests\Rest\Server\Output\ValueObjectVisitor; -use Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo; +use DOMDocument; use Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType; use Ibexa\Core\Repository\Values; use Ibexa\Rest\Server\Output\ValueObjectVisitor; use Ibexa\Rest\Server\Values\RestUserGroup; -use Ibexa\Tests\Rest\Output\ValueObjectVisitorBaseTest; -class RestUserGroupTest extends ValueObjectVisitorBaseTest +class RestUserGroupTest extends BaseContentValueObjectVisitorTestCase { - /** - * @return \DOMDocument - */ - public function testVisitWithoutEmbeddedVersion() + public function testVisitWithoutEmbeddedVersion(): DOMDocument { $visitor = $this->getVisitor(); $generator = $this->getGenerator(); @@ -30,37 +26,13 @@ public function testVisitWithoutEmbeddedVersion() $this->getVisitorMock()->expects($this->once()) ->method('visitValueObject'); - $userGroupPath = implode('/', $restUserGroup->mainLocation->path); + $userGroupPath = trim($restUserGroup->mainLocation->getPathString(), '/'); $this->addRouteExpectation( 'ibexa.rest.load_user_group', ['groupPath' => $userGroupPath], "/user/groups/{$userGroupPath}" ); - $this->addRouteExpectation( - 'ibexa.rest.load_content_type', - ['contentTypeId' => $restUserGroup->contentInfo->contentTypeId], - "/content/types/{$restUserGroup->contentInfo->contentTypeId}" - ); - $this->addRouteExpectation( - 'ibexa.rest.load_content_versions', - ['contentId' => $restUserGroup->contentInfo->id], - "/content/objects/{$restUserGroup->contentInfo->id}/versions" - ); - $this->addRouteExpectation( - 'ibexa.rest.load_section', - ['sectionId' => $restUserGroup->contentInfo->sectionId], - "/content/sections/{$restUserGroup->contentInfo->sectionId}" - ); - $this->addRouteExpectation( - 'ibexa.rest.load_location', - ['locationPath' => $userGroupPath], - "/content/locations/{$userGroupPath}" - ); - $this->addRouteExpectation( - 'ibexa.rest.load_locations_for_content', - ['contentId' => $restUserGroup->contentInfo->id], - "/content/objects/{$restUserGroup->contentInfo->id}/locations" - ); + $this->addContentRouteExpectations($restUserGroup->contentInfo, $restUserGroup->mainLocation); $this->addRouteExpectation( 'ibexa.rest.load_user', ['userId' => $restUserGroup->contentInfo->ownerId], @@ -97,34 +69,18 @@ public function testVisitWithoutEmbeddedVersion() $this->assertNotNull($result); - $dom = new \DOMDocument(); + $dom = new DOMDocument(); $dom->loadXml($result); return $dom; } - protected function getBasicRestUserGroup() + protected function getBasicRestUserGroup(): RestUserGroup { return new RestUserGroup( new Values\User\UserGroup(), $this->getMockForAbstractClass(ContentType::class), - new ContentInfo( - [ - 'id' => 'content23', - 'name' => 'Sindelfingen', - 'sectionId' => 'section23', - 'currentVersionNo' => 5, - 'published' => true, - 'ownerId' => 'user23', - 'modificationDate' => new \DateTime('2012-09-05 15:27 Europe/Berlin'), - 'publishedDate' => new \DateTime('2012-09-05 15:27 Europe/Berlin'), - 'alwaysAvailable' => true, - 'remoteId' => 'abc123', - 'mainLanguageCode' => 'eng-US', - 'mainLocationId' => 'location23', - 'contentTypeId' => 'contentType23', - ] - ), + $this->getContentInfoStub(), new Values\Content\Location( [ 'pathString' => '/1/2/23', @@ -136,294 +92,129 @@ protected function getBasicRestUserGroup() } /** - * @param \DOMDocument $dom - * * @depends testVisitWithoutEmbeddedVersion */ - public function testUserGroupHrefCorrect(\DOMDocument $dom) + public function testUserGroupHrefCorrect(DOMDocument $dom): void { $this->assertXPath($dom, '/UserGroup[@href="/user/groups/1/2/23"]'); } /** - * @param \DOMDocument $dom - * * @depends testVisitWithoutEmbeddedVersion */ - public function testUserGroupIdCorrect(\DOMDocument $dom) + public function testUserGroupIdCorrect(DOMDocument $dom): void { - $this->assertXPath($dom, '/UserGroup[@id="content23"]'); + $this->assertXPath($dom, '/UserGroup[@id="22"]'); } /** - * @param \DOMDocument $dom - * * @depends testVisitWithoutEmbeddedVersion */ - public function testUserGroupMediaTypeWithoutVersionCorrect(\DOMDocument $dom) + public function testUserGroupMediaTypeWithoutVersionCorrect(DOMDocument $dom): void { $this->assertXPath($dom, '/UserGroup[@media-type="application/vnd.ibexa.api.UserGroup+xml"]'); } /** - * @param \DOMDocument $dom - * * @depends testVisitWithoutEmbeddedVersion */ - public function testUserGroupRemoteIdCorrect(\DOMDocument $dom) + public function testUserGroupRemoteIdCorrect(DOMDocument $dom): void { $this->assertXPath($dom, '/UserGroup[@remoteId="abc123"]'); } /** - * @param \DOMDocument $dom - * * @depends testVisitWithoutEmbeddedVersion */ - public function testUserGroupTypeHrefCorrect(\DOMDocument $dom) + public function testUserGroupTypeHrefCorrect(DOMDocument $dom): void { - $this->assertXPath($dom, '/UserGroup/ContentType[@href="/content/types/contentType23"]'); + $this->assertXPath($dom, '/UserGroup/ContentType[@href="/content/types/26"]'); } /** - * @param \DOMDocument $dom - * * @depends testVisitWithoutEmbeddedVersion */ - public function testUserGroupTypeMediaTypeCorrect(\DOMDocument $dom) + public function testUserGroupTypeMediaTypeCorrect(DOMDocument $dom): void { $this->assertXPath($dom, '/UserGroup/ContentType[@media-type="application/vnd.ibexa.api.ContentType+xml"]'); } /** - * @param \DOMDocument $dom - * - * @depends testVisitWithoutEmbeddedVersion - */ - public function testNameCorrect(\DOMDocument $dom) - { - $this->assertXPath($dom, '/UserGroup/name[text()="Sindelfingen"]'); - } - - /** - * @param \DOMDocument $dom - * - * @depends testVisitWithoutEmbeddedVersion - */ - public function testVersionsHrefCorrect(\DOMDocument $dom) - { - $this->assertXPath($dom, '/UserGroup/Versions[@href="/content/objects/content23/versions"]'); - } - - /** - * @param \DOMDocument $dom - * - * @depends testVisitWithoutEmbeddedVersion - */ - public function testVersionsMediaTypeCorrect(\DOMDocument $dom) - { - $this->assertXPath($dom, '/UserGroup/Versions[@media-type="application/vnd.ibexa.api.VersionList+xml"]'); - } - - /** - * @param \DOMDocument $dom - * - * @depends testVisitWithoutEmbeddedVersion - */ - public function testSectionHrefCorrect(\DOMDocument $dom) - { - $this->assertXPath($dom, '/UserGroup/Section[@href="/content/sections/section23"]'); - } - - /** - * @param \DOMDocument $dom - * - * @depends testVisitWithoutEmbeddedVersion - */ - public function testSectionMediaTypeCorrect(\DOMDocument $dom) - { - $this->assertXPath($dom, '/UserGroup/Section[@media-type="application/vnd.ibexa.api.Section+xml"]'); - } - - /** - * @param \DOMDocument $dom - * - * @depends testVisitWithoutEmbeddedVersion - */ - public function testMainLocationHrefCorrect(\DOMDocument $dom) - { - $this->assertXPath($dom, '/UserGroup/MainLocation[@href="/content/locations/1/2/23"]'); - } - - /** - * @param \DOMDocument $dom - * * @depends testVisitWithoutEmbeddedVersion */ - public function testMainLocationMediaTypeCorrect(\DOMDocument $dom) - { - $this->assertXPath($dom, '/UserGroup/MainLocation[@media-type="application/vnd.ibexa.api.Location+xml"]'); - } - - /** - * @param \DOMDocument $dom - * - * @depends testVisitWithoutEmbeddedVersion - */ - public function testLocationsHrefCorrect(\DOMDocument $dom) - { - $this->assertXPath($dom, '/UserGroup/Locations[@href="/content/objects/content23/locations"]'); - } - - /** - * @param \DOMDocument $dom - * - * @depends testVisitWithoutEmbeddedVersion - */ - public function testLocationsMediaTypeCorrect(\DOMDocument $dom) - { - $this->assertXPath($dom, '/UserGroup/Locations[@media-type="application/vnd.ibexa.api.LocationList+xml"]'); - } - - /** - * @param \DOMDocument $dom - * - * @depends testVisitWithoutEmbeddedVersion - */ - public function testOwnerHrefCorrect(\DOMDocument $dom) - { - $this->assertXPath($dom, '/UserGroup/Owner[@href="/user/users/user23"]'); - } - - /** - * @param \DOMDocument $dom - * - * @depends testVisitWithoutEmbeddedVersion - */ - public function testOwnerMediaTypeCorrect(\DOMDocument $dom) - { - $this->assertXPath($dom, '/UserGroup/Owner[@media-type="application/vnd.ibexa.api.User+xml"]'); - } - - /** - * @param \DOMDocument $dom - * - * @depends testVisitWithoutEmbeddedVersion - */ - public function testLastModificationDateCorrect(\DOMDocument $dom) - { - $this->assertXPath($dom, '/UserGroup/lastModificationDate[text()="2012-09-05T15:27:00+02:00"]'); - } - - /** - * @param \DOMDocument $dom - * - * @depends testVisitWithoutEmbeddedVersion - */ - public function testMainLanguageCodeCorrect(\DOMDocument $dom) - { - $this->assertXPath($dom, '/UserGroup/mainLanguageCode[text()="eng-US"]'); - } - - /** - * @param \DOMDocument $dom - * - * @depends testVisitWithoutEmbeddedVersion - */ - public function testAlwaysAvailableCorrect(\DOMDocument $dom) - { - $this->assertXPath($dom, '/UserGroup/alwaysAvailable[text()="true"]'); - } - - /** - * @param \DOMDocument $dom - * - * @depends testVisitWithoutEmbeddedVersion - */ - public function testParentUserGroupHrefCorrect(\DOMDocument $dom) + public function testParentUserGroupHrefCorrect(DOMDocument $dom): void { $this->assertXPath($dom, '/UserGroup/ParentUserGroup[@href="/user/groups/1/2"]'); } /** - * @param \DOMDocument $dom - * * @depends testVisitWithoutEmbeddedVersion */ - public function testSubgroupsHrefCorrect(\DOMDocument $dom) + public function testSubgroupsHrefCorrect(DOMDocument $dom): void { $this->assertXPath($dom, '/UserGroup/Subgroups[@href="/user/groups/1/2/23/subgroups"]'); } /** - * @param \DOMDocument $dom - * * @depends testVisitWithoutEmbeddedVersion */ - public function testUsersHrefCorrect(\DOMDocument $dom) + public function testUsersHrefCorrect(DOMDocument $dom): void { $this->assertXPath($dom, '/UserGroup/Users[@href="/user/groups/1/2/23/users"]'); } /** - * @param \DOMDocument $dom - * * @depends testVisitWithoutEmbeddedVersion */ - public function testRolesHrefCorrect(\DOMDocument $dom) + public function testRolesHrefCorrect(DOMDocument $dom): void { $this->assertXPath($dom, '/UserGroup/Roles[@href="/user/groups/1/2/23/roles"]'); } /** - * @param \DOMDocument $dom - * * @depends testVisitWithoutEmbeddedVersion */ - public function testParentUserGroupMediaTypeCorrect(\DOMDocument $dom) + public function testParentUserGroupMediaTypeCorrect(DOMDocument $dom): void { $this->assertXPath($dom, '/UserGroup/ParentUserGroup[@media-type="application/vnd.ibexa.api.UserGroup+xml"]'); } /** - * @param \DOMDocument $dom - * * @depends testVisitWithoutEmbeddedVersion */ - public function testSubgroupsMediaTypeCorrect(\DOMDocument $dom) + public function testSubgroupsMediaTypeCorrect(DOMDocument $dom): void { $this->assertXPath($dom, '/UserGroup/Subgroups[@media-type="application/vnd.ibexa.api.UserGroupList+xml"]'); } /** - * @param \DOMDocument $dom - * * @depends testVisitWithoutEmbeddedVersion */ - public function testUsersMediaTypeCorrect(\DOMDocument $dom) + public function testUsersMediaTypeCorrect(DOMDocument $dom): void { $this->assertXPath($dom, '/UserGroup/Users[@media-type="application/vnd.ibexa.api.UserList+xml"]'); } /** - * @param \DOMDocument $dom - * * @depends testVisitWithoutEmbeddedVersion */ - public function testRolesMediaTypeCorrect(\DOMDocument $dom) + public function testRolesMediaTypeCorrect(DOMDocument $dom): void { $this->assertXPath($dom, '/UserGroup/Roles[@media-type="application/vnd.ibexa.api.RoleAssignmentList+xml"]'); } /** * Get the UserGroup visitor. - * - * @return \Ibexa\Rest\Server\Output\ValueObjectVisitor\RestUserGroup */ - protected function internalGetVisitor() + protected function internalGetVisitor(): ValueObjectVisitor\RestUserGroup { return new ValueObjectVisitor\RestUserGroup(); } + + protected function getXPathFirstElementName(): string + { + return 'UserGroup'; + } } class_alias(RestUserGroupTest::class, 'EzSystems\EzPlatformRest\Tests\Server\Output\ValueObjectVisitor\RestUserGroupTest'); diff --git a/tests/lib/Server/Output/ValueObjectVisitor/RestUserTest.php b/tests/lib/Server/Output/ValueObjectVisitor/RestUserTest.php index f40edb5c..c02f8c20 100644 --- a/tests/lib/Server/Output/ValueObjectVisitor/RestUserTest.php +++ b/tests/lib/Server/Output/ValueObjectVisitor/RestUserTest.php @@ -6,19 +6,15 @@ */ namespace Ibexa\Tests\Rest\Server\Output\ValueObjectVisitor; -use Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo; +use DOMDocument; use Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType; use Ibexa\Core\Repository\Values; use Ibexa\Rest\Server\Output\ValueObjectVisitor; use Ibexa\Rest\Server\Values\RestUser; -use Ibexa\Tests\Rest\Output\ValueObjectVisitorBaseTest; -class RestUserTest extends ValueObjectVisitorBaseTest +class RestUserTest extends BaseContentValueObjectVisitorTestCase { - /** - * @return \DOMDocument - */ - public function testVisitWithoutEmbeddedVersion() + public function testVisitWithoutEmbeddedVersion(): DOMDocument { $visitor = $this->getVisitor(); $generator = $this->getGenerator(); @@ -30,37 +26,12 @@ public function testVisitWithoutEmbeddedVersion() $this->getVisitorMock()->expects($this->once()) ->method('visitValueObject'); - $locationPath = implode('/', $restUser->mainLocation->path); $this->addRouteExpectation( 'ibexa.rest.load_user', ['userId' => $restUser->contentInfo->id], "/user/users/{$restUser->contentInfo->id}" ); - $this->addRouteExpectation( - 'ibexa.rest.load_content_type', - ['contentTypeId' => $restUser->contentInfo->contentTypeId], - "/content/types/{$restUser->contentInfo->contentTypeId}" - ); - $this->addRouteExpectation( - 'ibexa.rest.load_content_versions', - ['contentId' => $restUser->contentInfo->id], - "/content/objects/{$restUser->contentInfo->id}/versions" - ); - $this->addRouteExpectation( - 'ibexa.rest.load_section', - ['sectionId' => $restUser->contentInfo->sectionId], - "/content/sections/{$restUser->contentInfo->sectionId}" - ); - $this->addRouteExpectation( - 'ibexa.rest.load_location', - ['locationPath' => $locationPath], - "/content/locations/{$locationPath}" - ); - $this->addRouteExpectation( - 'ibexa.rest.load_locations_for_content', - ['contentId' => $restUser->contentInfo->id], - "/content/objects/{$restUser->contentInfo->id}/locations" - ); + $this->addContentRouteExpectations($restUser->contentInfo, $restUser->mainLocation); $this->addRouteExpectation( 'ibexa.rest.load_user_groups_of_user', ['userId' => $restUser->contentInfo->id], @@ -92,34 +63,18 @@ public function testVisitWithoutEmbeddedVersion() $this->assertNotNull($result); - $dom = new \DOMDocument(); + $dom = new DOMDocument(); $dom->loadXml($result); return $dom; } - protected function getBasicRestUser() + protected function getBasicRestUser(): RestUser { return new RestUser( new Values\User\User(), $this->getMockForAbstractClass(ContentType::class), - new ContentInfo( - [ - 'id' => 'content23', - 'name' => 'Sindelfingen', - 'sectionId' => 'section23', - 'currentVersionNo' => 5, - 'published' => true, - 'ownerId' => 'user23', - 'modificationDate' => new \DateTime('2012-09-05 15:27 Europe/Berlin'), - 'publishedDate' => new \DateTime('2012-09-05 15:27 Europe/Berlin'), - 'alwaysAvailable' => true, - 'remoteId' => 'abc123', - 'mainLanguageCode' => 'eng-US', - 'mainLocationId' => 'location23', - 'contentTypeId' => 'contentType23', - ] - ), + $this->getContentInfoStub(), new Values\Content\Location( [ 'pathString' => '/1/2/23', @@ -131,254 +86,97 @@ protected function getBasicRestUser() } /** - * @param \DOMDocument $dom - * * @depends testVisitWithoutEmbeddedVersion */ - public function testUserHrefCorrect(\DOMDocument $dom) + public function testUserHrefCorrect(DOMDocument $dom): void { - $this->assertXPath($dom, '/User[@href="/user/users/content23"]'); + $this->assertXPath($dom, '/User[@href="/user/users/22"]'); } /** - * @param \DOMDocument $dom - * * @depends testVisitWithoutEmbeddedVersion */ - public function testUserIdCorrect(\DOMDocument $dom) + public function testUserIdCorrect(DOMDocument $dom): void { - $this->assertXPath($dom, '/User[@id="content23"]'); + $this->assertXPath($dom, '/User[@id="22"]'); } /** - * @param \DOMDocument $dom - * * @depends testVisitWithoutEmbeddedVersion */ - public function testUserMediaTypeWithoutVersionCorrect(\DOMDocument $dom) + public function testUserMediaTypeWithoutVersionCorrect(DOMDocument $dom): void { $this->assertXPath($dom, '/User[@media-type="application/vnd.ibexa.api.User+xml"]'); } /** - * @param \DOMDocument $dom - * * @depends testVisitWithoutEmbeddedVersion */ - public function testUserRemoteIdCorrect(\DOMDocument $dom) + public function testUserRemoteIdCorrect(DOMDocument $dom): void { $this->assertXPath($dom, '/User[@remoteId="abc123"]'); } /** - * @param \DOMDocument $dom - * * @depends testVisitWithoutEmbeddedVersion */ - public function testUserTypeHrefCorrect(\DOMDocument $dom) + public function testUserTypeHrefCorrect(DOMDocument $dom): void { - $this->assertXPath($dom, '/User/ContentType[@href="/content/types/contentType23"]'); + $this->assertXPath($dom, '/User/ContentType[@href="/content/types/26"]'); } /** - * @param \DOMDocument $dom - * * @depends testVisitWithoutEmbeddedVersion */ - public function testUserTypeMediaTypeCorrect(\DOMDocument $dom) + public function testUserTypeMediaTypeCorrect(DOMDocument $dom) { $this->assertXPath($dom, '/User/ContentType[@media-type="application/vnd.ibexa.api.ContentType+xml"]'); } /** - * @param \DOMDocument $dom - * - * @depends testVisitWithoutEmbeddedVersion - */ - public function testNameCorrect(\DOMDocument $dom) - { - $this->assertXPath($dom, '/User/name[text()="Sindelfingen"]'); - } - - /** - * @param \DOMDocument $dom - * - * @depends testVisitWithoutEmbeddedVersion - */ - public function testVersionsHrefCorrect(\DOMDocument $dom) - { - $this->assertXPath($dom, '/User/Versions[@href="/content/objects/content23/versions"]'); - } - - /** - * @param \DOMDocument $dom - * - * @depends testVisitWithoutEmbeddedVersion - */ - public function testVersionsMediaTypeCorrect(\DOMDocument $dom) - { - $this->assertXPath($dom, '/User/Versions[@media-type="application/vnd.ibexa.api.VersionList+xml"]'); - } - - /** - * @param \DOMDocument $dom - * - * @depends testVisitWithoutEmbeddedVersion - */ - public function testSectionHrefCorrect(\DOMDocument $dom) - { - $this->assertXPath($dom, '/User/Section[@href="/content/sections/section23"]'); - } - - /** - * @param \DOMDocument $dom - * - * @depends testVisitWithoutEmbeddedVersion - */ - public function testSectionMediaTypeCorrect(\DOMDocument $dom) - { - $this->assertXPath($dom, '/User/Section[@media-type="application/vnd.ibexa.api.Section+xml"]'); - } - - /** - * @param \DOMDocument $dom - * - * @depends testVisitWithoutEmbeddedVersion - */ - public function testMainLocationHrefCorrect(\DOMDocument $dom) - { - $this->assertXPath($dom, '/User/MainLocation[@href="/content/locations/1/2/23"]'); - } - - /** - * @param \DOMDocument $dom - * * @depends testVisitWithoutEmbeddedVersion */ - public function testMainLocationMediaTypeCorrect(\DOMDocument $dom) + public function testUserGroupsHrefCorrect(DOMDocument $dom): void { - $this->assertXPath($dom, '/User/MainLocation[@media-type="application/vnd.ibexa.api.Location+xml"]'); + $this->assertXPath($dom, '/User/UserGroups[@href="/user/users/22/groups"]'); } /** - * @param \DOMDocument $dom - * * @depends testVisitWithoutEmbeddedVersion */ - public function testLocationsHrefCorrect(\DOMDocument $dom) - { - $this->assertXPath($dom, '/User/Locations[@href="/content/objects/content23/locations"]'); - } - - /** - * @param \DOMDocument $dom - * - * @depends testVisitWithoutEmbeddedVersion - */ - public function testLocationsMediaTypeCorrect(\DOMDocument $dom) - { - $this->assertXPath($dom, '/User/Locations[@media-type="application/vnd.ibexa.api.LocationList+xml"]'); - } - - /** - * @param \DOMDocument $dom - * - * @depends testVisitWithoutEmbeddedVersion - */ - public function testOwnerHrefCorrect(\DOMDocument $dom) - { - $this->assertXPath($dom, '/User/Owner[@href="/user/users/user23"]'); - } - - /** - * @param \DOMDocument $dom - * - * @depends testVisitWithoutEmbeddedVersion - */ - public function testOwnerMediaTypeCorrect(\DOMDocument $dom) - { - $this->assertXPath($dom, '/User/Owner[@media-type="application/vnd.ibexa.api.User+xml"]'); - } - - /** - * @param \DOMDocument $dom - * - * @depends testVisitWithoutEmbeddedVersion - */ - public function testLastModificationDateCorrect(\DOMDocument $dom) - { - $this->assertXPath($dom, '/User/lastModificationDate[text()="2012-09-05T15:27:00+02:00"]'); - } - - /** - * @param \DOMDocument $dom - * - * @depends testVisitWithoutEmbeddedVersion - */ - public function testMainLanguageCodeCorrect(\DOMDocument $dom) - { - $this->assertXPath($dom, '/User/mainLanguageCode[text()="eng-US"]'); - } - - /** - * @param \DOMDocument $dom - * - * @depends testVisitWithoutEmbeddedVersion - */ - public function testAlwaysAvailableCorrect(\DOMDocument $dom) - { - $this->assertXPath($dom, '/User/alwaysAvailable[text()="true"]'); - } - - /** - * @param \DOMDocument $dom - * - * @depends testVisitWithoutEmbeddedVersion - */ - public function testUserGroupsHrefCorrect(\DOMDocument $dom) - { - $this->assertXPath($dom, '/User/UserGroups[@href="/user/users/content23/groups"]'); - } - - /** - * @param \DOMDocument $dom - * - * @depends testVisitWithoutEmbeddedVersion - */ - public function testUserGroupsMediaTypeCorrect(\DOMDocument $dom) + public function testUserGroupsMediaTypeCorrect(DOMDocument $dom): void { $this->assertXPath($dom, '/User/UserGroups[@media-type="application/vnd.ibexa.api.UserGroupList+xml"]'); } /** - * @param \DOMDocument $dom - * * @depends testVisitWithoutEmbeddedVersion */ - public function testRolesHrefCorrect(\DOMDocument $dom) + public function testRolesHrefCorrect(DOMDocument $dom): void { - $this->assertXPath($dom, '/User/Roles[@href="/user/users/content23/roles"]'); + $this->assertXPath($dom, '/User/Roles[@href="/user/users/22/roles"]'); } /** - * @param \DOMDocument $dom - * * @depends testVisitWithoutEmbeddedVersion */ - public function testRolesMediaTypeCorrect(\DOMDocument $dom) + public function testRolesMediaTypeCorrect(DOMDocument $dom): void { $this->assertXPath($dom, '/User/Roles[@media-type="application/vnd.ibexa.api.RoleAssignmentList+xml"]'); } /** * Get the User visitor. - * - * @return \Ibexa\Rest\Server\Output\ValueObjectVisitor\RestUser */ - protected function internalGetVisitor() + protected function internalGetVisitor(): ValueObjectVisitor\RestUser { return new ValueObjectVisitor\RestUser(); } + + protected function getXPathFirstElementName(): string + { + return 'User'; + } } class_alias(RestUserTest::class, 'EzSystems\EzPlatformRest\Tests\Server\Output\ValueObjectVisitor\RestUserTest');