From 16bc22aa44282d7e668476336513139e19a59d6f Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Tue, 13 Mar 2018 11:28:40 +0100 Subject: [PATCH] TASK: Support tests for TYPO3 CMS 7.6 Check which version to run and switch TYPO3 bootstrapping. Also allow tests to run with TYPO3 CMS 7.6 again. --- .travis.yml | 3 +++ .../source/development/contribution.rst | 6 ++--- Makefile | 11 ++++++++- Tests/Functional/Bootstrap.php | 9 +++++++ Tests/Functional/FunctionalTests.xml | 3 +-- Tests/InstallPatches/composer.json.patch | 14 +++++++++++ Tests/Unit/Bootstrap.php | 9 +++++++ Tests/Unit/UnitTests.xml | 2 +- composer.json | 2 +- ext_emconf.php | 6 ++--- ext_localconf.php | 24 +++++++++++++++---- 11 files changed, 73 insertions(+), 16 deletions(-) create mode 100644 Tests/Functional/Bootstrap.php create mode 100644 Tests/InstallPatches/composer.json.patch create mode 100644 Tests/Unit/Bootstrap.php diff --git a/.travis.yml b/.travis.yml index a765673..2babbf3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,6 +13,7 @@ language: php php: - 7.0 - 7.1 + - 7.2 env: global: @@ -24,6 +25,8 @@ env: - typo3DatabaseHost="127.0.0.1" - typo3DatabaseUsername="travis" - typo3DatabasePassword="" + matrix: + - TYPO3_VERSION="~7.6" matrix: fast_finish: true diff --git a/Documentation/source/development/contribution.rst b/Documentation/source/development/contribution.rst index c362c37..f65bb21 100644 --- a/Documentation/source/development/contribution.rst +++ b/Documentation/source/development/contribution.rst @@ -30,7 +30,7 @@ Then setup your system:: git clone git@github.com:codappix/search_core.git \ && cd search_core \ - && export typo3DatabaseName="searchcoretest76" \ + && export typo3DatabaseName="searchcoretest87" \ && export TYPO3_VERSION="~8.7" \ && make install \ && make unitTests \ @@ -41,8 +41,8 @@ If all tests are okay, start your work. If you are working with multiple TYPO3 versions make sure to export `typo3DatabaseName` and `TYPO3_VERSION` in your environment like:: - export typo3DatabaseName="searchcoretest62" - export TYPO3_VERSION="~6.2" + export typo3DatabaseName="searchcoretest76" + export TYPO3_VERSION="~7.6" Also run the install command for each version before running any tests. Only this will make sure you are testing against the actual TYPO3 Version and database scheme. diff --git a/Makefile b/Makefile index b8f4ac5..ac3d7d5 100644 --- a/Makefile +++ b/Makefile @@ -10,9 +10,18 @@ typo3DatabaseUsername ?= "dev" typo3DatabasePassword ?= "dev" typo3DatabaseHost ?= "127.0.0.1" +sourceOrDist=--prefer-dist +ifeq ($(TYPO3_VERSION),~7.6) + sourceOrDist=--prefer-source +endif + .PHONY: install install: clean - COMPOSER_PROCESS_TIMEOUT=1000 composer require -vv --dev --prefer-dist typo3/cms="$(TYPO3_VERSION)" + if [ $(TYPO3_VERSION) = ~7.6 ]; then \ + patch composer.json Tests/InstallPatches/composer.json.patch; \ + fi + + COMPOSER_PROCESS_TIMEOUT=1000 composer require -vv --dev $(sourceOrDist) typo3/cms="$(TYPO3_VERSION)" git checkout composer.json cgl: diff --git a/Tests/Functional/Bootstrap.php b/Tests/Functional/Bootstrap.php new file mode 100644 index 0000000..66b8eba --- /dev/null +++ b/Tests/Functional/Bootstrap.php @@ -0,0 +1,9 @@ +=7.0.0", - "typo3/cms": "~8.7", + "typo3/cms": ">= 7.6.0 < 9.0.0", "ruflin/elastica": "~3.2" }, "require-dev": { diff --git a/ext_emconf.php b/ext_emconf.php index 4d342a5..7c3a087 100644 --- a/ext_emconf.php +++ b/ext_emconf.php @@ -7,8 +7,8 @@ $EM_CONF[$_EXTKEY] = [ 'clearCacheOnLoad' => 1, 'constraints' => [ 'depends' => [ - 'typo3' => '8.7.0-8.7.99', - 'php' => '7.1.0-7.99.99' + 'typo3' => '7.6.0-8.7.99', + 'php' => '7.0.0-7.2.99' ], 'conflicts' => [], ], @@ -18,7 +18,7 @@ $EM_CONF[$_EXTKEY] = [ ], ], 'state' => 'beta', - 'version' => '1.0.0', + 'version' => '0.0.1', 'author' => 'Daniel Siepmann', 'author_email' => 'coding@daniel-siepmann.de', ]; diff --git a/ext_localconf.php b/ext_localconf.php index a713d0b..d4d7cef 100644 --- a/ext_localconf.php +++ b/ext_localconf.php @@ -37,17 +37,31 @@ call_user_func( ] ); + // Register different concrete implementations, depending on current TYPO3 version. + // This way we can provide working implementations for multiple TYPO3 versions. + $container = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\Object\Container\Container::class); + if (\TYPO3\CMS\Core\Utility\VersionNumberUtility::convertVersionNumberToInteger(TYPO3_version) >= 8000000) { + $container->registerImplementation( + \Codappix\SearchCore\Compatibility\TypoScriptServiceInterface::class, + \TYPO3\CMS\Core\TypoScript\TypoScriptService::class + ); + } else { + $container->registerImplementation( + \Codappix\SearchCore\Compatibility\TypoScriptServiceInterface::class, + \TYPO3\CMS\Extbase\Service\TypoScriptService::class + ); + } + // API does make use of object manager, therefore use GLOBALS $extensionConfiguration = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf'][$extensionKey]); if ($extensionConfiguration === false || !isset($extensionConfiguration['disable.']['elasticsearch']) || $extensionConfiguration['disable.']['elasticsearch'] !== '1' ) { - \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\Object\Container\Container::class) - ->registerImplementation( - \Codappix\SearchCore\Connection\ConnectionInterface::class, - \Codappix\SearchCore\Connection\Elasticsearch::class - ); + $container->registerImplementation( + \Codappix\SearchCore\Connection\ConnectionInterface::class, + \Codappix\SearchCore\Connection\Elasticsearch::class + ); } }, $_EXTKEY