[TASK] Add functional tests for versioned MM references 49/49349/2
authorOliver Hader <oliver@typo3.org>
Wed, 3 Aug 2016 14:03:05 +0000 (16:03 +0200)
committerOliver Hader <oliver.hader@typo3.org>
Wed, 3 Aug 2016 15:24:37 +0000 (17:24 +0200)
Functional tests are integrated to simulate editing MM references
in a workspace context, however with submitting the live uids of
the accordant entities to be referenced.

Resolves: #77384
Releases: master, 7.6
Change-Id: I207f20ff4ac7d041a353e5d250f9283b0e62e591
Reviewed-on: https://review.typo3.org/49349
Tested-by: Bamboo TYPO3com <info@typo3.com>
Reviewed-by: Benni Mack <benni@typo3.org>
Tested-by: Benni Mack <benni@typo3.org>
Reviewed-by: Oliver Hader <oliver.hader@typo3.org>
Tested-by: Oliver Hader <oliver.hader@typo3.org>
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/createCategoryWContentNAddRelation.csv [new file with mode: 0644]
typo3/sysext/workspaces/Tests/Functional/DataHandling/ManyToMany/Modify/DataSet/createContentWCategoryNAddRelation.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/createCategoryWContentNAddRelation.csv [new file with mode: 0644]
typo3/sysext/workspaces/Tests/Functional/DataHandling/ManyToMany/Publish/DataSet/createContentWCategoryNAddRelation.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/createCategoryWContentNAddRelation.csv [new file with mode: 0644]
typo3/sysext/workspaces/Tests/Functional/DataHandling/ManyToMany/PublishAll/DataSet/createContentWCategoryNAddRelation.csv [new file with mode: 0644]

index d3b99b7..df9d423 100644 (file)
@@ -154,6 +154,40 @@ abstract class AbstractActionTestCase extends \TYPO3\CMS\Core\Tests\Functional\D
         $this->recordIds['newCategoryId'] = $newTableIds[self::TABLE_Category][0];
     }
 
+    public function createContentWithCategoryAndAddRelation()
+    {
+        $newTableIds = $this->actionService->createNewRecords(
+            self::VALUE_PageId,
+            array(
+                self::TABLE_Category => array('pid' => 0, 'title' => 'Testing #1'),
+                self::TABLE_Content => array('header' => 'Testing #1'),
+            )
+        );
+        $this->recordIds['newCategoryId'] = $newTableIds[self::TABLE_Category][0];
+        $this->recordIds['newContentId'] = $newTableIds[self::TABLE_Content][0];
+
+        $this->actionService->modifyRecord(
+            self::TABLE_Content, $this->recordIds['newContentId'], array('categories' => $this->recordIds['newCategoryId'])
+        );
+    }
+
+    public function createCategoryWithContentAndAddRelation()
+    {
+        $newTableIds = $this->actionService->createNewRecords(
+            self::VALUE_PageId,
+            array(
+                self::TABLE_Content => array('header' => 'Testing #1'),
+                self::TABLE_Category => array('pid' => 0, 'title' => 'Testing #1', 'items' => 'tt_content___previousUid'),
+            )
+        );
+        $this->recordIds['newContentId'] = $newTableIds[self::TABLE_Content][0];
+        $this->recordIds['newCategoryId'] = $newTableIds[self::TABLE_Category][0];
+
+        $this->actionService->modifyRecord(
+            self::TABLE_Category, $this->recordIds['newCategoryId'], array('items' => 'tt_content_' . $this->recordIds['newContentId'])
+        );
+    }
+
     /**
      * @see DataSet/Assertion/modifyCategoryRecordOfCategoryRelation.csv
      */
