[TASK] Extend workspace functional tests on placeholder deletion 29/45329/5
authorOliver Hader <oliver@typo3.org>
Thu, 17 Dec 2015 10:47:26 +0000 (11:47 +0100)
committerOliver Hader <oliver.hader@typo3.org>
Thu, 17 Dec 2015 16:08:42 +0000 (17:08 +0100)
Actions performed in a workspace:
* move existing page below sibling on same level (move-placeholder)
* create new page on parent page (new-placeholder)
* delete the parent page

Attention:
The test assertions reflect the status quo which is faulty and has
to be fixed on a separate bugfix.

Resolves: #72291
Releases: master, 6.2
Change-Id: I85e10569c36a4c669a479434a5ce973d3fb9fe5c
Reviewed-on: https://review.typo3.org/45329
Reviewed-by: Oliver Hader <oliver.hader@typo3.org>
Tested-by: Oliver Hader <oliver.hader@typo3.org>
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/createPlaceholdersAndDeleteDraftParentPage.csv [new file with mode: 0644]
typo3/sysext/workspaces/Tests/Functional/DataHandling/Regular/Modify/DataSet/createPlaceholdersAndDeleteLiveParentPage.csv [new file with mode: 0644]
typo3/sysext/workspaces/Tests/Functional/DataHandling/Regular/Publish/ActionTest.php
typo3/sysext/workspaces/Tests/Functional/DataHandling/Regular/Publish/DataSet/createPlaceholdersAndDeleteDraftParentPage.csv [new file with mode: 0644]
typo3/sysext/workspaces/Tests/Functional/DataHandling/Regular/PublishAll/ActionTest.php
typo3/sysext/workspaces/Tests/Functional/DataHandling/Regular/PublishAll/DataSet/createPlaceholdersAndDeleteDraftParentPage.csv [new file with mode: 0644]
typo3/sysext/workspaces/Tests/Functional/DataHandling/Regular/PublishAll/DataSet/createPlaceholdersAndDeleteLiveParentPage.csv [new file with mode: 0644]

index ac5fb91..28838d3 100644 (file)
@@ -19,6 +19,7 @@ namespace TYPO3\CMS\Workspaces\Tests\Functional\DataHandling\Regular;
  */
 abstract class AbstractActionTestCase extends \TYPO3\CMS\Core\Tests\Functional\DataHandling\AbstractDataHandlerActionTestCase
 {
+    const VALUE_ParentPageId = 88;
     const VALUE_PageId = 89;
     const VALUE_PageIdTarget = 90;
     const VALUE_PageIdWebsite = 1;
@@ -461,4 +462,35 @@ abstract class AbstractActionTestCase extends \TYPO3\CMS\Core\Tests\Functional\D
         $this->backendUser->workspace = static::VALUE_WorkspaceId;
     }
 
+    /**
+     * Creates new and move placeholders for pages and deleted the parent page in draft workspace.
+     */
+    public function createPlaceholdersAndDeleteDraftParentPage()
+    {
+        $this->backendUser->uc['recursiveDelete'] = true;
+
+        $this->actionService->moveRecord(self::TABLE_Page, self::VALUE_PageId, -self::VALUE_PageIdTarget);
+        $this->actionService->createNewRecord(self::TABLE_Page, self::VALUE_ParentPageId, array('title' => 'Testing #1'));
+        $newTableIds = $this->actionService->deleteRecord(self::TABLE_Page, self::VALUE_ParentPageId);
+        $this->recordIds['deletedPageId'] = $newTableIds[self::TABLE_Page][self::VALUE_ParentPageId];
+    }
+
+    /**
+     * Creates new and move placeholders for pages and deleted the parent page in live workspace.
+     */
+    public function createPlaceholdersAndDeleteLiveParentPage()
+    {
+        $this->backendUser->uc['recursiveDelete'] = true;
+
+        $this->actionService->moveRecord(self::TABLE_Page, self::VALUE_PageId, -self::VALUE_PageIdTarget);
+        $this->actionService->createNewRecord(self::TABLE_Page, self::VALUE_ParentPageId, array('title' => 'Testing #1'));
+
+        // Switch to live workspace
+        $this->backendUser->workspace = 0;
+
+        $this->actionService->deleteRecord(self::TABLE_Page, self::VALUE_ParentPageId);
+
+        // Switch back to draft workspace
+        $this->backendUser->workspace = static::VALUE_WorkspaceId;
+    }
 }
