[TASK] Extend workspaces functional tests concerning move-placeholders 30/43430/2
authorOliver Hader <oliver@typo3.org>
Sat, 19 Sep 2015 09:56:59 +0000 (11:56 +0200)
committerOliver Hader <oliver.hader@typo3.org>
Sat, 19 Sep 2015 10:51:35 +0000 (12:51 +0200)
The "modify" functional tests are extended concerning move-placeholders:
* changeContentSortingAndDeleteMovedRecord
  * in a draft workspace
  * change sorting of element on the same page
  * delete the moved element
* changeContentSortingAndDeleteLiveRecord
  * in a draft workspace
  * change sorting of element on the same page
  * switch to live workspace
  * delete the moved element

The test results reveal problematic states in the database and are used
to proof correct and complete changes of further DataHandler changes in
that regard.

Resolves: #69969
Releases: master, 6.2
Change-Id: I06863ba17e74a698833a665d73269951fed9392e
Reviewed-on: http://review.typo3.org/43430
Reviewed-by: Oliver Hader <oliver.hader@typo3.org>
Tested-by: Oliver Hader <oliver.hader@typo3.org>
typo3/sysext/core/Tests/Functional/DataHandling/Framework/ActionService.php
typo3/sysext/workspaces/Tests/Functional/DataHandling/Regular/AbstractActionTestCase.php
typo3/sysext/workspaces/Tests/Functional/DataHandling/Regular/Modify/ActionTest.php
typo3/sysext/workspaces/Tests/Functional/DataHandling/Regular/Modify/DataSet/changeContentSortingNDeleteLiveRecord.csv [new file with mode: 0644]
typo3/sysext/workspaces/Tests/Functional/DataHandling/Regular/Modify/DataSet/changeContentSortingNDeleteMovedRecord.csv [new file with mode: 0644]

