[TASK] Extend workspace functional tests on placeholder deletion 39/45339/2
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:09:05 +0000 (17:09 +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/45339
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 3384710..1eeb0b5 100644 (file)
@@ -21,6 +21,7 @@ require_once __DIR__ . '/../../../../../core/Tests/Functional/DataHandling/Abstr
  */
 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;
@@ -428,4 +429,34 @@ 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 62f7d37..49fa057 100644 (file)
@@ -539,4 +539,22 @@ 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 08e5013..29e9972 100644 (file)
@@ -361,4 +361,14 @@ class ActionTest extends \TYPO3\CMS\Workspaces\Tests\Functional\DataHandling\Reg
                        ->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 d069ce5..db57406 100644 (file)
@@ -333,4 +333,28 @@ class ActionTest extends \TYPO3\CMS\Workspaces\Tests\Functional\DataHandling\Reg
                        ->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"