[BUGFIX] Tests: Improve Mocking in ext:extbase 65/28365/2
authorAnja Leichsenring <aleichsenring@ab-softlab.de>
Thu, 13 Mar 2014 21:07:57 +0000 (22:07 +0100)
committerChristian Kuhn <lolli@schwarzbu.ch>
Thu, 13 Mar 2014 21:29:55 +0000 (22:29 +0100)
Unittests reveal some warnings which are caused by incomplete mocking.

Change-Id: Iee09220d675335aeadd286c2d4544d53c981016f
Resolves: #56700
Related: #51436
Releases: 6.2
Reviewed-on: https://review.typo3.org/28365
Reviewed-by: Wouter Wolters
Tested-by: Wouter Wolters
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
typo3/sysext/extbase/Tests/Unit/Persistence/Generic/Storage/Typo3DbBackendTest.php

index 27ef1a5..c0543ca 100644 (file)
@@ -438,8 +438,8 @@ class Typo3DbBackendTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
                        'uid' => '43',
                        'pid' => '-1'
                );
-               $querySettings = new \TYPO3\CMS\Extbase\Persistence\Generic\Typo3QuerySettings();
-               $querySettings->initializeObject();
+               /** @var \TYPO3\CMS\Extbase\Persistence\Generic\Typo3QuerySettings|\PHPUnit_Framework_MockObject_MockObject $querySettings */
+               $mockQuerySettings = $this->getMock('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Typo3QuerySettings', array('dummy'), array(), '', FALSE);
 
                $workspaceUid = 2;
                $sourceMock = new \TYPO3\CMS\Extbase\Persistence\Generic\Qom\Selector('tx_foo', 'Tx_Foo');
@@ -449,7 +449,7 @@ class Typo3DbBackendTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
                $pageRepositoryMock->expects($this->once())->method('getWorkspaceVersionOfRecord')->with($workspaceUid, 'tx_foo', '42')->will($this->returnValue($workspaceVersion));
                $mockTypo3DbBackend = $this->getAccessibleMock('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Storage\\Typo3DbBackend', array('dummy'), array(), '', FALSE);
                $mockTypo3DbBackend->_set('pageRepository', $pageRepositoryMock);
-               $this->assertSame(array($comparisonRow), $mockTypo3DbBackend->_call('doLanguageAndWorkspaceOverlay', $sourceMock, array($row), $querySettings, $workspaceUid));
+               $this->assertSame(array($comparisonRow), $mockTypo3DbBackend->_call('doLanguageAndWorkspaceOverlay', $sourceMock, array($row), $mockQuerySettings, $workspaceUid));
        }
 
        /**
@@ -485,8 +485,6 @@ class Typo3DbBackendTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
                $GLOBALS['TCA'][$table]['ctrl'] = array(
                        'rootLevel' => $rootLevel
                );
-               $querySettings = new \TYPO3\CMS\Extbase\Persistence\Generic\Typo3QuerySettings();
-               $querySettings->initializeObject();
                $sql = array();
                $storagePageIds = array(42,27);
                $mockTypo3DbBackend = $this->getAccessibleMock('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Storage\\Typo3DbBackend', array('dummy'), array(), '', FALSE);