[BUGFIX] Stabilize dataHandler test
authorChristian Kuhn <lolli@schwarzbu.ch>
Sat, 1 Sep 2012 20:40:41 +0000 (22:40 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Sat, 1 Sep 2012 20:45:02 +0000 (22:45 +0200)
If hooks are registered for DataHandle->process_datamap(), test
processDatamapWhenEditingRecordInWorkspaceCreatesNewRecordInWorkspace
might fail with an error or a warning. Solution is getting rid of this
dependengy by unsetting possible registered for the test run.

Change-Id: I88f0726ea87929100775a1e6d1ac1c0815d285b6
Fixes: #40513
Releases: 6.0
Reviewed-on: http://review.typo3.org/14273
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
typo3/sysext/core/Tests/Unit/DataHandler/DataHandlerTest.php

index 8511859..510c58f 100644 (file)
@@ -226,7 +226,11 @@ class DataHandlerTest extends \tx_phpunit_testcase {
         * @test
         */
        public function processDatamapWhenEditingRecordInWorkspaceCreatesNewRecordInWorkspace() {
+                       // Unset possible hooks on method under test
+               $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processDatamapClass'] = array();
+
                $GLOBALS['TYPO3_DB'] = $this->getMock('TYPO3\\CMS\\Core\\Database\\DatabaseConnection');
+               /** @var $fixture \TYPO3\CMS\Core\DataHandler\DataHandler|\tx_phpunit_testcase */
                $fixture = $this->getMock('TYPO3\\CMS\\Core\\DataHandler\\DataHandler', array('newlog', 'checkModifyAccessList', 'tableReadOnly', 'checkRecordUpdateAccess'));
                $fixture->bypassWorkspaceRestrictions = FALSE;
                $fixture->datamap = array(