[TASK] Reduce record data in functional test failure message 85/28285/2
authorOliver Hader <oliver@typo3.org>
Mon, 10 Mar 2014 19:14:10 +0000 (20:14 +0100)
committerOliver Hader <oliver.hader@typo3.org>
Wed, 12 Mar 2014 11:44:55 +0000 (12:44 +0100)
If records are found in a database table that are not part of
the assertion data-set, currently the whole record array from
the database is shown as failure.
The assertion has information about the fields that should have
been asserted. To keep a better overview, the failure message
is reduced now to exactly those fields.

Resolves: #56803
Releases: 6.2
Change-Id: Ib8f2afd0d464e8a4b850929277508770ff56eb91
Reviewed-on: https://review.typo3.org/28285
Reviewed-by: Wouter Wolters
Reviewed-by: Oliver Hader
Tested-by: Oliver Hader
typo3/sysext/core/Tests/Functional/DataHandling/AbstractDataHandlerActionTestCase.php

index 7a70a21..bd69b37 100644 (file)
@@ -168,7 +168,9 @@ abstract class AbstractDataHandlerActionTestCase extends \TYPO3\CMS\Core\Tests\F
                        if (!empty($records)) {
                                foreach ($records as $record) {
                                        $recordIdentifier = $tableName . ':' . $record['uid'];
-                                       $additionalInformation = $this->arrayToString($record);
+                                       $emptyAssertion = array_fill_keys($dataSet->getFields($tableName), '[none]');
+                                       $reducedRecord = array_intersect_key($record, $emptyAssertion);
+                                       $additionalInformation = ($hasUidField ? $this->renderRecords($emptyAssertion, $reducedRecord) : $this->arrayToString($reducedRecord));
                                        $failMessages[] = 'Not asserted record found for "' . $recordIdentifier . '":' . LF . $additionalInformation;
                                }
                        }