/** * Debugs a SQL query from a QueryResult * * @param \TYPO3\CMS\Extbase\Persistence\Generic\QueryResult $queryResult * @param boolean $explainOutput * @return void */ public function debugQuery(\TYPO3\CMS\Extbase\Persistence\Generic\QueryResult $queryResult, $explainOutput = false) { $GLOBALS['TYPO3_DB']->debugOuput = 2; if ($explainOutput) { $GLOBALS['TYPO3_DB']->explainOutput = true; } $GLOBALS['TYPO3_DB']->store_lastBuiltQuery = true; $queryResult->toArray(); var_dump($GLOBALS['TYPO3_DB']->debug_lastBuiltQuery); $GLOBALS['TYPO3_DB']->store_lastBuiltQuery = false; $GLOBALS['TYPO3_DB']->explainOutput = false; $GLOBALS['TYPO3_DB']->debugOuput = false; }
/** * @test */ public function countCountsQueryResultDirectlyIfAlreadyInitialized() { $this->mockPersistenceManager->expects($this->never())->method('getObjectCountByQuery'); $this->queryResult->toArray(); $this->assertEquals(2, $this->queryResult->count()); }