index b6691b1..00e9514 100644 (file)
@@ -575,4 +575,23 @@ class ActionTest extends \TYPO3\CMS\Workspaces\Tests\Functional\DataHandling\Reg
             ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #0'));
     }
 
+    /**
+     * @test
+     * @see DataSet/createPlaceholdersAndDeleteDraftParentPage.csv
+     */
+    public function createPlaceholdersAndDeleteDraftParentPage()
+    {
+        parent::createPlaceholdersAndDeleteDraftParentPage();
+        $this->assertAssertionDataSet('createPlaceholdersAndDeleteDraftParentPage');
+    }
+
+    /**
+     * @test
+     * @see DataSet/createPlaceholdersAndDeleteLiveParentPage.csv
+     */
+    public function createPlaceholdersAndDeleteLiveParentPage()
+    {
+        parent::createPlaceholdersAndDeleteLiveParentPage();
+        $this->assertAssertionDataSet('createPlaceholdersAndDeleteLiveParentPage');
+    }
 }
diff --git a/typo3/sysext/workspaces/Tests/Functional/DataHandling/Regular/Modify/DataSet/createPlaceholdersAndDeleteDraftParentPage.csv b/typo3/sysext/workspaces/Tests/Functional/DataHandling/Regular/Modify/DataSet/createPlaceholdersAndDeleteDraftParentPage.csv
new file mode 100644 (file)
index 0000000..b51db5c
--- /dev/null
@@ -0,0 +1,19 @@
+pages
+,uid,pid,sorting,deleted,t3ver_wsid,t3ver_state,t3ver_stage,t3ver_oid,t3ver_move_id,title
+,1,0,256,0,0,0,0,0,0,FunctionalTest
+,88,1,256,0,0,0,0,0,0,DataHandlerTest
+,89,88,256,0,0,0,0,0,0,Relations
+,90,88,512,0,0,0,0,0,0,Target
+,91,-1,256,0,1,4,0,89,0,Relations
+,92,88,768,0,1,3,0,0,89,"[MOVE-TO PLACEHOLDER for #89, WS#1]"
+,93,88,128,0,1,1,0,0,0,"Testing #1"
+,94,-1,128,0,1,-1,0,93,0,"Testing #1"
+,95,-1,256,0,1,2,0,88,0,DataHandlerTest
+tt_content
+,uid,pid,sorting,deleted,sys_language_uid,l18n_parent,t3ver_wsid,t3ver_state,t3ver_stage,t3ver_oid,t3ver_move_id,header
+,296,88,256,0,0,0,0,0,0,0,0,"Regular Element #0"
+,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"
diff --git a/typo3/sysext/workspaces/Tests/Functional/DataHandling/Regular/Modify/DataSet/createPlaceholdersAndDeleteLiveParentPage.csv b/typo3/sysext/workspaces/Tests/Functional/DataHandling/Regular/Modify/DataSet/createPlaceholdersAndDeleteLiveParentPage.csv
new file mode 100644 (file)
index 0000000..8792061
--- /dev/null
@@ -0,0 +1,18 @@
+pages
+,uid,pid,sorting,deleted,t3ver_wsid,t3ver_state,t3ver_stage,t3ver_oid,t3ver_move_id,title
+,1,0,256,0,0,0,0,0,0,FunctionalTest
+,88,1,1000000000,1,0,0,0,0,0,DataHandlerTest
+,89,88,1000000000,1,0,0,0,0,0,Relations
+,90,88,1000000000,1,0,0,0,0,0,Target
+,91,-1,1000000000,1,1,4,0,89,0,Relations
+,92,88,1000000000,1,1,3,0,0,89,"[MOVE-TO PLACEHOLDER for #89, WS#1]"
+,93,88,1000000000,1,1,1,0,0,0,"Testing #1"
+,94,-1,1000000000,1,1,-1,0,93,0,"Testing #1"
+tt_content
+,uid,pid,sorting,deleted,sys_language_uid,l18n_parent,t3ver_wsid,t3ver_state,t3ver_stage,t3ver_oid,t3ver_move_id,header
+,296,88,1000000000,1,0,0,0,0,0,0,0,"Regular Element #0"
+,297,89,1000000000,1,0,0,0,0,0,0,0,"Regular Element #1"
+,298,89,1000000000,1,0,0,0,0,0,0,0,"Regular Element #2"
+,299,89,1000000000,1,0,0,0,0,0,0,0,"Regular Element #3"
+,300,89,1000000000,1,1,299,0,0,0,0,0,"[Translate to Dansk:] Regular Element #3"
+,301,-1,1000000000,1,0,0,2,2,0,298,0,"Regular Element #2"
index 56d2cb6..3afc35f 100644 (file)
@@ -378,4 +378,15 @@ class ActionTest extends \TYPO3\CMS\Workspaces\Tests\Functional\DataHandling\Reg
             ->setRecordIdentifier(self::TABLE_Page . ':' . self::VALUE_PageIdWebsite)->setRecordField('__pages')
             ->setTable(self::TABLE_Page)->setField('title')->setValues('Target', 'Testing #1', 'DataHandlerTest'));
     }
