Commit 3db4a3e8 authored by Morton Jonuschat's avatar Morton Jonuschat Committed by Christian Kuhn
Browse files

[FOLLOWUP][TASK] Doctrine: migrate $GLOBALS['TYPO3_DB']->exec_TRUNCATEquery

Fix unit test for Typo3DatabaseBackend

Resolves: #75969
Releases: master
Change-Id: I61049768b2981f7b1a93ab371fd31c0a58edc474
Reviewed-on: https://review.typo3.org/47964


Reviewed-by: Markus Klein's avatarMarkus Klein <markus.klein@typo3.org>
Reviewed-by: Frank Nägler's avatarFrank Naegler <frank.naegler@typo3.org>
Tested-by: Frank Nägler's avatarFrank Naegler <frank.naegler@typo3.org>
Reviewed-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
parent d3d23b47
......@@ -13,6 +13,7 @@ namespace TYPO3\CMS\Core\Tests\Unit\Cache\Backend;
*
* The TYPO3 project - inspiring people to share!
*/
use Prophecy\Argument;
use TYPO3\CMS\Core\Database\Connection;
use TYPO3\CMS\Core\Database\ConnectionPool;
use TYPO3\CMS\Core\Utility\GeneralUtility;
......@@ -485,15 +486,16 @@ class Typo3DatabaseBackendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
$backend = $this->getMock(\TYPO3\CMS\Core\Cache\Backend\Typo3DatabaseBackend::class, array('dummy'), array('Testing'));
$this->setUpMockFrontendOfBackend($backend);
$GLOBALS['TYPO3_DB'] = $this->getMock(\TYPO3\CMS\Core\Database\DatabaseConnection::class, array(), array(), '', false);
$GLOBALS['TYPO3_DB']
->expects($this->at(0))
->method('exec_TRUNCATEquery')
->with('cf_Testing');
$GLOBALS['TYPO3_DB']
->expects($this->at(1))
->method('exec_TRUNCATEquery')
->with('cf_Testing_tags');
$connectionProphet = $this->prophesize(Connection::class);
$connectionProphet->truncate('cf_Testing')->shouldBeCalled()->willReturn(0);
$connectionProphet->truncate('cf_Testing_tags')->shouldBeCalled()->willReturn(0);
$connectionPoolProphet = $this->prophesize(ConnectionPool::class);
$connectionPoolProphet->getConnectionForTable(Argument::cetera())->willReturn($connectionProphet->reveal());
// Two instances are required as there are different tables being cleared
GeneralUtility::addInstance(ConnectionPool::class, $connectionPoolProphet->reveal());
GeneralUtility::addInstance(ConnectionPool::class, $connectionPoolProphet->reveal());
$backend->flush();
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment