Merge pull request #101 from Codappix/feature/phpcs-travis

Feature: Run phpcs on travis
This commit is contained in:
Daniel Siepmann 2018-03-06 15:11:46 +01:00 committed by GitHub
commit 6ac2680211
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 59 additions and 13 deletions

View file

@ -34,6 +34,7 @@ services:
install: make install
script:
- make cgl
- make unitTests
- make functionalTests

View file

@ -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]
);
}
}

View file

@ -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')
);
}
}

View file

@ -161,7 +161,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
@ -169,7 +173,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]);

View file

@ -15,6 +15,9 @@ install: clean
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) \

View file

@ -29,7 +29,10 @@ class FacetTest extends AbstractFunctionalTestCase
{
protected function getTypoScriptFilesForFrontendRootPage()
{
return array_merge(parent::getTypoScriptFilesForFrontendRootPage(), ['EXT:search_core/Tests/Functional/Fixtures/Searching/Facet.ts']);
return array_merge(
parent::getTypoScriptFilesForFrontendRootPage(),
['EXT:search_core/Tests/Functional/Fixtures/Searching/Facet.ts']
);
}
protected function getDataSets()

View file

@ -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(

View file

@ -21,8 +21,9 @@
"ruflin/elastica": "~3.2"
},
"require-dev": {
"typo3/testing-framework": "~1.1.0",
"phpunit/phpunit": "~6.2.0"
"phpunit/phpunit": "~6.4.4",
"typo3/testing-framework": "~1.1.5",
"squizlabs/php_codesniffer": "~3.1.1"
},
"config": {
"optimize-autoloader": true,
@ -36,9 +37,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
View 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>