[TASK] Add ManyToMany copyPage functional test 88/28488/2
authorOliver Hader <oliver@typo3.org>
Tue, 18 Mar 2014 11:19:30 +0000 (12:19 +0100)
committerOliver Hader <oliver.hader@typo3.org>
Tue, 18 Mar 2014 21:11:48 +0000 (22:11 +0100)
Add the copyPage() functional test for live and workspace.

Resolves: #57030
Releases: 6.2
Change-Id: Id9ddea21a50c449c3f2674d704c10fefb2da12ff
Reviewed-on: https://review.typo3.org/28488
Reviewed-by: Oliver Hader
Tested-by: Oliver Hader
typo3/sysext/core/Tests/Functional/DataHandling/ManyToMany/AbstractActionTestCase.php
typo3/sysext/core/Tests/Functional/DataHandling/ManyToMany/DataSet/Assertion/copyPage.csv [new file with mode: 0644]
typo3/sysext/workspaces/Tests/Functional/DataHandling/ManyToMany/AbstractActionTestCase.php
typo3/sysext/workspaces/Tests/Functional/DataHandling/ManyToMany/Modify/ActionTest.php
typo3/sysext/workspaces/Tests/Functional/DataHandling/ManyToMany/Modify/DataSet/copyPage.csv [new file with mode: 0644]
typo3/sysext/workspaces/Tests/Functional/DataHandling/ManyToMany/Publish/ActionTest.php
typo3/sysext/workspaces/Tests/Functional/DataHandling/ManyToMany/Publish/DataSet/copyPage.csv [new file with mode: 0644]
typo3/sysext/workspaces/Tests/Functional/DataHandling/ManyToMany/PublishAll/ActionTest.php
typo3/sysext/workspaces/Tests/Functional/DataHandling/ManyToMany/PublishAll/DataSet/copyPage.csv [new file with mode: 0644]

index 326fe35..df63623 100644 (file)
@@ -39,6 +39,7 @@ abstract class AbstractActionTestCase extends \TYPO3\CMS\Core\Tests\Functional\D
        const VALUE_CategoryIdFirst = 28;
        const VALUE_CategoryIdSecond = 29;
 
+       const TABLE_Page = 'pages';
        const TABLE_Content = 'tt_content';
        const TABLE_Category = 'sys_category';
        const TABLE_ContentCategory_ManyToMany = 'sys_category_record_mm';
@@ -267,4 +268,28 @@ abstract class AbstractActionTestCase extends \TYPO3\CMS\Core\Tests\Functional\D
                );
        }
 
+       /**
+        * @test
+        * @see DataSet/Assertion/copyPage.csv
+        */
+       public function copyPage() {
+               $newTableIds = $this->actionService->copyRecord(self::TABLE_Page, self::VALUE_PageId, self::VALUE_PageIdTarget);
+               $this->recordIds['newPageId'] = $newTableIds[self::TABLE_Page][self::VALUE_PageId];
+               $this->recordIds['newContentIdFirst'] = $newTableIds[self::TABLE_Content][self::VALUE_ContentIdFirst];
+               $this->recordIds['newContentIdLast'] = $newTableIds[self::TABLE_Content][self::VALUE_ContentIdLast];
+               $this->assertAssertionDataSet('copyPage');
+
+               $responseContent = $this->getFrontendResponse($this->recordIds['newPageId'])->getResponseContent();
+               $this->assertResponseContentHasRecords($responseContent, self::TABLE_Page, 'title', 'Relations');
+               $this->assertResponseContentHasRecords($responseContent, self::TABLE_Content, 'header', array('Regular Element #1', 'Regular Element #2'));
+               $this->assertResponseContentStructureHasRecords(
+                       $responseContent, self::TABLE_Content . ':' . $this->recordIds['newContentIdFirst'], 'categories',
+                       self::TABLE_Category, 'title', array('Category A', 'Category B')
+               );
+               $this->assertResponseContentStructureHasRecords(
+                       $responseContent, self::TABLE_Content . ':' . $this->recordIds['newContentIdLast'], 'categories',
+                       self::TABLE_Category, 'title', array('Category B', 'Category C')
+               );
+       }
+
 }