+
+    /**
+     * @test
+     * @see DataSet/createPlaceholdersAndDeleteDraftParentPage.csv
+     */
+    public function createPlaceholdersAndDeleteDraftParentPage()
+    {
+        parent::createPlaceholdersAndDeleteDraftParentPage();
+        $this->actionService->publishRecord(self::TABLE_Page, self::VALUE_ParentPageId);
+        $this->assertAssertionDataSet('createPlaceholdersAndDeleteDraftParentPage');
+    }
 }
diff --git a/typo3/sysext/workspaces/Tests/Functional/DataHandling/Regular/Publish/DataSet/createPlaceholdersAndDeleteDraftParentPage.csv b/typo3/sysext/workspaces/Tests/Functional/DataHandling/Regular/Publish/DataSet/createPlaceholdersAndDeleteDraftParentPage.csv
new file mode 100644 (file)
index 0000000..e1b0e1c
--- /dev/null
@@ -0,0 +1,21 @@
+pages
+,uid,pid,sorting,deleted,t3ver_wsid,t3ver_state,t3ver_stage,t3ver_oid,t3ver_move_id,title
+,1,0,1000000000,1,0,0,0,0,0,FunctionalTest
+,88,1,1000000000,1,0,0,0,0,0,DataHandlerTest
+,89,88,1000000000,1,0,0,0,0,0,Relations
+,90,88,1000000000,1,0,0,0,0,0,Target
+,91,-1,1000000000,1,1,4,0,89,0,Relations
+,93,88,1000000000,1,1,1,0,0,0,"Testing #1"
+,94,-1,1000000000,1,1,-1,0,93,0,"Testing #1"
+,95,-1,1000000000,1,0,0,0,88,0,DataHandlerTest
+,96,88,1000000000,1,1,1,0,0,0,"Relations (copy 1)"
+,97,-1,1000000000,1,1,-1,0,96,0,"Relations (copy 1)"
+tt_content
+,uid,pid,sorting,deleted,sys_language_uid,l18n_parent,t3ver_wsid,t3ver_state,t3ver_stage,t3ver_oid,t3ver_move_id,header
+,296,88,1000000000,1,0,0,0,0,0,0,0,"Regular Element #0"
+,297,89,1000000000,1,0,0,0,0,0,0,0,"Regular Element #1"
+,298,89,1000000000,1,0,0,0,0,0,0,0,"Regular Element #2"
+,299,89,1000000000,1,0,0,0,0,0,0,0,"Regular Element #3"
+,300,89,1000000000,1,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,1,299,1,2,0,300,0,"[Translate to Dansk:] Regular Element #3"
index 5f350eb..8e7dcd7 100644 (file)
@@ -350,4 +350,30 @@ class ActionTest extends \TYPO3\CMS\Workspaces\Tests\Functional\DataHandling\Reg
             ->setRecordIdentifier(self::TABLE_Page . ':' . self::VALUE_PageIdWebsite)->setRecordField('__pages')
             ->setTable(self::TABLE_Page)->setField('title')->setValues('Target', 'Testing #1', 'DataHandlerTest'));
     }
+
+    /**
+     * @test
+     * @see DataSet/createPlaceholdersAndDeleteDraftParentPage.csv
+     */
+    public function createPlaceholdersAndDeleteDraftParentPage()
+    {
+        // @todo These two log entries could be avoided in DataHandlerHook, but are expected
+        // "[newlog()] Error: You cannot swap versions for a record you do not have access to edit!"
+        $this->expectedErrorLogEntries = 2;
+
+        parent::createPlaceholdersAndDeleteDraftParentPage();
+        $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
+        $this->assertAssertionDataSet('createPlaceholdersAndDeleteDraftParentPage');
+    }
+
+    /**
+     * @test
+     * @see DataSet/createPlaceholdersAndDeleteLiveParentPage.csv
+     */
+    public function createPlaceholdersAndDeleteLiveParentPage()
+    {
+        parent::createPlaceholdersAndDeleteLiveParentPage();
+        $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
+        $this->assertAssertionDataSet('createPlaceholdersAndDeleteLiveParentPage');
+    }
 }
