mirror of
https://github.com/Codappix/search_core.git
synced 2024-11-23 15:56:11 +01:00
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.
This commit is contained in:
parent
75335e2bc1
commit
16bc22aa44
11 changed files with 73 additions and 16 deletions
|
@ -13,6 +13,7 @@ language: php
|
||||||
php:
|
php:
|
||||||
- 7.0
|
- 7.0
|
||||||
- 7.1
|
- 7.1
|
||||||
|
- 7.2
|
||||||
|
|
||||||
env:
|
env:
|
||||||
global:
|
global:
|
||||||
|
@ -24,6 +25,8 @@ env:
|
||||||
- typo3DatabaseHost="127.0.0.1"
|
- typo3DatabaseHost="127.0.0.1"
|
||||||
- typo3DatabaseUsername="travis"
|
- typo3DatabaseUsername="travis"
|
||||||
- typo3DatabasePassword=""
|
- typo3DatabasePassword=""
|
||||||
|
matrix:
|
||||||
|
- TYPO3_VERSION="~7.6"
|
||||||
|
|
||||||
matrix:
|
matrix:
|
||||||
fast_finish: true
|
fast_finish: true
|
||||||
|
|
|
@ -30,7 +30,7 @@ Then setup your system::
|
||||||
|
|
||||||
git clone git@github.com:codappix/search_core.git \
|
git clone git@github.com:codappix/search_core.git \
|
||||||
&& cd search_core \
|
&& cd search_core \
|
||||||
&& export typo3DatabaseName="searchcoretest76" \
|
&& export typo3DatabaseName="searchcoretest87" \
|
||||||
&& export TYPO3_VERSION="~8.7" \
|
&& export TYPO3_VERSION="~8.7" \
|
||||||
&& make install \
|
&& make install \
|
||||||
&& make unitTests \
|
&& 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
|
If you are working with multiple TYPO3 versions make sure to export `typo3DatabaseName` and
|
||||||
`TYPO3_VERSION` in your environment like::
|
`TYPO3_VERSION` in your environment like::
|
||||||
|
|
||||||
export typo3DatabaseName="searchcoretest62"
|
export typo3DatabaseName="searchcoretest76"
|
||||||
export TYPO3_VERSION="~6.2"
|
export TYPO3_VERSION="~7.6"
|
||||||
|
|
||||||
Also run the install command for each version before running any tests. Only this will make sure you
|
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.
|
are testing against the actual TYPO3 Version and database scheme.
|
||||||
|
|
11
Makefile
11
Makefile
|
@ -10,9 +10,18 @@ typo3DatabaseUsername ?= "dev"
|
||||||
typo3DatabasePassword ?= "dev"
|
typo3DatabasePassword ?= "dev"
|
||||||
typo3DatabaseHost ?= "127.0.0.1"
|
typo3DatabaseHost ?= "127.0.0.1"
|
||||||
|
|
||||||
|
sourceOrDist=--prefer-dist
|
||||||
|
ifeq ($(TYPO3_VERSION),~7.6)
|
||||||
|
sourceOrDist=--prefer-source
|
||||||
|
endif
|
||||||
|
|
||||||
.PHONY: install
|
.PHONY: install
|
||||||
install: clean
|
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
|
git checkout composer.json
|
||||||
|
|
||||||
cgl:
|
cgl:
|
||||||
|
|
9
Tests/Functional/Bootstrap.php
Normal file
9
Tests/Functional/Bootstrap.php
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$filePath = '.Build/vendor/typo3/testing-framework/Resources/Core/Build/FunctionalTestsBootstrap.php';
|
||||||
|
|
||||||
|
if (getenv('TYPO3_VERSION') === '~7.6') {
|
||||||
|
$filePath = '.Build/vendor/typo3/cms/typo3/sysext/core/Build/FunctionalTestsBootstrap.php';
|
||||||
|
}
|
||||||
|
|
||||||
|
require_once dirname(dirname(__DIR__)) . '/' . $filePath;
|
|
@ -1,8 +1,7 @@
|
||||||
<phpunit
|
<phpunit
|
||||||
backupGlobals="true"
|
backupGlobals="true"
|
||||||
backupStaticAttributes="false"
|
backupStaticAttributes="false"
|
||||||
bootstrap="../../.Build/vendor/typo3/testing-framework/Resources/Core/Build/FunctionalTestsBootstrap.php"
|
bootstrap="Bootstrap.php"
|
||||||
|
|
||||||
colors="true"
|
colors="true"
|
||||||
convertErrorsToExceptions="false"
|
convertErrorsToExceptions="false"
|
||||||
convertWarningsToExceptions="false"
|
convertWarningsToExceptions="false"
|
||||||
|
|
14
Tests/InstallPatches/composer.json.patch
Normal file
14
Tests/InstallPatches/composer.json.patch
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
diff --git a/composer.json b/composer.json
|
||||||
|
index 83e5f47..e9fa296 100644
|
||||||
|
--- a/composer.json
|
||||||
|
+++ b/composer.json
|
||||||
|
@@ -21,8 +21,7 @@
|
||||||
|
"ruflin/elastica": "~3.2"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
- "phpunit/phpunit": "~6.4.4",
|
||||||
|
- "typo3/testing-framework": "~1.1.5",
|
||||||
|
+ "phpunit/phpunit": "~5.7.0",
|
||||||
|
"squizlabs/php_codesniffer": "~3.1.1"
|
||||||
|
},
|
||||||
|
"config": {
|
9
Tests/Unit/Bootstrap.php
Normal file
9
Tests/Unit/Bootstrap.php
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$filePath = '.Build/vendor/typo3/testing-framework/Resources/Core/Build/UnitTestsBootstrap.php';
|
||||||
|
|
||||||
|
if (getenv('TYPO3_VERSION') === '~7.6') {
|
||||||
|
$filePath = '.Build/vendor/typo3/cms/typo3/sysext/core/Build/UnitTestsBootstrap.php';
|
||||||
|
}
|
||||||
|
|
||||||
|
require_once dirname(dirname(__DIR__)) . '/' . $filePath;
|
|
@ -1,7 +1,7 @@
|
||||||
<phpunit
|
<phpunit
|
||||||
backupGlobals="false"
|
backupGlobals="false"
|
||||||
backupStaticAttributes="false"
|
backupStaticAttributes="false"
|
||||||
bootstrap="../../.Build/vendor/typo3/testing-framework/Resources/Core/Build/UnitTestsBootstrap.php"
|
bootstrap="Bootstrap.php"
|
||||||
|
|
||||||
colors="true"
|
colors="true"
|
||||||
convertErrorsToExceptions="false"
|
convertErrorsToExceptions="false"
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
"php": ">=7.0.0",
|
"php": ">=7.0.0",
|
||||||
"typo3/cms": "~8.7",
|
"typo3/cms": ">= 7.6.0 < 9.0.0",
|
||||||
"ruflin/elastica": "~3.2"
|
"ruflin/elastica": "~3.2"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
|
|
|
@ -7,8 +7,8 @@ $EM_CONF[$_EXTKEY] = [
|
||||||
'clearCacheOnLoad' => 1,
|
'clearCacheOnLoad' => 1,
|
||||||
'constraints' => [
|
'constraints' => [
|
||||||
'depends' => [
|
'depends' => [
|
||||||
'typo3' => '8.7.0-8.7.99',
|
'typo3' => '7.6.0-8.7.99',
|
||||||
'php' => '7.1.0-7.99.99'
|
'php' => '7.0.0-7.2.99'
|
||||||
],
|
],
|
||||||
'conflicts' => [],
|
'conflicts' => [],
|
||||||
],
|
],
|
||||||
|
@ -18,7 +18,7 @@ $EM_CONF[$_EXTKEY] = [
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'state' => 'beta',
|
'state' => 'beta',
|
||||||
'version' => '1.0.0',
|
'version' => '0.0.1',
|
||||||
'author' => 'Daniel Siepmann',
|
'author' => 'Daniel Siepmann',
|
||||||
'author_email' => 'coding@daniel-siepmann.de',
|
'author_email' => 'coding@daniel-siepmann.de',
|
||||||
];
|
];
|
||||||
|
|
|
@ -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
|
// API does make use of object manager, therefore use GLOBALS
|
||||||
$extensionConfiguration = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf'][$extensionKey]);
|
$extensionConfiguration = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf'][$extensionKey]);
|
||||||
if ($extensionConfiguration === false
|
if ($extensionConfiguration === false
|
||||||
|| !isset($extensionConfiguration['disable.']['elasticsearch'])
|
|| !isset($extensionConfiguration['disable.']['elasticsearch'])
|
||||||
|| $extensionConfiguration['disable.']['elasticsearch'] !== '1'
|
|| $extensionConfiguration['disable.']['elasticsearch'] !== '1'
|
||||||
) {
|
) {
|
||||||
\TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\Object\Container\Container::class)
|
$container->registerImplementation(
|
||||||
->registerImplementation(
|
\Codappix\SearchCore\Connection\ConnectionInterface::class,
|
||||||
\Codappix\SearchCore\Connection\ConnectionInterface::class,
|
\Codappix\SearchCore\Connection\Elasticsearch::class
|
||||||
\Codappix\SearchCore\Connection\Elasticsearch::class
|
);
|
||||||
);
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
$_EXTKEY
|
$_EXTKEY
|
||||||
|
|
Loading…
Reference in a new issue