Skip to content

Commit

Permalink
Merge branch '6.13' into 7.2
Browse files Browse the repository at this point in the history
  • Loading branch information
andrerom committed Oct 3, 2018
2 parents caaece5 + efc8431 commit 8ef5093
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Repository/ContentService.php
Expand Up @@ -283,7 +283,7 @@ public function publishVersion(VersionInfo $versionInfo);
* Removes the given version.
*
* @throws \eZ\Publish\API\Repository\Exceptions\BadStateException if the version is in
* published state or is a last version of the Content
* published state or is a last version of Content in non draft state
* @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed to remove this version
*
* @param \eZ\Publish\API\Repository\Values\Content\VersionInfo $versionInfo
Expand Down
10 changes: 6 additions & 4 deletions Repository/Tests/ContentServiceTest.php
Expand Up @@ -3086,12 +3086,12 @@ public function testDeleteVersionThrowsBadStateExceptionOnPublishedVersion()
* Test for the deleteVersion() method.
*
* @see \eZ\Publish\API\Repository\ContentService::deleteVersion()
* @expectedException \eZ\Publish\API\Repository\Exceptions\BadStateException
* @expectedException \eZ\Publish\API\Repository\Exceptions\NotFoundException
* @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testLoadContent
* @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testCreateContent
* @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testPublishVersion
*/
public function testDeleteVersionThrowsBadStateExceptionOnLastVersion()
public function testDeleteVersionWorksIfOnlyVersionIsDraft()
{
$repository = $this->getRepository();

Expand All @@ -3100,9 +3100,11 @@ public function testDeleteVersionThrowsBadStateExceptionOnLastVersion()
/* BEGIN: Use Case */
$draft = $this->createContentDraftVersion1();

// This call will fail with a "BadStateException", because the Content
// version is the last version of the Content.
$contentService->deleteVersion($draft->getVersionInfo());

// This call will fail with a "NotFound", because we allow to delete content if remaining version is draft.
// Can normally only happen if there where always only a draft to begin with, simplifies UI edit API usage.
$contentService->loadContent($draft->id);
/* END: Use Case */
}

Expand Down

0 comments on commit 8ef5093

Please sign in to comment.