index 97f3107..a22b8c7 100644 (file)
@@ -139,6 +139,26 @@ class ActionTest extends \TYPO3\CMS\Workspaces\Tests\Functional\DataHandling\Man
 
     /**
      * @test
+     * @see DataSet/createContentWCategoryNAddRelation.csv
+     */
+    public function createContentWithCategoryAndAddRelation()
+    {
+        parent::createContentWithCategoryAndAddRelation();
+        $this->assertAssertionDataSet('createContentWCategoryNAddRelation');
+    }
+
+    /**
+     * @test
+     * @see DataSet/createCategoryWContentNAddRelation.csv
+     */
+    public function createCategoryWithContentAndAddRelation()
+    {
+        parent::createCategoryWithContentAndAddRelation();
+        $this->assertAssertionDataSet('createCategoryWContentNAddRelation');
+    }
+
+    /**
+     * @test
      * @see DataSet/Assertion/modifyCategoryRecordOfCategoryRelation.csv
      */
     public function modifyCategoryOfRelation()
diff --git a/typo3/sysext/workspaces/Tests/Functional/DataHandling/ManyToMany/Modify/DataSet/createCategoryWContentNAddRelation.csv b/typo3/sysext/workspaces/Tests/Functional/DataHandling/ManyToMany/Modify/DataSet/createCategoryWContentNAddRelation.csv
new file mode 100644 (file)
index 0000000..1b91e16
--- /dev/null
@@ -0,0 +1,21 @@
+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
+,32,0,128,0,0,0,1,1,0,0,0,"Testing #1",0,0
+,33,-1,128,0,0,0,1,-1,0,32,0,"Testing #1",0,1
+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
+,33,299,tt_content,1,0,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",0,2
+,298,89,512,0,0,0,0,0,0,0,0,"Regular Element #2",0,2
+,299,89,128,0,0,0,1,1,0,0,0,"Testing #1",0,0
+,300,-1,128,0,0,0,1,-1,0,299,0,"Testing #1",0,0
diff --git a/typo3/sysext/workspaces/Tests/Functional/DataHandling/ManyToMany/Modify/DataSet/createContentWCategoryNAddRelation.csv b/typo3/sysext/workspaces/Tests/Functional/DataHandling/ManyToMany/Modify/DataSet/createContentWCategoryNAddRelation.csv
new file mode 100644 (file)
index 0000000..05b425c
--- /dev/null
@@ -0,0 +1,21 @@
+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
+,32,0,128,0,0,0,1,1,0,0,0,"Testing #1",0,0
+,33,-1,128,0,0,0,1,-1,0,32,0,"Testing #1",0,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
+,32,300,tt_content,0,1,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",0,2
+,298,89,512,0,0,0,0,0,0,0,0,"Regular Element #2",0,2
+,299,89,128,0,0,0,1,1,0,0,0,"Testing #1",0,0
+,300,-1,128,0,0,0,1,-1,0,299,0,"Testing #1",0,1
index 1133a85..f0f27c8 100644 (file)
@@ -157,6 +157,38 @@ class ActionTest extends \TYPO3\CMS\Workspaces\Tests\Functional\DataHandling\Man
 
     /**
      * @test
+     * @see DataSet/createContentWCategoryNAddRelation.csv
+     */
+    public function createContentWithCategoryAndAddRelation()
+    {
+        parent::createContentWithCategoryAndAddRelation();
+        $this->actionService->publishRecords(
+            array(
+                self::TABLE_Category => array($this->recordIds['newCategoryId']),
+                self::TABLE_Content => array($this->recordIds['newContentId']),
+            )
+        );
+        $this->assertAssertionDataSet('createContentWCategoryNAddRelation');
+    }
+
+    /**
+     * @test
+     * @see DataSet/createCategoryWContentNAddRelation.csv
+     */
+    public function createCategoryWithContentAndAddRelation()
+    {
+        parent::createCategoryWithContentAndAddRelation();
+        $this->actionService->publishRecords(
+            array(
+                self::TABLE_Content => array($this->recordIds['newContentId']),
+                self::TABLE_Category => array($this->recordIds['newCategoryId']),
+            )
+        );
+        $this->assertAssertionDataSet('createCategoryWContentNAddRelation');
+    }
+
+    /**
+     * @test
      * @see DataSet/Assertion/modifyCategoryRecordOfCategoryRelation.csv
      */
     public function modifyCategoryOfRelation()
