diff --git a/Repository/Tests/BaseContentServiceTest.php b/Repository/Tests/BaseContentServiceTest.php
index de8f277ff..e2dd951ae 100644
--- a/Repository/Tests/BaseContentServiceTest.php
+++ b/Repository/Tests/BaseContentServiceTest.php
@@ -184,6 +184,52 @@ protected function createUpdatedDraftVersion2()
return $draftVersion2;
}
+ /**
+ * Creates an updated content draft named $draftVersion2 from
+ * a currently published content object with a user different from the
+ * creator.
+ *
+ * @return array \eZ\Publish\API\Repository\Values\Content\Content, id
+ */
+ protected function createUpdatedDraftVersion2_NotAdmin()
+ {
+ $repository = $this->getRepository();
+
+ $contentService = $repository->getContentService();
+ $userService = $repository->getUserService();
+ $mainLanguageCode = 'eng-US';
+
+ // Create a new user that belongs to the Administrator users group
+ $newUserCreateStruct = $userService->newUserCreateStruct( 'admin2', 'admin2@ez.no', "admin2", $mainLanguageCode );
+ $newUserCreateStruct->setField( 'first_name', 'Admin2', $mainLanguageCode );
+ $newUserCreateStruct->setField( 'last_name', 'Admin2', $mainLanguageCode );
+
+ // Load the Admin Group
+ $userAdminGroup = $userService->loadUserGroup( '12' );
+
+ $userAdmin2 = $userService->createUser( $newUserCreateStruct, array ( $userAdminGroup ) );
+
+ /* BEGIN: Inline */
+ $draftVersion2 = $this->createContentDraftVersion2();
+
+ // Create an update struct and modify some fields
+ $contentUpdate = $contentService->newContentUpdateStruct();
+ $contentUpdate->initialLanguageCode = $mainLanguageCode;
+
+ $contentUpdate->creatorId = $this->generateId( 'user', $userAdmin2->id );
+ $contentUpdate->setField( 'name', 'An awesome forum²' );
+ $contentUpdate->setField( 'name', 'An awesome forum²³', 'eng-GB' );
+
+ // Update the content draft
+ $draftVersion2 = $contentService->updateContent(
+ $draftVersion2->getVersionInfo(),
+ $contentUpdate
+ );
+ /* END: Inline */
+
+ return array( $draftVersion2, $userAdmin2->id );
+ }
+
/**
* Creates an updated content object named $contentVersion2 from
* a currently published content object.
diff --git a/Repository/Tests/ContentServiceTest.php b/Repository/Tests/ContentServiceTest.php
index 0e5d40da4..23fdb83c7 100644
--- a/Repository/Tests/ContentServiceTest.php
+++ b/Repository/Tests/ContentServiceTest.php
@@ -1306,6 +1306,36 @@ public function testUpdateContent()
return $draftVersion2;
}
+ /**
+ * Test for the updateContent_WithDifferentUser() method.
+ *
+ * @return \eZ\Publish\API\Repository\Values\Content\Content
+ * @see \eZ\Publish\API\Repository\ContentService::updateContent()
+ * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testNewContentUpdateStruct
+ * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testCreateContentDraft
+ * @group user
+ * @group field-type
+ */
+ public function testUpdateContent_WithDifferentUser()
+ {
+ /* BEGIN: Use Case */
+ $arrayWithDraftVersion2 = $this->createUpdatedDraftVersion2_NotAdmin();
+ /* END: Use Case */
+
+ $this->assertInstanceOf(
+ '\\eZ\\Publish\\API\\Repository\\Values\\Content\\Content',
+ $arrayWithDraftVersion2[0]
+ );
+
+ $this->assertEquals(
+ $this->generateId( 'user', $arrayWithDraftVersion2[1] ),
+ $arrayWithDraftVersion2[0]->versionInfo->creatorId,
+ "creatorId is not properly set on new Version"
+ );
+
+ return $arrayWithDraftVersion2[0];
+ }
+
/**
* Test for the updateContent() method.
*