index 5d32b25..d3312aa 100644 (file)
@@ -247,6 +247,7 @@ class ActionService {
         * @param int $uid
         * @param int $pageId
         * @param NULL|array $recordData
+        * @return array
         */
        public function moveRecord($tableName, $uid, $pageId, array $recordData = NULL) {
                $commandMap = array(
@@ -266,6 +267,7 @@ class ActionService {
                $this->createDataHandler();
                $this->dataHandler->start(array(), $commandMap);
                $this->dataHandler->process_cmdmap();
+               return $this->dataHandler->copyMappingArray;
        }
 
        /**
index 3000887..8b328c0 100644 (file)
@@ -141,6 +141,26 @@ abstract class AbstractActionTestCase extends \TYPO3\CMS\Core\Tests\Functional\D
        }
 
        /**
+        * @see DataSet/changeContentSortingNDeleteMovedRecord.csv
+        */
+       public function changeContentSortingAndDeleteMovedRecord() {
+               $this->actionService->moveRecord(self::TABLE_Content, self::VALUE_ContentIdFirst, -self::VALUE_ContentIdSecond);
+               $this->actionService->deleteRecord(self::TABLE_Content, self::VALUE_ContentIdFirst);
+       }
+
+       /**
+        * @see DataSet/changeContentSortingNDeleteLiveRecord.csv
+        */
+       public function changeContentSortingAndDeleteLiveRecord() {
+               $this->actionService->moveRecord(self::TABLE_Content, self::VALUE_ContentIdFirst, -self::VALUE_ContentIdSecond);
+               // Switch to live workspace
+               $this->backendUser->workspace = 0;
+               $this->actionService->deleteRecord(self::TABLE_Content, self::VALUE_ContentIdFirst);
+               // Switch back to draft workspace
+               $this->backendUser->workspace = static::VALUE_WorkspaceId;
+       }
+
+       /**
         * @see DataSet/Assertion/moveContentRecordToDifferentPage.csv
         */
        public function moveContentToDifferentPage() {
index a76a96a..da1ee2c 100644 (file)
@@ -151,6 +151,34 @@ class ActionTest extends \TYPO3\CMS\Workspaces\Tests\Functional\DataHandling\Reg
 
        /**
         * @test
+        * @see DataSet/changeContentSortingNDeleteMovedRecord.csv
+        */
+       public function changeContentSortingAndDeleteMovedRecord() {
+               parent::changeContentSortingAndDeleteMovedRecord();
+               $this->assertAssertionDataSet('changeContentSortingNDeleteMovedRecord');
+
+               $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseSections();
+               $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
+                       ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #1', 'Regular Element #2'));
+       }
+
+       /**
+        * @test
+        * @see DataSet/changeContentSortingNDeleteLiveRecord.csv
+        */
+       public function changeContentSortingAndDeleteLiveRecord() {
+               parent::changeContentSortingAndDeleteLiveRecord();
+               $this->assertAssertionDataSet('changeContentSortingNDeleteLiveRecord');
+
+               $responseSections = $this->getFrontendResponse(self::VALUE_PageId, 0, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseSections();
+               $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
+                       ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #2'));
+               $this->assertThat($responseSections, $this->getRequestSectionDoesNotHaveRecordConstraint()
+                       ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #1'));
+       }
+
+       /**
+        * @test
         * @see DataSet/Assertion/moveContentRecordToDifferentPage.csv
         */
        public function moveContentToDifferentPage() {
diff --git a/typo3/sysext/workspaces/Tests/Functional/DataHandling/Regular/Modify/DataSet/changeContentSortingNDeleteLiveRecord.csv b/typo3/sysext/workspaces/Tests/Functional/DataHandling/Regular/Modify/DataSet/changeContentSortingNDeleteLiveRecord.csv
new file mode 100644 (file)
index 0000000..78a0d0b
--- /dev/null
@@ -0,0 +1,9 @@
+tt_content
+,uid,pid,sorting,deleted,sys_language_uid,l18n_parent,t3ver_wsid,t3ver_state,t3ver_stage,t3ver_oid,t3ver_move_id,header
+,297,89,1000000000,1,0,0,0,0,0,0,0,"Regular Element #1"
+,298,89,512,0,0,0,0,0,0,0,0,"Regular Element #2"
+,299,89,768,0,0,0,0,0,0,0,0,"Regular Element #3"
+,300,89,1024,0,1,299,0,0,0,0,0,"[Translate to Dansk:] Regular Element #3"
+,301,-1,512,0,0,0,2,2,0,298,0,"Regular Element #2"
+,302,-1,256,0,0,0,1,4,0,297,0,"Regular Element #1"
+,303,89,640,0,0,0,1,3,0,0,297,"[MOVE-TO PLACEHOLDER for #297, WS#1]"
diff --git a/typo3/sysext/workspaces/Tests/Functional/DataHandling/Regular/Modify/DataSet/changeContentSortingNDeleteMovedRecord.csv b/typo3/sysext/workspaces/Tests/Functional/DataHandling/Regular/Modify/DataSet/changeContentSortingNDeleteMovedRecord.csv
new file mode 100644 (file)
index 0000000..612aa94
--- /dev/null
@@ -0,0 +1,9 @@
+tt_content
+,uid,pid,sorting,deleted,sys_language_uid,l18n_parent,t3ver_wsid,t3ver_state,t3ver_stage,t3ver_oid,t3ver_move_id,header
+,297,89,256,0,0,0,0,0,0,0,0,"Regular Element #1"
+,298,89,512,0,0,0,0,0,0,0,0,"Regular Element #2"
+,299,89,768,0,0,0,0,0,0,0,0,"Regular Element #3"
+,300,89,1024,0,1,299,0,0,0,0,0,"[Translate to Dansk:] Regular Element #3"
+,301,-1,512,0,0,0,2,2,0,298,0,"Regular Element #2"
+,302,-1,1000000000,1,0,0,1,4,0,297,0,"Regular Element #1"
+,303,89,640,0,0,0,1,3,0,0,297,"[MOVE-TO PLACEHOLDER for #297, WS#1]"