mirror of
https://github.com/Codappix/search_core.git
synced 2024-11-24 03:16:11 +01:00
TASK: Use Code Sniffer at travis
This way we need no external service. Each developer can fully run all tests and cgl on local environment. Also this integrated better into IDEs and editors.
This commit is contained in:
parent
689d8f0c53
commit
b7b783a7fe
10 changed files with 64 additions and 18 deletions
|
@ -33,6 +33,7 @@ services:
|
||||||
install: make install
|
install: make install
|
||||||
|
|
||||||
script:
|
script:
|
||||||
|
- make cgl
|
||||||
- make unitTests
|
- make unitTests
|
||||||
- make functionalTests
|
- make functionalTests
|
||||||
|
|
||||||
|
|
|
@ -132,7 +132,10 @@ class Elasticsearch implements Singleton, ConnectionInterface
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
} catch (\Elastica\Exception\NotFoundException $exception) {
|
} catch (\Elastica\Exception\NotFoundException $exception) {
|
||||||
$this->logger->debug('Tried to delete document in index, which does not exist.', [$documentType, $identifier]);
|
$this->logger->debug(
|
||||||
|
'Tried to delete document in index, which does not exist.',
|
||||||
|
[$documentType, $identifier]
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -159,7 +159,9 @@ class TcaTableService
|
||||||
$parameters = [];
|
$parameters = [];
|
||||||
$whereClause = $this->getSystemWhereClause();
|
$whereClause = $this->getSystemWhereClause();
|
||||||
|
|
||||||
$userDefinedWhere = $this->configuration->getIfExists('indexing.' . $this->getTableName() . '.additionalWhereClause');
|
$userDefinedWhere = $this->configuration->getIfExists(
|
||||||
|
'indexing.' . $this->getTableName() . '.additionalWhereClause'
|
||||||
|
);
|
||||||
if (is_string($userDefinedWhere)) {
|
if (is_string($userDefinedWhere)) {
|
||||||
$whereClause .= ' AND ' . $userDefinedWhere;
|
$whereClause .= ' AND ' . $userDefinedWhere;
|
||||||
}
|
}
|
||||||
|
@ -361,6 +363,9 @@ class TcaTableService
|
||||||
*/
|
*/
|
||||||
protected function getBlackListedRootLine() : array
|
protected function getBlackListedRootLine() : array
|
||||||
{
|
{
|
||||||
return GeneralUtility::intExplode(',', $this->configuration->getIfExists('indexing.' . $this->getTableName() . '.rootLineBlacklist'));
|
return GeneralUtility::intExplode(
|
||||||
|
',',
|
||||||
|
$this->configuration->getIfExists('indexing.' . $this->getTableName() . '.rootLineBlacklist')
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -163,7 +163,11 @@ class QueryFactory
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$query = ArrayUtility::arrayMergeRecursiveOverrule($query, [
|
$query = ArrayUtility::arrayMergeRecursiveOverrule($query, [
|
||||||
'stored_fields' => GeneralUtility::trimExplode(',', $this->configuration->get('searching.fields.stored_fields'), true),
|
'stored_fields' => GeneralUtility::trimExplode(
|
||||||
|
',',
|
||||||
|
$this->configuration->get('searching.fields.stored_fields'),
|
||||||
|
true
|
||||||
|
),
|
||||||
]);
|
]);
|
||||||
} catch (InvalidArgumentException $e) {
|
} catch (InvalidArgumentException $e) {
|
||||||
// Nothing configured
|
// Nothing configured
|
||||||
|
@ -171,7 +175,10 @@ class QueryFactory
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$scriptFields = $this->configuration->get('searching.fields.script_fields');
|
$scriptFields = $this->configuration->get('searching.fields.script_fields');
|
||||||
$scriptFields = $this->configurationUtility->replaceArrayValuesWithRequestContent($searchRequest, $scriptFields);
|
$scriptFields = $this->configurationUtility->replaceArrayValuesWithRequestContent(
|
||||||
|
$searchRequest,
|
||||||
|
$scriptFields
|
||||||
|
);
|
||||||
$scriptFields = $this->configurationUtility->filterByCondition($scriptFields);
|
$scriptFields = $this->configurationUtility->filterByCondition($scriptFields);
|
||||||
if ($scriptFields !== []) {
|
if ($scriptFields !== []) {
|
||||||
$query = ArrayUtility::arrayMergeRecursiveOverrule($query, ['script_fields' => $scriptFields]);
|
$query = ArrayUtility::arrayMergeRecursiveOverrule($query, ['script_fields' => $scriptFields]);
|
||||||
|
|
|
@ -103,8 +103,13 @@ class DataHandler implements Singleton
|
||||||
*
|
*
|
||||||
* @return bool False if hook was not processed.
|
* @return bool False if hook was not processed.
|
||||||
*/
|
*/
|
||||||
public function processDatamap_afterDatabaseOperations($status, $table, $uid, array $fieldArray, CoreDataHandler $dataHandler)
|
public function processDatamap_afterDatabaseOperations(
|
||||||
{
|
$status,
|
||||||
|
$table,
|
||||||
|
$uid,
|
||||||
|
array $fieldArray,
|
||||||
|
CoreDataHandler $dataHandler
|
||||||
|
) {
|
||||||
if (! $this->shouldProcessHookForTable($table)) {
|
if (! $this->shouldProcessHookForTable($table)) {
|
||||||
$this->logger->debug('Database update not processed.', [$table, $uid]);
|
$this->logger->debug('Database update not processed.', [$table, $uid]);
|
||||||
return false;
|
return false;
|
||||||
|
|
5
Makefile
5
Makefile
|
@ -12,9 +12,12 @@ typo3DatabaseHost ?= "127.0.0.1"
|
||||||
|
|
||||||
.PHONY: install
|
.PHONY: install
|
||||||
install: clean
|
install: clean
|
||||||
COMPOSER_PROCESS_TIMEOUT=1000 composer require -vv --dev --prefer-dist --ignore-platform-reqs typo3/cms="$(TYPO3_VERSION)"
|
COMPOSER_PROCESS_TIMEOUT=1000 composer require -vv --dev --prefer-dist typo3/cms="$(TYPO3_VERSION)"
|
||||||
git checkout composer.json
|
git checkout composer.json
|
||||||
|
|
||||||
|
cgl:
|
||||||
|
./.Build/bin/phpcs
|
||||||
|
|
||||||
functionalTests:
|
functionalTests:
|
||||||
typo3DatabaseName=$(typo3DatabaseName) \
|
typo3DatabaseName=$(typo3DatabaseName) \
|
||||||
typo3DatabaseUsername=$(typo3DatabaseUsername) \
|
typo3DatabaseUsername=$(typo3DatabaseUsername) \
|
||||||
|
|
|
@ -31,8 +31,11 @@ class ConfigurationUtilityTest extends AbstractUnitTestCase
|
||||||
* @test
|
* @test
|
||||||
* @dataProvider possibleRequestAndConfigurationForFluidtemplate
|
* @dataProvider possibleRequestAndConfigurationForFluidtemplate
|
||||||
*/
|
*/
|
||||||
public function recursiveEntriesAreProcessedAsFluidtemplate(SearchRequestInterface $searchRequest, array $array, array $expected)
|
public function recursiveEntriesAreProcessedAsFluidtemplate(
|
||||||
{
|
SearchRequestInterface $searchRequest,
|
||||||
|
array $array,
|
||||||
|
array $expected
|
||||||
|
) {
|
||||||
$subject = new ConfigurationUtility();
|
$subject = new ConfigurationUtility();
|
||||||
|
|
||||||
$this->assertSame(
|
$this->assertSame(
|
||||||
|
|
|
@ -465,7 +465,6 @@ class QueryFactoryTest extends AbstractUnitTestCase
|
||||||
$query->toArray()['script_fields'],
|
$query->toArray()['script_fields'],
|
||||||
'Script fields were not added to query as expected.'
|
'Script fields were not added to query as expected.'
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -16,13 +16,13 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"require" : {
|
"require" : {
|
||||||
"php": ">=7.1.0",
|
"php": ">=5.6.0",
|
||||||
"typo3/cms": "~8.7",
|
|
||||||
"ruflin/elastica": "~3.2"
|
"ruflin/elastica": "~3.2"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"typo3/testing-framework": "~1.1.0",
|
"phpunit/phpunit": "~5.7.0",
|
||||||
"phpunit/phpunit": "~6.2.0"
|
"squizlabs/php_codesniffer": "~3.1.1",
|
||||||
|
"typo3/cms": "~7.6"
|
||||||
},
|
},
|
||||||
"config": {
|
"config": {
|
||||||
"optimize-autoloader": true,
|
"optimize-autoloader": true,
|
||||||
|
@ -36,9 +36,6 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"extra": {
|
"extra": {
|
||||||
"branch-alias": {
|
|
||||||
"dev-develop": "1.0.x-dev"
|
|
||||||
},
|
|
||||||
"typo3/cms": {
|
"typo3/cms": {
|
||||||
"cms-package-dir": "{$vendor-dir}/typo3/cms",
|
"cms-package-dir": "{$vendor-dir}/typo3/cms",
|
||||||
"web-dir": ".Build/web"
|
"web-dir": ".Build/web"
|
||||||
|
|
23
phpcs.xml.dist
Normal file
23
phpcs.xml.dist
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<ruleset name="search_core">
|
||||||
|
<description>The coding standard for search_core.</description>
|
||||||
|
|
||||||
|
<file>Classes/</file>
|
||||||
|
<file>Tests/</file>
|
||||||
|
|
||||||
|
<!-- Set default settings -->
|
||||||
|
<arg value="sp"/>
|
||||||
|
<arg name="colors"/>
|
||||||
|
<arg name="encoding" value="utf-8" />
|
||||||
|
<arg name="extensions" value="php,php.dist,inc" />
|
||||||
|
|
||||||
|
<!-- Base rules -->
|
||||||
|
<rule ref="PSR2">
|
||||||
|
<!-- As it does not work with new array syntax. -->
|
||||||
|
<exclude name="Squiz.Arrays.ArrayBracketSpacing.SpaceBeforeBracket" />
|
||||||
|
</rule>
|
||||||
|
<rule ref="PSR1.Methods.CamelCapsMethodName.NotCamelCaps">
|
||||||
|
<!-- We have to follow the TYPO3 hook method names. -->
|
||||||
|
<exclude-pattern>Classes/Hook/DataHandler.php</exclude-pattern>
|
||||||
|
</rule>
|
||||||
|
</ruleset>
|
Loading…
Reference in a new issue