diff --git a/typo3/sysext/core/Tests/Functional/DataHandling/ManyToMany/DataSet/Assertion/copyPage.csv b/typo3/sysext/core/Tests/Functional/DataHandling/ManyToMany/DataSet/Assertion/copyPage.csv
new file mode 100644 (file)
index 0000000..83e8b71
--- /dev/null
@@ -0,0 +1,29 @@
+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,90,256,0,0,0,0,0,0,Relations
+sys_category
+,uid,pid,sorting,deleted,sys_language_uid,l10n_parent,t3ver_wsid,t3ver_state,t3ver_stage,t3ver_oid,t3ver_move_id,title,parent,items
+,28,0,256,0,0,0,0,0,0,0,0,"Category A",0,0
+,29,0,512,0,0,0,0,0,0,0,0,"Category B",0,0
+,30,0,768,0,0,0,0,0,0,0,0,"Category C",0,0
+,31,0,1024,0,0,0,0,0,0,0,0,"Category A.A",28,0
+sys_category_record_mm
+,uid_local,uid_foreign,tablenames,sorting,sorting_foreign,fieldname
+,28,297,tt_content,0,1,categories
+,29,297,tt_content,0,2,categories
+,29,298,tt_content,0,1,categories
+,30,298,tt_content,0,2,categories
+,29,299,tt_content,0,1,categories
+,30,299,tt_content,0,2,categories
+,28,300,tt_content,0,1,categories
+,29,300,tt_content,0,2,categories
+tt_content
+,uid,pid,sorting,deleted,sys_language_uid,l18n_parent,t3ver_wsid,t3ver_state,t3ver_stage,t3ver_oid,t3ver_move_id,header,image,categories
+,297,89,256,0,0,0,0,0,0,0,0,"Regular Element #1",,2
+,298,89,512,0,0,0,0,0,0,0,0,"Regular Element #2",,2
+,299,91,256,0,0,0,0,0,0,0,0,"Regular Element #2",0,2
+,300,91,128,0,0,0,0,0,0,0,0,"Regular Element #1",0,2
index 7906143..8fb80f2 100644 (file)
@@ -41,6 +41,7 @@ abstract class AbstractActionTestCase extends \TYPO3\CMS\Core\Tests\Functional\D
        const VALUE_CategoryIdLast = 31;
        const VALUE_WorkspaceId = 1;
 
+       const TABLE_Page = 'pages';
        const TABLE_Content = 'tt_content';
        const TABLE_Category = 'sys_category';
        const TABLE_ContentCategory_ManyToMany = 'sys_category_record_mm';
@@ -231,4 +232,14 @@ abstract class AbstractActionTestCase extends \TYPO3\CMS\Core\Tests\Functional\D
                $this->actionService->moveRecord(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_PageIdTarget);
        }
 
+       /**
+        * @see DataSet/Assertion/copyPage.csv
+        */
+       public function copyPage() {
+               $newTableIds = $this->actionService->copyRecord(self::TABLE_Page, self::VALUE_PageId, self::VALUE_PageIdTarget);
+               $this->recordIds['newPageId'] = $newTableIds[self::TABLE_Page][self::VALUE_PageId];
+               $this->recordIds['newContentIdFirst'] = $newTableIds[self::TABLE_Content][self::VALUE_ContentIdFirst];
+               $this->recordIds['newContentIdLast'] = $newTableIds[self::TABLE_Content][self::VALUE_ContentIdLast];
+       }
+
 }
index a265d02..b860a64 100644 (file)
@@ -306,4 +306,25 @@ class ActionTest extends \TYPO3\CMS\Workspaces\Tests\Functional\DataHandling\Man
                );
        }
 
+       /**
+        * @test
+        * @see DataSet/Assertion/copyPage.csv
+        */
+       public function copyPage() {
+               parent::copyPage();
+               $this->assertAssertionDataSet('copyPage');
+
+               $responseContent = $this->getFrontendResponse($this->recordIds['newPageId'], 0, self::VALUE_BackendUserId, self::VALUE_WorkspaceId)->getResponseContent();
+               $this->assertResponseContentHasRecords($responseContent, self::TABLE_Page, 'title', 'Relations');
+               $this->assertResponseContentHasRecords($responseContent, self::TABLE_Content, 'header', array('Regular Element #1', 'Regular Element #2'));
+               $this->assertResponseContentStructureHasRecords(
+                       $responseContent, self::TABLE_Content . ':' . $this->recordIds['newContentIdFirst'], 'categories',
+                       self::TABLE_Category, 'title', array('Category A', 'Category B')
+               );
+               $this->assertResponseContentStructureHasRecords(
+                       $responseContent, self::TABLE_Content . ':' . $this->recordIds['newContentIdLast'], 'categories',
+                       self::TABLE_Category, 'title', array('Category B', 'Category C')
+               );
+       }
+
 }
diff --git a/typo3/sysext/workspaces/Tests/Functional/DataHandling/ManyToMany/Modify/DataSet/copyPage.csv b/typo3/sysext/workspaces/Tests/Functional/DataHandling/ManyToMany/Modify/DataSet/copyPage.csv
new file mode 100644 (file)
index 0000000..cbb1f3d
--- /dev/null
@@ -0,0 +1,32 @@
+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,90,256,0,1,1,0,0,0,Relations
+,92,-1,256,0,1,-1,0,91,0,Relations
+sys_category
+,uid,pid,sorting,deleted,sys_language_uid,l10n_parent,t3ver_wsid,t3ver_state,t3ver_stage,t3ver_oid,t3ver_move_id,title,parent,items
+,28,0,256,0,0,0,0,0,0,0,0,"Category A",0,0
+,29,0,512,0,0,0,0,0,0,0,0,"Category B",0,0
+,30,0,768,0,0,0,0,0,0,0,0,"Category C",0,0
+,31,0,1024,0,0,0,0,0,0,0,0,"Category A.A",28,0
+sys_category_record_mm
+,uid_local,uid_foreign,tablenames,sorting,sorting_foreign,fieldname
+,28,297,tt_content,0,1,categories
+,29,297,tt_content,0,2,categories
+,29,298,tt_content,0,1,categories
+,30,298,tt_content,0,2,categories
+,29,300,tt_content,0,1,categories
+,30,300,tt_content,0,2,categories
+,28,302,tt_content,0,1,categories
+,29,302,tt_content,0,2,categories
+tt_content
+,uid,pid,sorting,deleted,sys_language_uid,l18n_parent,t3ver_wsid,t3ver_state,t3ver_stage,t3ver_oid,t3ver_move_id,header,image,categories
+,297,89,256,0,0,0,0,0,0,0,0,"Regular Element #1",,2
+,298,89,512,0,0,0,0,0,0,0,0,"Regular Element #2",,2
+,299,91,256,0,0,0,1,1,0,0,0,"Regular Element #2",,2
+,300,-1,256,0,0,0,1,-1,0,299,0,"Regular Element #2",0,2
+,301,91,128,0,0,0,1,1,0,0,0,"Regular Element #1",,2
+,302,-1,128,0,0,0,1,-1,0,301,0,"Regular Element #1",0,2
index 80d7146..e2ef414 100644 (file)
@@ -339,4 +339,31 @@ class ActionTest extends \TYPO3\CMS\Workspaces\Tests\Functional\DataHandling\Man
                );
        }
 
+       /**
+        * @test
+        * @see DataSet/Assertion/copyPage.csv
+        */
+       public function copyPage() {
+               parent::copyPage();
+               $this->actionService->publishRecords(
+                       array(
+                               self::TABLE_Page => array($this->recordIds['newPageId']),
+                               self::TABLE_Content => array($this->recordIds['newContentIdFirst'], $this->recordIds['newContentIdLast']),
+                       )
+               );
+               $this->assertAssertionDataSet('copyPage');
+
+               $responseContent = $this->getFrontendResponse($this->recordIds['newPageId'])->getResponseContent();
+               $this->assertResponseContentHasRecords($responseContent, self::TABLE_Page, 'title', 'Relations');
+               $this->assertResponseContentHasRecords($responseContent, self::TABLE_Content, 'header', array('Regular Element #1', 'Regular Element #2'));
+               $this->assertResponseContentStructureHasRecords(
+                       $responseContent, self::TABLE_Content . ':' . $this->recordIds['newContentIdFirst'], 'categories',
+                       self::TABLE_Category, 'title', array('Category A', 'Category B')
+               );
+               $this->assertResponseContentStructureHasRecords(
+                       $responseContent, self::TABLE_Content . ':' . $this->recordIds['newContentIdLast'], 'categories',
+                       self::TABLE_Category, 'title', array('Category B', 'Category C')
+               );
+       }
+
 }
