/**
  * @test
  */
 public function errorOnDbError()
 {
     $configurationBuilderMock = Tx_PtExtlist_Tests_Domain_Configuration_ConfigurationBuilderMock::getInstance();
     $dataSourceConfig = new Tx_PtExtlist_Domain_Configuration_DataBackend_DataSource_DatabaseDataSourceConfiguration($configurationBuilderMock->buildDataBackendConfiguration()->getDataSourceSettings());
     $mysqlDataSource = new Tx_PtExtlist_Domain_DataBackend_DataSource_MySqlDataSource($dataSourceConfig);
     $pdoMock = $this->getMock('TestPDO', array('prepare'));
     $pdoMock->expects($this->once())->method('prepare')->will($this->returnValue(new Tx_PtExtlist_Tests_Domain_DataBackend_DataSource_PDOErrorMock()));
     $mysqlDataSource->injectDbObject($pdoMock);
     try {
         $result = $mysqlDataSource->executeQuery('SELECT * FROM test')->fetchAll();
     } catch (Exception $e) {
         return;
     }
     $this->fail('No exception has been thrown on DB error!');
 }
Example #2
0
 /**
  * Aggreagte the list by field and method or special sql
  *
  * @param Tx_PtExtlist_Domain_Configuration_Data_Aggregates_AggregateConfigCollection $aggregateConfigCollection
  */
 public function getAggregatesByConfigCollection(Tx_PtExtlist_Domain_Configuration_Data_Aggregates_AggregateConfigCollection $aggregateConfigCollection)
 {
     $aggregateSQLQuery = $this->buildAggregateSQLByConfigCollection($aggregateConfigCollection);
     $aggregates = $this->dataSource->executeQuery($aggregateSQLQuery)->fetchAll();
     if (TYPO3_DLOG) {
         \TYPO3\CMS\Core\Utility\GeneralUtility::devLog($this->listIdentifier . '->aggregateQuery', 'pt_extlist', 1, array('executionTime' => $this->dataSource->getLastQueryExecutionTime(), 'query' => $aggregateSQLQuery));
     }
     return $aggregates[0];
 }
 public function executeQuery($query)
 {
     // Added to log select queries
     foreach ($this->preProcessHookObjects as $preProcessHookObject) {
         /* @var $preProcessHookObject Tx_SandstormmediaPlumber_Hooks_Hook */
         $preProcessHookObject->extlist_preProcessAction(self::$queryCounter++ . ' ' . $query);
     }
     $result = parent::executeQuery($query);
     // Added to log select queries
     foreach ($this->postProcessHookObjects as $postProcessHookObject) {
         /* @var $postProcessHookObject Tx_SandstormmediaPlumber_Hooks_Hook */
         $postProcessHookObject->extlist_postProcessAction();
     }
     return $result;
 }