[BUGFIX] Make Functional tests work on fast machines
[Packages/TYPO3.CMS.git] / typo3 / sysext / core / Tests / Functional / DataHandling / Framework / ActionService.php
index c6f4ee5..264cd58 100644 (file)
@@ -66,8 +66,10 @@ class ActionService {
                $previousUid = NULL;
                foreach ($tableRecordData as $tableName => $recordData) {
                        $recordData = $this->resolvePreviousUid($recordData, $currentUid);
-                       $recordData['pid'] = $pageId;
-                       $currentUid = uniqid('NEW');
+                       if (!isset($recordData['pid'])) {
+                               $recordData['pid'] = $pageId;
+                       }
+                       $currentUid = uniqid('NEW', TRUE);
                        $newTableIds[$tableName][] = $currentUid;
                        $dataMap[$tableName][$currentUid] = $recordData;
                        if ($previousTableName !== NULL && $previousUid !== NULL) {
@@ -225,9 +227,10 @@ class ActionService {
         * @param string $tableName
         * @param integer $uid
         * @param integer $pageId
+        * @param NULL|array $recordData
         * @return array
         */
-       public function copyRecord($tableName, $uid, $pageId) {
+       public function copyRecord($tableName, $uid, $pageId, array $recordData = NULL) {
                $commandMap = array(
                        $tableName => array(
                                $uid => array(
@@ -235,6 +238,13 @@ class ActionService {
                                ),
                        ),
                );
+               if ($recordData !== NULL) {
+                       $commandMap[$tableName][$uid]['copy'] = array(
+                               'action' => 'paste',
+                               'target' => $pageId,
+                               'update' => $recordData,
+                       );
+               }
                $this->createDataHandler();
                $this->dataHandler->start(array(), $commandMap);
                $this->dataHandler->process_cmdmap();
@@ -245,8 +255,9 @@ class ActionService {
         * @param string $tableName
         * @param integer $uid
         * @param integer $pageId
+        * @param NULL|array $recordData
         */
-       public function moveRecord($tableName, $uid, $pageId) {
+       public function moveRecord($tableName, $uid, $pageId, array $recordData = NULL) {
                $commandMap = array(
                        $tableName => array(
                                $uid => array(
@@ -254,6 +265,13 @@ class ActionService {
                                ),
                        ),
                );
+               if ($recordData !== NULL) {
+                       $commandMap[$tableName][$uid]['move'] = array(
+                               'action' => 'paste',
+                               'target' => $pageId,
+                               'update' => $recordData,
+                       );
+               }
                $this->createDataHandler();
                $this->dataHandler->start(array(), $commandMap);
                $this->dataHandler->process_cmdmap();