diff --git a/typo3/sysext/workspaces/Tests/Functional/DataHandling/ManyToMany/Publish/DataSet/copyPage.csv b/typo3/sysext/workspaces/Tests/Functional/DataHandling/ManyToMany/Publish/DataSet/copyPage.csv
new file mode 100644 (file)
index 0000000..c663c24
--- /dev/null
@@ -0,0 +1,29 @@
+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,90,256,0,0,0,0,0,0,Relations
+sys_category
+,uid,pid,sorting,deleted,sys_language_uid,l10n_parent,t3ver_wsid,t3ver_state,t3ver_stage,t3ver_oid,t3ver_move_id,title,parent,items
+,28,0,256,0,0,0,0,0,0,0,0,"Category A",0,0
+,29,0,512,0,0,0,0,0,0,0,0,"Category B",0,0
+,30,0,768,0,0,0,0,0,0,0,0,"Category C",0,0
+,31,0,1024,0,0,0,0,0,0,0,0,"Category A.A",28,0
+sys_category_record_mm
+,uid_local,uid_foreign,tablenames,sorting,sorting_foreign,fieldname
+,28,297,tt_content,0,1,categories
+,29,297,tt_content,0,2,categories
+,29,298,tt_content,0,1,categories
+,30,298,tt_content,0,2,categories
+,29,299,tt_content,0,1,categories
+,30,299,tt_content,0,2,categories
+,28,301,tt_content,0,1,categories
+,29,301,tt_content,0,2,categories
+tt_content
+,uid,pid,sorting,deleted,sys_language_uid,l18n_parent,t3ver_wsid,t3ver_state,t3ver_stage,t3ver_oid,t3ver_move_id,header,image,categories
+,297,89,256,0,0,0,0,0,0,0,0,"Regular Element #1",,2
+,298,89,512,0,0,0,0,0,0,0,0,"Regular Element #2",,2
+,299,91,256,0,0,0,0,0,0,0,0,"Regular Element #2",0,2
+,301,91,128,0,0,0,0,0,0,0,0,"Regular Element #1",0,2
index ed09e53..1c36171 100644 (file)
@@ -323,4 +323,26 @@ class ActionTest extends \TYPO3\CMS\Workspaces\Tests\Functional\DataHandling\Man
                );
        }
 
+       /**
+        * @test
+        * @see DataSet/Assertion/copyPage.csv
+        */
+       public function copyPage() {
+               parent::copyPage();
+               $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
+               $this->assertAssertionDataSet('copyPage');
+
+               $responseContent = $this->getFrontendResponse($this->recordIds['newPageId'])->getResponseContent();
+               $this->assertResponseContentHasRecords($responseContent, self::TABLE_Page, 'title', 'Relations');
+               $this->assertResponseContentHasRecords($responseContent, self::TABLE_Content, 'header', array('Regular Element #1', 'Regular Element #2'));
+               $this->assertResponseContentStructureHasRecords(
+                       $responseContent, self::TABLE_Content . ':' . $this->recordIds['newContentIdFirst'], 'categories',
+                       self::TABLE_Category, 'title', array('Category A', 'Category B')
+               );
+               $this->assertResponseContentStructureHasRecords(
+                       $responseContent, self::TABLE_Content . ':' . $this->recordIds['newContentIdLast'], 'categories',
+                       self::TABLE_Category, 'title', array('Category B', 'Category C')
+               );
+       }
+
 }
diff --git a/typo3/sysext/workspaces/Tests/Functional/DataHandling/ManyToMany/PublishAll/DataSet/copyPage.csv b/typo3/sysext/workspaces/Tests/Functional/DataHandling/ManyToMany/PublishAll/DataSet/copyPage.csv
new file mode 100644 (file)
index 0000000..c663c24
--- /dev/null
@@ -0,0 +1,29 @@
+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,90,256,0,0,0,0,0,0,Relations
+sys_category
+,uid,pid,sorting,deleted,sys_language_uid,l10n_parent,t3ver_wsid,t3ver_state,t3ver_stage,t3ver_oid,t3ver_move_id,title,parent,items
+,28,0,256,0,0,0,0,0,0,0,0,"Category A",0,0
+,29,0,512,0,0,0,0,0,0,0,0,"Category B",0,0
+,30,0,768,0,0,0,0,0,0,0,0,"Category C",0,0
+,31,0,1024,0,0,0,0,0,0,0,0,"Category A.A",28,0
+sys_category_record_mm
+,uid_local,uid_foreign,tablenames,sorting,sorting_foreign,fieldname
+,28,297,tt_content,0,1,categories
+,29,297,tt_content,0,2,categories
+,29,298,tt_content,0,1,categories
+,30,298,tt_content,0,2,categories
+,29,299,tt_content,0,1,categories
+,30,299,tt_content,0,2,categories
+,28,301,tt_content,0,1,categories
+,29,301,tt_content,0,2,categories
+tt_content
+,uid,pid,sorting,deleted,sys_language_uid,l18n_parent,t3ver_wsid,t3ver_state,t3ver_stage,t3ver_oid,t3ver_move_id,header,image,categories
+,297,89,256,0,0,0,0,0,0,0,0,"Regular Element #1",,2
+,298,89,512,0,0,0,0,0,0,0,0,"Regular Element #2",,2
+,299,91,256,0,0,0,0,0,0,0,0,"Regular Element #2",0,2
+,301,91,128,0,0,0,0,0,0,0,0,"Regular Element #1",0,2