mirror of
https://github.com/Codappix/search_core.git
synced 2024-12-22 02:16:09 +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
|
||||
|
||||
script:
|
||||
- make cgl
|
||||
- make unitTests
|
||||
- make functionalTests
|
||||
|
||||
|
|
|
@ -132,7 +132,10 @@ class Elasticsearch implements Singleton, ConnectionInterface
|
|||
}
|
||||
);
|
||||
} 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 = [];
|
||||
$whereClause = $this->getSystemWhereClause();
|
||||
|
||||
$userDefinedWhere = $this->configuration->getIfExists('indexing.' . $this->getTableName() . '.additionalWhereClause');
|
||||
$userDefinedWhere = $this->configuration->getIfExists(
|
||||
'indexing.' . $this->getTableName() . '.additionalWhereClause'
|
||||
);
|
||||
if (is_string($userDefinedWhere)) {
|
||||
$whereClause .= ' AND ' . $userDefinedWhere;
|
||||
}
|
||||
|
@ -361,6 +363,9 @@ class TcaTableService
|
|||
*/
|
||||
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 {
|
||||
$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) {
|
||||
// Nothing configured
|
||||
|
@ -171,7 +175,10 @@ class QueryFactory
|
|||
|
||||
try {
|
||||
$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);
|
||||
if ($scriptFields !== []) {
|
||||
$query = ArrayUtility::arrayMergeRecursiveOverrule($query, ['script_fields' => $scriptFields]);
|
||||
|
|
|
@ -103,8 +103,13 @@ class DataHandler implements Singleton
|
|||
*
|
||||
* @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)) {
|
||||
$this->logger->debug('Database update not processed.', [$table, $uid]);
|
||||
return false;
|
||||
|
|
5
Makefile
5
Makefile
|
@ -12,9 +12,12 @@ typo3DatabaseHost ?= "127.0.0.1"
|
|||
|
||||
.PHONY: install
|
||||
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
|
||||
|
||||
cgl:
|
||||
./.Build/bin/phpcs
|
||||
|
||||
functionalTests:
|
||||
typo3DatabaseName=$(typo3DatabaseName) \
|
||||
typo3DatabaseUsername=$(typo3DatabaseUsername) \
|
||||
|
|
|
@ -31,8 +31,11 @@ class ConfigurationUtilityTest extends AbstractUnitTestCase
|
|||
* @test
|
||||
* @dataProvider possibleRequestAndConfigurationForFluidtemplate
|
||||
*/
|
||||
public function recursiveEntriesAreProcessedAsFluidtemplate(SearchRequestInterface $searchRequest, array $array, array $expected)
|
||||
{
|
||||
public function recursiveEntriesAreProcessedAsFluidtemplate(
|
||||
SearchRequestInterface $searchRequest,
|
||||
array $array,
|
||||
array $expected
|
||||
) {
|
||||
$subject = new ConfigurationUtility();
|
||||
|
||||
$this->assertSame(
|
||||
|
|
|
@ -465,7 +465,6 @@ class QueryFactoryTest extends AbstractUnitTestCase
|
|||
$query->toArray()['script_fields'],
|
||||
'Script fields were not added to query as expected.'
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -16,13 +16,13 @@
|
|||
}
|
||||
},
|
||||
"require" : {
|
||||
"php": ">=7.1.0",
|
||||
"typo3/cms": "~8.7",
|
||||
"php": ">=5.6.0",
|
||||
"ruflin/elastica": "~3.2"
|
||||
},
|
||||
"require-dev": {
|
||||
"typo3/testing-framework": "~1.1.0",
|
||||
"phpunit/phpunit": "~6.2.0"
|
||||
"phpunit/phpunit": "~5.7.0",
|
||||
"squizlabs/php_codesniffer": "~3.1.1",
|
||||
"typo3/cms": "~7.6"
|
||||
},
|
||||
"config": {
|
||||
"optimize-autoloader": true,
|
||||
|
@ -36,9 +36,6 @@
|
|||
]
|
||||
},
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-develop": "1.0.x-dev"
|
||||
},
|
||||
"typo3/cms": {
|
||||
"cms-package-dir": "{$vendor-dir}/typo3/cms",
|
||||
"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