diff --git a/typo3/sysext/workspaces/Tests/Functional/DataHandling/ManyToMany/Publish/DataSet/createCategoryWContentNAddRelation.csv b/typo3/sysext/workspaces/Tests/Functional/DataHandling/ManyToMany/Publish/DataSet/createCategoryWContentNAddRelation.csv
new file mode 100644 (file)
index 0000000..66fb416
--- /dev/null
@@ -0,0 +1,19 @@
+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
+,32,0,128,0,0,0,0,0,0,0,0,"Testing #1",0,1
+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
+,32,300,tt_content,1,0,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",0,2
+,298,89,512,0,0,0,0,0,0,0,0,"Regular Element #2",0,2
+,299,89,128,0,0,0,0,0,0,0,0,"Testing #1",0,0
diff --git a/typo3/sysext/workspaces/Tests/Functional/DataHandling/ManyToMany/Publish/DataSet/createContentWCategoryNAddRelation.csv b/typo3/sysext/workspaces/Tests/Functional/DataHandling/ManyToMany/Publish/DataSet/createContentWCategoryNAddRelation.csv
new file mode 100644 (file)
index 0000000..af8bf3a
--- /dev/null
@@ -0,0 +1,19 @@
+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
+,32,0,128,0,0,0,0,0,0,0,0,"Testing #1",0,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
+,33,299,tt_content,0,1,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",0,2
+,298,89,512,0,0,0,0,0,0,0,0,"Regular Element #2",0,2
+,299,89,128,0,0,0,0,0,0,0,0,"Testing #1",0,1
index 60ebed9..4e75e90 100644 (file)
@@ -146,6 +146,28 @@ class ActionTest extends \TYPO3\CMS\Workspaces\Tests\Functional\DataHandling\Man
 
     /**
      * @test
+     * @see DataSet/createContentWCategoryNAddRelation.csv
+     */
+    public function createContentWithCategoryAndAddRelation()
+    {
+        parent::createContentWithCategoryAndAddRelation();
+        $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
+        $this->assertAssertionDataSet('createContentWCategoryNAddRelation');
+    }
+
+    /**
+     * @test
+     * @see DataSet/createCategoryWContentNAddRelation.csv
+     */
+    public function createCategoryWithContentAndAddRelation()
+    {
+        parent::createCategoryWithContentAndAddRelation();
+        $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
+        $this->assertAssertionDataSet('createCategoryWContentNAddRelation');
+    }
+
+    /**
+     * @test
      * @see DataSet/Assertion/modifyCategoryRecordOfCategoryRelation.csv
      */
     public function modifyCategoryOfRelation()
diff --git a/typo3/sysext/workspaces/Tests/Functional/DataHandling/ManyToMany/PublishAll/DataSet/createCategoryWContentNAddRelation.csv b/typo3/sysext/workspaces/Tests/Functional/DataHandling/ManyToMany/PublishAll/DataSet/createCategoryWContentNAddRelation.csv
new file mode 100644 (file)
index 0000000..66fb416
--- /dev/null
@@ -0,0 +1,19 @@
+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
+,32,0,128,0,0,0,0,0,0,0,0,"Testing #1",0,1
+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
+,32,300,tt_content,1,0,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",0,2
+,298,89,512,0,0,0,0,0,0,0,0,"Regular Element #2",0,2
+,299,89,128,0,0,0,0,0,0,0,0,"Testing #1",0,0
diff --git a/typo3/sysext/workspaces/Tests/Functional/DataHandling/ManyToMany/PublishAll/DataSet/createContentWCategoryNAddRelation.csv b/typo3/sysext/workspaces/Tests/Functional/DataHandling/ManyToMany/PublishAll/DataSet/createContentWCategoryNAddRelation.csv
new file mode 100644 (file)
index 0000000..af8bf3a
--- /dev/null
@@ -0,0 +1,19 @@
+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
+,32,0,128,0,0,0,0,0,0,0,0,"Testing #1",0,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
+,33,299,tt_content,0,1,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",0,2
+,298,89,512,0,0,0,0,0,0,0,0,"Regular Element #2",0,2
+,299,89,128,0,0,0,0,0,0,0,0,"Testing #1",0,1