diff --git a/typo3/sysext/workspaces/Tests/Functional/DataHandling/Regular/PublishAll/DataSet/createPlaceholdersAndDeleteDraftParentPage.csv b/typo3/sysext/workspaces/Tests/Functional/DataHandling/Regular/PublishAll/DataSet/createPlaceholdersAndDeleteDraftParentPage.csv
new file mode 100644 (file)
index 0000000..e1b0e1c
--- /dev/null
@@ -0,0 +1,21 @@
+pages
+,uid,pid,sorting,deleted,t3ver_wsid,t3ver_state,t3ver_stage,t3ver_oid,t3ver_move_id,title
+,1,0,1000000000,1,0,0,0,0,0,FunctionalTest
+,88,1,1000000000,1,0,0,0,0,0,DataHandlerTest
+,89,88,1000000000,1,0,0,0,0,0,Relations
+,90,88,1000000000,1,0,0,0,0,0,Target
+,91,-1,1000000000,1,1,4,0,89,0,Relations
+,93,88,1000000000,1,1,1,0,0,0,"Testing #1"
+,94,-1,1000000000,1,1,-1,0,93,0,"Testing #1"
+,95,-1,1000000000,1,0,0,0,88,0,DataHandlerTest
+,96,88,1000000000,1,1,1,0,0,0,"Relations (copy 1)"
+,97,-1,1000000000,1,1,-1,0,96,0,"Relations (copy 1)"
+tt_content
+,uid,pid,sorting,deleted,sys_language_uid,l18n_parent,t3ver_wsid,t3ver_state,t3ver_stage,t3ver_oid,t3ver_move_id,header
+,296,88,1000000000,1,0,0,0,0,0,0,0,"Regular Element #0"
+,297,89,1000000000,1,0,0,0,0,0,0,0,"Regular Element #1"
+,298,89,1000000000,1,0,0,0,0,0,0,0,"Regular Element #2"
+,299,89,1000000000,1,0,0,0,0,0,0,0,"Regular Element #3"
+,300,89,1000000000,1,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,1,299,1,2,0,300,0,"[Translate to Dansk:] Regular Element #3"
diff --git a/typo3/sysext/workspaces/Tests/Functional/DataHandling/Regular/PublishAll/DataSet/createPlaceholdersAndDeleteLiveParentPage.csv b/typo3/sysext/workspaces/Tests/Functional/DataHandling/Regular/PublishAll/DataSet/createPlaceholdersAndDeleteLiveParentPage.csv
new file mode 100644 (file)
index 0000000..8792061
--- /dev/null
@@ -0,0 +1,18 @@
+pages
+,uid,pid,sorting,deleted,t3ver_wsid,t3ver_state,t3ver_stage,t3ver_oid,t3ver_move_id,title
+,1,0,256,0,0,0,0,0,0,FunctionalTest
+,88,1,1000000000,1,0,0,0,0,0,DataHandlerTest
+,89,88,1000000000,1,0,0,0,0,0,Relations
+,90,88,1000000000,1,0,0,0,0,0,Target
+,91,-1,1000000000,1,1,4,0,89,0,Relations
+,92,88,1000000000,1,1,3,0,0,89,"[MOVE-TO PLACEHOLDER for #89, WS#1]"
+,93,88,1000000000,1,1,1,0,0,0,"Testing #1"
+,94,-1,1000000000,1,1,-1,0,93,0,"Testing #1"
+tt_content
+,uid,pid,sorting,deleted,sys_language_uid,l18n_parent,t3ver_wsid,t3ver_state,t3ver_stage,t3ver_oid,t3ver_move_id,header
+,296,88,1000000000,1,0,0,0,0,0,0,0,"Regular Element #0"
+,297,89,1000000000,1,0,0,0,0,0,0,0,"Regular Element #1"
+,298,89,1000000000,1,0,0,0,0,0,0,0,"Regular Element #2"
+,299,89,1000000000,1,0,0,0,0,0,0,0,"Regular Element #3"
+,300,89,1000000000,1,1,299,0,0,0,0,0,"[Translate to Dansk:] Regular Element #3"
+,301,-1,1000000000,1,0,0,2,2,0,298,0,"Regular Element #2"