From 9d20524706053368ff9c0e82fc839cbbbb4cd16a Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Tue, 4 Jul 2017 10:12:47 +0200 Subject: [PATCH] WIP|TASK: Use new TYPO3 Use testing framework configuration. Use new db. Begin with replacement of old TYPO3_DB. --- Classes/Domain/Index/TcaIndexer.php | 10 ++++++++-- Makefile | 8 +++++--- Tests/Functional/FunctionalTests.xml | 2 +- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/Classes/Domain/Index/TcaIndexer.php b/Classes/Domain/Index/TcaIndexer.php index b50c6fa..3abdcb3 100644 --- a/Classes/Domain/Index/TcaIndexer.php +++ b/Classes/Domain/Index/TcaIndexer.php @@ -112,7 +112,7 @@ class TcaIndexer implements IndexerInterface */ protected function getRecords($offset, $limit) { - $records = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows( + $records = $this->getDatabaseConnection()->exec_SELECTgetRows( $this->tcaTableService->getFields(), $this->tcaTableService->getTableClause(), $this->tcaTableService->getWhereClause(), @@ -139,7 +139,7 @@ class TcaIndexer implements IndexerInterface */ protected function getRecord($identifier) { - $record = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow( + $record = $this->getDatabaseConnection()->exec_SELECTgetSingleRow( $this->tcaTableService->getFields(), $this->tcaTableService->getTableClause(), $this->tcaTableService->getWhereClause() @@ -156,4 +156,10 @@ class TcaIndexer implements IndexerInterface return $record; } + + protected function getDatabaseConnection() + { + return GeneralUtility::makeInstance(ConnectionPool::class) + ->getConnectionByName('Default'); + } } diff --git a/Makefile b/Makefile index 589dd7d..566709a 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,11 @@ mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST))) current_dir := $(dir $(mkfile_path)) -TYPO3_WEB_DIR := $(current_dir).Build/Web +TYPO3_WEB_DIR := $(current_dir).Build/web +TYPO3_PATH_ROOT := $(current_dir).Build/web # Allow different versions on travis -TYPO3_VERSION ?= ~7.6 -typo3DatabaseName ?= "searchcore_test" +TYPO3_VERSION ?= ~8.2 +typo3DatabaseName ?= "searchcore_test2" typo3DatabaseUsername ?= "dev" typo3DatabasePassword ?= "dev" typo3DatabaseHost ?= "127.0.0.1" @@ -21,6 +22,7 @@ functionalTests: typo3DatabaseHost=$(typo3DatabaseHost) \ TYPO3_PATH_WEB=$(TYPO3_WEB_DIR) \ .Build/bin/phpunit --colors --debug -v \ + --stop-on-error \ -c Tests/Functional/FunctionalTests.xml uploadCodeCoverage: uploadCodeCoverageToScrutinizer uploadCodeCoverageToCodacy diff --git a/Tests/Functional/FunctionalTests.xml b/Tests/Functional/FunctionalTests.xml index d42ef21..a318f65 100644 --- a/Tests/Functional/FunctionalTests.xml +++ b/Tests/Functional/FunctionalTests.xml @@ -1,7 +1,7 @@