Skip to content
Snippets Groups Projects
Commit fe856ede authored by Oliver Hader's avatar Oliver Hader Committed by Oliver Hader
Browse files

[TASK] Add functional tests for discarding created elements

The workspaces API has the command "clearWSID" that reverts
elements that have been modified/created/deleted in a workspace.
The regular behavior is to keep the elements but mark it as
deleted and unset the value in "t3ver_wsid".

Resolves: #56179
Releases: 6.2
Change-Id: I55bc72add6f41449dd99f5b6b2816cd1cda3e092
Reviewed-on: https://review.typo3.org/27769
Reviewed-by: Oliver Hader
Tested-by: Oliver Hader
parent dd4a67c6
No related merge requests found
......@@ -81,6 +81,37 @@ abstract class AbstractActionTestCase extends \TYPO3\CMS\Core\Tests\Functional\D
$this->assertResponseContentHasRecords($responseContent, self::TABLE_Content, 'header', array('Testing #1', 'Testing #2'));
}
/**
* @test
*/
public function createContentRecordAndDiscardCreatedContentRecord() {
$newTableIds = $this->actionService->createNewRecord(self::TABLE_Content, self::VALUE_PageId, array('header' => 'Testing #1'));
$newContentId = $newTableIds[self::TABLE_Content][0];
$versionedNewContentId = $this->actionService->getDataHander()->getAutoVersionId(self::TABLE_Content, $newContentId);
$this->actionService->clearWorkspaceRecord(self::TABLE_Content, $versionedNewContentId);
$this->assertAssertionDataSet('createContentRecordAndDiscardCreatedContentRecord');
$responseContent = $this->getFrontendResponse(self::VALUE_PageId, 0, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseContent();
$this->assertResponseContentDoesNotHaveRecords($responseContent, self::TABLE_Content, 'header', 'Testing #1');
}
/**
* @test
*/
public function createAndCopyContentRecordAndDiscardCopiedContentRecord() {
$newTableIds = $this->actionService->createNewRecord(self::TABLE_Content, self::VALUE_PageId, array('header' => 'Testing #1'));
$newContentId = $newTableIds[self::TABLE_Content][0];
$copiedTableIds = $this->actionService->copyRecord(self::TABLE_Content, $newContentId, self::VALUE_PageId);
$copiedContentId = $copiedTableIds[self::TABLE_Content][$newContentId];
$versionedCopiedContentId = $this->actionService->getDataHander()->getAutoVersionId(self::TABLE_Content, $copiedContentId);
$this->actionService->clearWorkspaceRecord(self::TABLE_Content, $versionedCopiedContentId);
$this->assertAssertionDataSet('createAndCopyContentRecordAndDiscardCopiedContentRecord');
$responseContent = $this->getFrontendResponse(self::VALUE_PageId, 0, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseContent();
$this->assertResponseContentHasRecords($responseContent, self::TABLE_Content, 'header', 'Testing #1');
$this->assertResponseContentDoesNotHaveRecords($responseContent, self::TABLE_Content, 'header', 'Testing #1 (copy 1)');
}
/**
* @test
*/
......
tt_content
,uid,pid,sorting,deleted,sys_language_uid,l18n_parent,t3ver_wsid,t3ver_state,t3ver_stage,t3ver_oid,t3ver_move_id,header,image,tx_irretutorial_1nff_hotels
,297,89,256,0,0,0,0,0,0,0,0,"Regular Element #1",,0
,298,89,512,0,0,0,0,0,0,0,0,"Regular Element #2",,0
,299,89,128,0,0,0,1,1,0,0,0,"Testing #1",,0
,300,-1,128,0,0,0,1,-1,0,299,0,"Testing #1",,0
,301,89,1000000000,1,0,0,0,1,0,0,0,"Testing #1 (copy 1)",,0
,302,-1,1000000000,1,0,0,0,-1,0,301,0,"Testing #1 (copy 1)",0,0
tt_content
,uid,pid,sorting,deleted,sys_language_uid,l18n_parent,t3ver_wsid,t3ver_state,t3ver_stage,t3ver_oid,t3ver_move_id,header,image,tx_irretutorial_1nff_hotels
,297,89,256,0,0,0,0,0,0,0,0,"Regular Element #1",,0
,298,89,512,0,0,0,0,0,0,0,0,"Regular Element #2",,0
,299,89,1000000000,1,0,0,0,1,0,0,0,"Testing #1",,0
,300,-1,1000000000,1,0,0,0,-1,0,299,0,"Testing #1",,0
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment