From 90db01d7bdb95cc324d35d6058c8e4b2021e8240 Mon Sep 17 00:00:00 2001
From: Oliver Hader <oliver@typo3.org>
Date: Mon, 17 Feb 2014 07:41:23 +0100
Subject: [PATCH] [TASK] Streamline DataHandler functional tests

* load modified typo3conf/extTables.php
* add label for copied records
* add label for localized records
* streamline test assertion of IRRE reference test

Resolves: #56029
Releases: 6.2
Change-Id: I4b60200c568aa17e8d51cae95567fe045bff62c7
Reviewed-on: https://review.typo3.org/27648
Reviewed-by: Oliver Hader
Tested-by: Oliver Hader
---
 .../AbstractDataHandlerActionTestCase.php     |  7 +++++
 .../DataHandling/Framework/ActionService.php  |  6 ++++-
 .../ForeignField/AbstractActionTestCase.php   |  2 +-
 ...modifyParentRecordWithHotelChildRecord.csv |  6 ++---
 .../copyCategoryRecordOfCategoryRelation.csv  |  2 +-
 ...calizeCategoryRecordOfCategoryRelation.csv |  2 +-
 .../Fixtures/Frontend/extTables.php           | 26 +++++++++++++++++++
 .../ForeignField/AbstractActionTestCase.php   |  2 +-
 ...modifyParentRecordWithHotelChildRecord.csv | 15 +++++++----
 .../copyCategoryRecordOfCategoryRelation.csv  |  4 +--
 ...calizeCategoryRecordOfCategoryRelation.csv |  4 +--
 11 files changed, 59 insertions(+), 17 deletions(-)
 create mode 100644 typo3/sysext/core/Tests/Functional/Fixtures/Frontend/extTables.php

diff --git a/typo3/sysext/core/Tests/Functional/DataHandling/AbstractDataHandlerActionTestCase.php b/typo3/sysext/core/Tests/Functional/DataHandling/AbstractDataHandlerActionTestCase.php
index 7cc748b4f161..6ce922237fcd 100644
--- a/typo3/sysext/core/Tests/Functional/DataHandling/AbstractDataHandlerActionTestCase.php
+++ b/typo3/sysext/core/Tests/Functional/DataHandling/AbstractDataHandlerActionTestCase.php
@@ -45,6 +45,13 @@ abstract class AbstractDataHandlerActionTestCase extends \TYPO3\CMS\Core\Tests\F
 		// 'typo3conf/ext/datahandler',
 	);
 
+	/**
+	 * @var array
+	 */
+	protected $pathsToLinkInTestInstance = array(
+		'typo3/sysext/core/Tests/Functional/Fixtures/Frontend/extTables.php' => 'typo3conf/extTables.php',
+	);
+
 	/**
 	 * @var \TYPO3\CMS\Core\Tests\Functional\DataHandling\Framework\ActionService
 	 */
diff --git a/typo3/sysext/core/Tests/Functional/DataHandling/Framework/ActionService.php b/typo3/sysext/core/Tests/Functional/DataHandling/Framework/ActionService.php
index bdbdc2f49ca9..7812a2944b96 100644
--- a/typo3/sysext/core/Tests/Functional/DataHandling/Framework/ActionService.php
+++ b/typo3/sysext/core/Tests/Functional/DataHandling/Framework/ActionService.php
@@ -61,9 +61,10 @@ class ActionService {
 	 * @param string $tableName
 	 * @param integer $pageId
 	 * @param array $recordData
+	 * @return array
 	 */
 	public function createNewRecord($tableName, $pageId, array $recordData) {
-		$this->createNewRecords($pageId, array($tableName => $recordData));
+		return $this->createNewRecords($pageId, array($tableName => $recordData));
 	}
 
 	/**
@@ -178,6 +179,7 @@ class ActionService {
 		);
 		$this->dataHandler->start(array(), $commandMap);
 		$this->dataHandler->process_cmdmap();
+		return $this->dataHandler->copyMappingArray;
 	}
 
 	/**
@@ -201,6 +203,7 @@ class ActionService {
 	 * @param string $tableName
 	 * @param integer $uid
 	 * @param integer $languageId
+	 * @return array
 	 */
 	public function localizeRecord($tableName, $uid, $languageId) {
 		$commandMap = array(
@@ -212,6 +215,7 @@ class ActionService {
 		);
 		$this->dataHandler->start(array(), $commandMap);
 		$this->dataHandler->process_cmdmap();
+		return $this->dataHandler->copyMappingArray;
 	}
 
 	/**
diff --git a/typo3/sysext/core/Tests/Functional/DataHandling/InlineRelationalRecordEditing/ForeignField/AbstractActionTestCase.php b/typo3/sysext/core/Tests/Functional/DataHandling/InlineRelationalRecordEditing/ForeignField/AbstractActionTestCase.php
index 968c737a8d25..d584b547fa78 100644
--- a/typo3/sysext/core/Tests/Functional/DataHandling/InlineRelationalRecordEditing/ForeignField/AbstractActionTestCase.php
+++ b/typo3/sysext/core/Tests/Functional/DataHandling/InlineRelationalRecordEditing/ForeignField/AbstractActionTestCase.php
@@ -194,7 +194,7 @@ abstract class AbstractActionTestCase extends \TYPO3\CMS\Core\Tests\Functional\D
 			self::VALUE_PageId,
 			array(
 				self::TABLE_Hotel => array('uid' => 4, 'title' => 'Testing #1'),
-				self::TABLE_Content => array('uid' => self::VALUE_ContentIdLast, 'tx_irretutorial_hotels' => '3,4'),
+				self::TABLE_Content => array('uid' => self::VALUE_ContentIdFirst, 'tx_irretutorial_hotels' => '3,4'),
 			)
 		);
 		$this->assertAssertionDataSet('modifyParentRecordWithHotelChildRecord');
diff --git a/typo3/sysext/core/Tests/Functional/DataHandling/InlineRelationalRecordEditing/ForeignField/DataSet/Assertion/modifyParentRecordWithHotelChildRecord.csv b/typo3/sysext/core/Tests/Functional/DataHandling/InlineRelationalRecordEditing/ForeignField/DataSet/Assertion/modifyParentRecordWithHotelChildRecord.csv
index 5c8e9da4abcd..4df4b7c7bb2d 100644
--- a/typo3/sysext/core/Tests/Functional/DataHandling/InlineRelationalRecordEditing/ForeignField/DataSet/Assertion/modifyParentRecordWithHotelChildRecord.csv
+++ b/typo3/sysext/core/Tests/Functional/DataHandling/InlineRelationalRecordEditing/ForeignField/DataSet/Assertion/modifyParentRecordWithHotelChildRecord.csv
@@ -1,11 +1,11 @@
 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,tx_irretutorial_hotels
 ,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
+,298,89,512,0,0,0,0,0,0,0,0,"Regular Element #2",,0,1
 tx_irretutorial_1nff_hotel
 ,uid,pid,sorting,deleted,sys_language_uid,t3ver_wsid,t3ver_state,t3ver_stage,t3ver_oid,t3ver_move_id,title,parentid,parenttable,parentidentifier,offers
-,3,89,1,0,0,0,0,0,0,0,"Hotel #1",298,tt_content,,2
-,4,89,2,0,0,0,0,0,0,0,"Testing #1",298,tt_content,,1
+,3,89,1,0,0,0,0,0,0,0,"Hotel #1",297,tt_content,,2
+,4,89,2,0,0,0,0,0,0,0,"Testing #1",297,tt_content,,1
 ,5,89,1,0,0,0,0,0,0,0,"Hotel #1",298,tt_content,,1
 tx_irretutorial_1nff_offer
 ,uid,pid,sorting,deleted,sys_language_uid,t3ver_wsid,t3ver_state,t3ver_stage,t3ver_oid,t3ver_move_id,title,parentid,parenttable,parentidentifier,prices
diff --git a/typo3/sysext/core/Tests/Functional/DataHandling/ManyToMany/DataSet/Assertion/copyCategoryRecordOfCategoryRelation.csv b/typo3/sysext/core/Tests/Functional/DataHandling/ManyToMany/DataSet/Assertion/copyCategoryRecordOfCategoryRelation.csv
index 679c03d137e6..eca185e66f70 100644
--- a/typo3/sysext/core/Tests/Functional/DataHandling/ManyToMany/DataSet/Assertion/copyCategoryRecordOfCategoryRelation.csv
+++ b/typo3/sysext/core/Tests/Functional/DataHandling/ManyToMany/DataSet/Assertion/copyCategoryRecordOfCategoryRelation.csv
@@ -4,7 +4,7 @@ sys_category
 ,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,"Category A",0,1
+,32,0,128,0,0,0,0,0,0,0,0,"Category A (copy 1)",0,1
 sys_category_record_mm
 ,uid_local,uid_foreign,tablenames,sorting,sorting_foreign,fieldname
 ,28,297,tt_content,0,1,categories
diff --git a/typo3/sysext/core/Tests/Functional/DataHandling/ManyToMany/DataSet/Assertion/localizeCategoryRecordOfCategoryRelation.csv b/typo3/sysext/core/Tests/Functional/DataHandling/ManyToMany/DataSet/Assertion/localizeCategoryRecordOfCategoryRelation.csv
index 0c7b266dd168..b8ddb17efc64 100644
--- a/typo3/sysext/core/Tests/Functional/DataHandling/ManyToMany/DataSet/Assertion/localizeCategoryRecordOfCategoryRelation.csv
+++ b/typo3/sysext/core/Tests/Functional/DataHandling/ManyToMany/DataSet/Assertion/localizeCategoryRecordOfCategoryRelation.csv
@@ -4,7 +4,7 @@ sys_category
 ,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,384,0,1,28,0,0,0,0,0,"Category A",0,1
+,32,0,384,0,1,28,0,0,0,0,0,"[Translate to Dansk:] Category A",0,1
 sys_category_record_mm
 ,uid_local,uid_foreign,tablenames,sorting,sorting_foreign,fieldname
 ,28,297,tt_content,0,1,categories
diff --git a/typo3/sysext/core/Tests/Functional/Fixtures/Frontend/extTables.php b/typo3/sysext/core/Tests/Functional/Fixtures/Frontend/extTables.php
new file mode 100644
index 000000000000..43f279f68657
--- /dev/null
+++ b/typo3/sysext/core/Tests/Functional/Fixtures/Frontend/extTables.php
@@ -0,0 +1,26 @@
+<?php
+/**
+ * Overriding $TCA
+ *
+ * The TYPO3 Configuration Array (TCA) is defined by the distributed tables.php and ext_tables.php files.
+ * If you want to extend and/or modify its content, you can do so with scripts like this.
+ * Or BETTER yet - with extensions like those found in the typo3conf/ext/ or typo3/ext/ folder.
+ * Extensions are movable to other TYPO3 installations and provides a much better division between things! Use them!
+ *
+ * Information on how to set up tables is found in the document "Inside TYPO3" available as a PDF from where you downloaded TYPO3.
+ *
+ * Usage:
+ * Just put this file to the location typo3conf/extTables.php and add this line to your typo3conf/localconf.php:
+ * $typo_db_extTableDef_script = 'extTables.php';
+ */
+
+// Show copied pages records in frontend request
+$GLOBALS['TCA']['pages']['ctrl']['hideAtCopy'] = FALSE;
+// Show copied tt_content records in frontend request
+$GLOBALS['TCA']['tt_content']['ctrl']['hideAtCopy'] = FALSE;
+// Prepend label for copied sys_category records
+$GLOBALS['TCA']['sys_category']['ctrl']['prependAtCopy'] = 'LLL:EXT:lang/locallang_general.xlf:LGL.prependAtCopy';
+// Prepend label for localized sys_category records
+$GLOBALS['TCA']['sys_category']['columns']['title']['l10n_mode'] = 'prefixLangTitle';
+
+?>
\ No newline at end of file
diff --git a/typo3/sysext/workspaces/Tests/Functional/DataHandling/InlineRelationalRecordEditing/ForeignField/AbstractActionTestCase.php b/typo3/sysext/workspaces/Tests/Functional/DataHandling/InlineRelationalRecordEditing/ForeignField/AbstractActionTestCase.php
index 8c7e19b50d53..f5da40fae46c 100644
--- a/typo3/sysext/workspaces/Tests/Functional/DataHandling/InlineRelationalRecordEditing/ForeignField/AbstractActionTestCase.php
+++ b/typo3/sysext/workspaces/Tests/Functional/DataHandling/InlineRelationalRecordEditing/ForeignField/AbstractActionTestCase.php
@@ -221,7 +221,7 @@ abstract class AbstractActionTestCase extends \TYPO3\CMS\Core\Tests\Functional\D
 			self::VALUE_PageId,
 			array(
 				self::TABLE_Hotel => array('uid' => 4, 'title' => 'Testing #1'),
-				self::TABLE_Content => array('uid' => self::VALUE_ContentIdLast, 'tx_irretutorial_hotels' => '3,4'),
+				self::TABLE_Content => array('uid' => self::VALUE_ContentIdFirst, 'tx_irretutorial_hotels' => '3,4'),
 			)
 		);
 		$this->assertAssertionDataSet('modifyParentRecordWithHotelChildRecord');
diff --git a/typo3/sysext/workspaces/Tests/Functional/DataHandling/InlineRelationalRecordEditing/ForeignField/DataSet/Assertion/modifyParentRecordWithHotelChildRecord.csv b/typo3/sysext/workspaces/Tests/Functional/DataHandling/InlineRelationalRecordEditing/ForeignField/DataSet/Assertion/modifyParentRecordWithHotelChildRecord.csv
index 6d4cecba7072..9a81e96dae8b 100644
--- a/typo3/sysext/workspaces/Tests/Functional/DataHandling/InlineRelationalRecordEditing/ForeignField/DataSet/Assertion/modifyParentRecordWithHotelChildRecord.csv
+++ b/typo3/sysext/workspaces/Tests/Functional/DataHandling/InlineRelationalRecordEditing/ForeignField/DataSet/Assertion/modifyParentRecordWithHotelChildRecord.csv
@@ -2,14 +2,14 @@ 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,tx_irretutorial_hotels
 ,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,1
-,299,-1,512,0,0,0,1,0,0,298,0,"Regular Element #2",0,0,2
+,299,-1,256,0,0,0,1,0,0,297,0,"Regular Element #1",0,0,2
 tx_irretutorial_1nff_hotel
 ,uid,pid,sorting,deleted,sys_language_uid,t3ver_wsid,t3ver_state,t3ver_stage,t3ver_oid,t3ver_move_id,title,parentid,parenttable,parentidentifier,offers
-,3,89,1,0,0,0,0,0,0,0,"Hotel #1",299,tt_content,,2
+,3,89,1,0,0,0,0,0,0,0,"Hotel #1",297,tt_content,,2
 ,4,89,2,0,0,0,0,0,0,0,"Hotel #2",297,tt_content,,1
 ,5,89,1,0,0,0,0,0,0,0,"Hotel #1",298,tt_content,,1
 ,6,-1,2,0,0,1,0,0,4,0,"Testing #1",299,tt_content,,1
-,7,-1,1,0,0,1,0,0,5,0,"Hotel #1",299,tt_content,,1
+,7,-1,1,0,0,1,0,0,3,0,"Hotel #1",299,tt_content,,2
 tx_irretutorial_1nff_offer
 ,uid,pid,sorting,deleted,sys_language_uid,t3ver_wsid,t3ver_state,t3ver_stage,t3ver_oid,t3ver_move_id,title,parentid,parenttable,parentidentifier,prices
 ,5,89,1,0,0,0,0,0,0,0,"Offer #1.1",3,tx_irretutorial_1nff_hotel,,3
@@ -17,7 +17,8 @@ tx_irretutorial_1nff_offer
 ,7,89,1,0,0,0,0,0,0,0,"Offer #2.1",4,tx_irretutorial_1nff_hotel,,1
 ,8,89,1,0,0,0,0,0,0,0,"Offer #1.1",5,tx_irretutorial_1nff_hotel,,1
 ,9,-1,1,0,0,1,0,0,7,0,"Offer #2.1",6,tx_irretutorial_1nff_hotel,,1
-,10,-1,1,0,0,1,0,0,8,0,"Offer #1.1",7,tx_irretutorial_1nff_hotel,,1
+,10,-1,1,0,0,1,0,0,5,0,"Offer #1.1",7,tx_irretutorial_1nff_hotel,,3
+,11,-1,2,0,0,1,0,0,6,0,"Offer #1.2",7,tx_irretutorial_1nff_hotel,,2
 tx_irretutorial_1nff_price
 ,uid,pid,sorting,deleted,sys_language_uid,t3ver_wsid,t3ver_state,t3ver_stage,t3ver_oid,t3ver_move_id,title,parentid,parenttable,parentidentifier
 ,7,89,1,0,0,0,0,0,0,0,"Price #1.1.1",5,tx_irretutorial_1nff_offer,
@@ -28,4 +29,8 @@ tx_irretutorial_1nff_price
 ,12,89,1,0,0,0,0,0,0,0,"Price #2.1.1",7,tx_irretutorial_1nff_offer,
 ,13,89,1,0,0,0,0,0,0,0,"Price #1.1.1",8,tx_irretutorial_1nff_offer,
 ,14,-1,1,0,0,1,0,0,12,0,"Price #2.1.1",9,tx_irretutorial_1nff_offer,
-,15,-1,1,0,0,1,0,0,13,0,"Price #1.1.1",10,tx_irretutorial_1nff_offer,
+,15,-1,1,0,0,1,0,0,7,0,"Price #1.1.1",10,tx_irretutorial_1nff_offer,
+,16,-1,2,0,0,1,0,0,8,0,"Price #1.1.2",10,tx_irretutorial_1nff_offer,
+,17,-1,3,0,0,1,0,0,9,0,"Price #1.1.3",10,tx_irretutorial_1nff_offer,
+,18,-1,1,0,0,1,0,0,10,0,"Price #1.2.1",11,tx_irretutorial_1nff_offer,
+,19,-1,2,0,0,1,0,0,11,0,"Price #1.2.2",11,tx_irretutorial_1nff_offer,
diff --git a/typo3/sysext/workspaces/Tests/Functional/DataHandling/ManyToMany/DataSet/Assertion/copyCategoryRecordOfCategoryRelation.csv b/typo3/sysext/workspaces/Tests/Functional/DataHandling/ManyToMany/DataSet/Assertion/copyCategoryRecordOfCategoryRelation.csv
index 77e2520cdece..b268732732a2 100644
--- a/typo3/sysext/workspaces/Tests/Functional/DataHandling/ManyToMany/DataSet/Assertion/copyCategoryRecordOfCategoryRelation.csv
+++ b/typo3/sysext/workspaces/Tests/Functional/DataHandling/ManyToMany/DataSet/Assertion/copyCategoryRecordOfCategoryRelation.csv
@@ -4,8 +4,8 @@ sys_category
 ,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,"Category A",0,1
-,33,-1,128,0,0,0,1,-1,0,32,0,"Category A",0,1
+,32,0,128,0,0,0,1,1,0,0,0,"Category A (copy 1)",0,1
+,33,-1,128,0,0,0,1,-1,0,32,0,"Category A (copy 1)",0,1
 sys_category_record_mm
 ,uid_local,uid_foreign,tablenames,sorting,sorting_foreign,fieldname
 ,28,297,tt_content,0,1,categories
diff --git a/typo3/sysext/workspaces/Tests/Functional/DataHandling/ManyToMany/DataSet/Assertion/localizeCategoryRecordOfCategoryRelation.csv b/typo3/sysext/workspaces/Tests/Functional/DataHandling/ManyToMany/DataSet/Assertion/localizeCategoryRecordOfCategoryRelation.csv
index 156a35c410b1..1a6e60476ebd 100644
--- a/typo3/sysext/workspaces/Tests/Functional/DataHandling/ManyToMany/DataSet/Assertion/localizeCategoryRecordOfCategoryRelation.csv
+++ b/typo3/sysext/workspaces/Tests/Functional/DataHandling/ManyToMany/DataSet/Assertion/localizeCategoryRecordOfCategoryRelation.csv
@@ -4,8 +4,8 @@ sys_category
 ,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,384,0,1,28,1,1,0,0,0,"Category A",0,1
-,33,-1,384,0,1,28,1,-1,0,32,0,"Category A",0,1
+,32,0,384,0,1,28,1,1,0,0,0,"[Translate to Dansk:] Category A",0,1
+,33,-1,384,0,1,28,1,-1,0,32,0,"[Translate to Dansk:] Category A",0,1
 sys_category_record_mm
 ,uid_local,uid_foreign,tablenames,sorting,sorting_foreign,fieldname
 ,28,297,tt_content,0,1,categories
-- 
GitLab