[TASK] Process own feedback based on tests

This commit is contained in:
Benjamin Serfhos 2018-10-25 14:01:57 +02:00
parent 628f76af4b
commit b70dd604fe
53 changed files with 191 additions and 140 deletions

View file

@ -77,7 +77,7 @@ class IndexCommandController extends CommandController
$identifiers = GeneralUtility::trimExplode(',', $identifier, true);
foreach ($identifiers as $value) {
try {
$this->indexerFactory->getIndexer($value)->delete();
$this->indexerFactory->getIndexer($value)->deleteDocuments();
$this->outputLine($value . ' was deleted.');
} catch (NoMatchingIndexerException $e) {
$this->outputLine('No indexer found for: ' . $value);

View file

@ -1,4 +1,5 @@
<?php
namespace Codappix\SearchCore\Compatibility;
/*

View file

@ -1,4 +1,5 @@
<?php
namespace Codappix\SearchCore\Compatibility;
/*

View file

@ -1,4 +1,5 @@
<?php
namespace Codappix\SearchCore\Compatibility;
/*

View file

@ -1,4 +1,5 @@
<?php
namespace Codappix\SearchCore\Compatibility;
/*

View file

@ -221,14 +221,14 @@ class Elasticsearch implements Singleton, ConnectionInterface
*/
protected function withType(string $documentType, callable $callback)
{
$type = $this->getType();
$type = $this->getType($documentType);
// TODO: Check whether it's to heavy to send it so often e.g. for every single document.
// Perhaps add command controller to submit mapping?!
// Also it's not possible to change mapping without deleting index first.
// Mattes told about a solution.
// So command looks like the best way so far, except we manage mattes solution.
// Still then this should be done once. So perhaps singleton which tracks state and does only once?
$this->mappingFactory->getMapping($type)->send();
$this->mappingFactory->getMapping($type, $documentType)->send();
$callback($type);
$type->getIndex()->refresh();
}
@ -249,14 +249,15 @@ class Elasticsearch implements Singleton, ConnectionInterface
}
/**
* @param string $documentType
* @return \Elastica\Type
*/
protected function getType(): \Elastica\Type
protected function getType($documentType): \Elastica\Type
{
return $this->typeFactory->getType(
$this->indexFactory->getIndex(
$this->connection,
'document'
$documentType
),
'document'
);

View file

@ -47,14 +47,15 @@ class MappingFactory implements Singleton
* Get an mapping based on type.
*
* @param \Elastica\Type $type
* @param string $documentType
* @return \Elastica\Type\Mapping
*/
public function getMapping(\Elastica\Type $type): \Elastica\Type\Mapping
public function getMapping(\Elastica\Type $type, $documentType = null): \Elastica\Type\Mapping
{
$mapping = new \Elastica\Type\Mapping();
$mapping->setType($type);
$configuration = $this->getConfiguration($type->getName());
$configuration = $this->getConfiguration($documentType ?? $type->getName());
$mapping->setProperties($configuration);
return $mapping;

View file

@ -120,7 +120,7 @@ abstract class AbstractIndexer implements IndexerInterface
$this->connection->addDocument($this->getDocumentName(), $record);
} catch (NoRecordFoundException $e) {
$this->logger->info('Could not index document. Try to delete it therefore.', [$e->getMessage()]);
$this->connection->deleteDocument($this->getDocumentName(), $identifier);
$this->connection->deleteDocument($this->getDocumentName(), $this->getIdentifier($identifier));
}
$this->logger->info('Finish indexing');
}
@ -131,6 +131,16 @@ abstract class AbstractIndexer implements IndexerInterface
public function delete()
{
$this->logger->info('Start deletion of index.');
$this->connection->deleteIndex();
$this->logger->info('Finish deletion.');
}
/**
* @return void
*/
public function deleteDocuments()
{
$this->logger->info('Start deletion of indexed documents.');
$this->connection->deleteIndexByQuery(Query::create([
'query' => [
'term' => [
@ -184,7 +194,7 @@ abstract class AbstractIndexer implements IndexerInterface
$record['search_document_type'] = $this->getDocumentName();
}
if (!isset($record['search_identifier']) && isset($record['uid'])) {
$record['search_identifier'] = $this->getDocumentName() . '-' . $record['uid'];
$record['search_identifier'] = $this->getIdentifier($record['uid']);
}
}
@ -244,4 +254,10 @@ abstract class AbstractIndexer implements IndexerInterface
* @return string
*/
abstract protected function getDocumentName(): string;
/**
* @param string $identifier
* @return string
*/
abstract public function getIdentifier($identifier): string;
}

View file

@ -55,4 +55,11 @@ interface IndexerInterface
* @return void
*/
public function delete();
/**
* Delete the whole index.
*
* @return void
*/
public function deleteDocuments();
}

View file

@ -77,7 +77,6 @@ class TcaIndexer extends AbstractIndexer
protected function getRecord(int $identifier): array
{
$record = $this->tcaTableService->getRecord($identifier);
if ($record === []) {
throw new NoRecordFoundException(
'Record could not be fetched from database: "' . $identifier . '". Perhaps record is not active.',
@ -96,4 +95,13 @@ class TcaIndexer extends AbstractIndexer
{
return $this->tcaTableService->getTableName();
}
/**
* @param string $identifier
* @return string
*/
public function getIdentifier($identifier): string
{
return $this->getDocumentName() . '-' . $identifier;
}
}

View file

@ -68,7 +68,7 @@ class PagesIndexer extends TcaIndexer
parent::prepareRecord($record);
// Override access from parent rootline
$record['search_access'] = $this->fetchAccess($record['uid'], $record['search_access']);
$record['search_access'] = $this->fetchAccess($record['uid'], (array)$record['search_access']);
$possibleTitleFields = ['nav_title', 'tx_tqseo_pagetitle_rel', 'title'];
foreach ($possibleTitleFields as $searchTitleField) {

View file

@ -135,12 +135,13 @@ class RelationResolver implements Singleton
protected function getColumnValue(array $record, string $column, TcaTableServiceInterface $service): string
{
$utility = GeneralUtility::makeInstance($this->getUtilityForMode());
return $utility::getProcessedValueExtra(
$service->getTableName(),
$column,
$record[$column],
0,
$record['uid']
) ?? '';
$value = $value = $utility::getProcessedValueExtra(
$service->getTableName(),
$column,
$record[$column],
0,
$record['uid']
);
return $value ? (string)$value : '';
}
}

View file

@ -187,6 +187,9 @@ class TcaTableService implements TcaTableServiceInterface
case 'pages':
$record['search_page_typolink'] = 't3://page?uid=' . $record['uid'];
break;
case 'tt_content':
$record['search_page_typolink'] = 't3://page?uid=' . $record['pid'] . '#' . $record['uid'];
break;
case 'sys_file':
$record['search_page_typolink'] = 't3://file?uid=' . $record['uid'];
break;

View file

@ -1,4 +1,5 @@
<?php
namespace Codappix\SearchCore\Domain\Search;
class MissingAttributeException extends \InvalidArgumentException

View file

@ -31,5 +31,4 @@ class ArrayUtility
}
return $result;
}
}

View file

@ -1,4 +1,5 @@
<?php
namespace Codappix\SearchCore\Tests\Functional;
/*
@ -67,7 +68,7 @@ abstract class AbstractFunctionalTestCase extends CoreTestCase
return ['EXT:search_core/Tests/Functional/Fixtures/BasicSetup.ts'];
}
protected function isLegacyVersion() : bool
protected function isLegacyVersion(): bool
{
return \TYPO3\CMS\Core\Utility\VersionNumberUtility::convertVersionNumberToInteger(TYPO3_version) < 8000000;
}

View file

@ -1,4 +1,5 @@
<?php
namespace Codappix\SearchCore\Tests\Functional\Connection\Elasticsearch;
/*

View file

@ -1,4 +1,5 @@
<?php
namespace Codappix\SearchCore\Tests\Functional\Connection\Elasticsearch;
/*
@ -27,6 +28,9 @@ use TYPO3\CMS\Extbase\Object\ObjectManager;
class FacetTest extends AbstractFunctionalTestCase
{
/**
* @return array
*/
protected function getTypoScriptFilesForFrontendRootPage()
{
return array_merge(
@ -35,6 +39,9 @@ class FacetTest extends AbstractFunctionalTestCase
);
}
/**
* @return array
*/
protected function getDataSets()
{
return array_merge(
@ -51,8 +58,7 @@ class FacetTest extends AbstractFunctionalTestCase
\TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(ObjectManager::class)
->get(IndexerFactory::class)
->getIndexer('tt_content')
->indexAllDocuments()
;
->indexAllDocuments();
$searchService = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(ObjectManager::class)
->get(SearchService::class);

View file

@ -1,4 +1,5 @@
<?php
namespace Codappix\SearchCore\Tests\Functional\Connection\Elasticsearch;
/*
@ -43,8 +44,7 @@ class FilterTest extends AbstractFunctionalTestCase
\TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(ObjectManager::class)
->get(IndexerFactory::class)
->getIndexer('tt_content')
->indexAllDocuments()
;
->indexAllDocuments();
$searchService = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(ObjectManager::class)
->get(SearchService::class);
@ -55,7 +55,7 @@ class FilterTest extends AbstractFunctionalTestCase
$searchRequest->setFilter(['CType' => 'HTML']);
$result = $searchService->search($searchRequest);
$this->assertSame(5, (int) $result->getResults()[0]['uid'], 'Did not get the expected result entry.');
$this->assertSame(5, (int)$result->getResults()[0]['uid'], 'Did not get the expected result entry.');
$this->assertSame(1, count($result), 'Did not receive the single filtered element.');
}
}

View file

@ -1,4 +1,5 @@
<?php
namespace Codappix\SearchCore\Tests\Functional\Connection\Elasticsearch;
/*
@ -39,8 +40,7 @@ class IndexDeletionTest extends AbstractFunctionalTestCase
\TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(ObjectManager::class)
->get(IndexerFactory::class)
->getIndexer('tt_content')
->delete()
;
->delete();
$this->assertFalse(
$this->client->getIndex('typo3content')->exists(),

View file

@ -1,4 +1,5 @@
<?php
namespace Codappix\SearchCore\Tests\Functional\Connection\Elasticsearch;
/*
@ -28,6 +29,9 @@ use TYPO3\CMS\Extbase\Object\ObjectManager;
*/
class IndexTcaTableTest extends AbstractFunctionalTestCase
{
/**
* @return array
*/
protected function getDataSets()
{
return array_merge(
@ -44,8 +48,7 @@ class IndexTcaTableTest extends AbstractFunctionalTestCase
\TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(ObjectManager::class)
->get(IndexerFactory::class)
->getIndexer('tt_content')
->indexAllDocuments()
;
->indexAllDocuments();
$response = $this->client->request('typo3content/_search?q=*:*');
@ -53,7 +56,7 @@ class IndexTcaTableTest extends AbstractFunctionalTestCase
$this->assertSame($response->getData()['hits']['total'], 3, 'Not exactly 3 documents were indexed.');
$this->assertSame(
'indexed content element',
$response->getData()['hits']['hits'][2]['_source']['header'],
$response->getData()['hits']['hits'][0]['_source']['header'],
'Record was not indexed.'
);
}
@ -66,8 +69,7 @@ class IndexTcaTableTest extends AbstractFunctionalTestCase
\TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(ObjectManager::class)
->get(IndexerFactory::class)
->getIndexer('tt_content')
->indexDocument(6)
;
->indexDocument(6);
$response = $this->client->request('typo3content/_search?q=*:*');
@ -89,8 +91,7 @@ class IndexTcaTableTest extends AbstractFunctionalTestCase
{
\TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(ObjectManager::class)
->get(IndexerFactory::class)
->getIndexer('non_existing_table')
;
->getIndexer('non_existing_table');
}
/**
@ -101,8 +102,7 @@ class IndexTcaTableTest extends AbstractFunctionalTestCase
{
$indexer = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(ObjectManager::class)
->get(IndexerFactory::class)
->getIndexer('tt_content')
;
->getIndexer('tt_content');
$indexer->indexAllDocuments();
@ -129,8 +129,7 @@ class IndexTcaTableTest extends AbstractFunctionalTestCase
\TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(ObjectManager::class)
->get(IndexerFactory::class)
->getIndexer('tt_content')
->indexAllDocuments()
;
->indexAllDocuments();
$response = $this->client->request('typo3content/_search?q=*:*');
@ -162,8 +161,7 @@ class IndexTcaTableTest extends AbstractFunctionalTestCase
\TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(ObjectManager::class)
->get(IndexerFactory::class)
->getIndexer('tt_content')
->indexAllDocuments()
;
->indexAllDocuments();
$response = $this->client->request('typo3content/_search?q=*:*');
$this->assertTrue($response->isOk(), 'Elastica did not answer with ok code.');
@ -171,11 +169,13 @@ class IndexTcaTableTest extends AbstractFunctionalTestCase
$response = $this->client->request('typo3content/_search?q=uid:11');
$this->assertArraySubset(
['_source' => [
'uid' => '11',
'CType' => 'Header', // Testing items
'categories' => ['Category 2', 'Category 1'], // Testing mm
]],
[
'_source' => [
'uid' => '11',
'CType' => 'Header', // Testing items
'categories' => ['Category 2', 'Category 1'], // Testing mm
]
],
$response->getData()['hits']['hits'][0],
false,
'Record was not indexed with resolved category relations to multiple values.'
@ -183,11 +183,13 @@ class IndexTcaTableTest extends AbstractFunctionalTestCase
$response = $this->client->request('typo3content/_search?q=uid:12');
$this->assertArraySubset(
['_source' => [
'uid' => '12',
'CType' => 'Header',
'categories' => ['Category 2'],
]],
[
'_source' => [
'uid' => '12',
'CType' => 'Header',
'categories' => ['Category 2'],
]
],
$response->getData()['hits']['hits'][0],
false,
'Record was not indexed with resolved category relations to a single value.'
@ -195,10 +197,12 @@ class IndexTcaTableTest extends AbstractFunctionalTestCase
$response = $this->client->request('typo3content/_search?q=uid:6');
$this->assertArraySubset(
['_source' => [
'uid' => '6',
'categories' => null,
]],
[
'_source' => [
'uid' => '6',
'categories' => null,
]
],
$response->getData()['hits']['hits'][0],
false,
'Record was indexed with resolved category relation, but should not have any.'
@ -213,8 +217,7 @@ class IndexTcaTableTest extends AbstractFunctionalTestCase
\TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(ObjectManager::class)
->get(IndexerFactory::class)
->getIndexer('tt_content')
->indexAllDocuments()
;
->indexAllDocuments();
$response = $this->client->request('typo3content/_search?q=*:*');
$this->assertSame($response->getData()['hits']['total'], 3, 'Not exactly 3 documents were indexed.');
@ -234,8 +237,7 @@ class IndexTcaTableTest extends AbstractFunctionalTestCase
\TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(ObjectManager::class)
->get(IndexerFactory::class)
->getIndexer('tt_content')
->indexDocument(10)
;
->indexDocument(10);
$response = $this->client->request('typo3content/_search?q=*:*');
$this->assertSame($response->getData()['hits']['total'], 2, 'Not exactly 2 document is in index.');

View file

@ -1,4 +1,5 @@
<?php
namespace Codappix\SearchCore\Tests\Functional\DataProcessing;
/*
@ -20,8 +21,8 @@ namespace Codappix\SearchCore\Tests\Functional\DataProcessing;
* 02110-1301, USA.
*/
use Codappix\SearchCore\Compatibility\TypoScriptService76;
use Codappix\SearchCore\Compatibility\TypoScriptService;
use Codappix\SearchCore\Compatibility\TypoScriptService76;
use Codappix\SearchCore\DataProcessing\ContentObjectDataProcessorAdapterProcessor;
use Codappix\SearchCore\Tests\Functional\AbstractFunctionalTestCase;
use TYPO3\CMS\Frontend\DataProcessing\SplitProcessor;

View file

@ -1,4 +1,5 @@
<?php
namespace Codappix\SearchCore\Tests\Functional\DataProcessing;
/*

View file

@ -45,12 +45,6 @@ plugin {
}
}
}
searching {
fields {
query = _all
}
}
}
}
}

View file

@ -1,17 +1,17 @@
<phpunit
backupGlobals="true"
backupStaticAttributes="false"
bootstrap="Bootstrap.php"
colors="true"
convertErrorsToExceptions="false"
convertWarningsToExceptions="false"
forceCoversAnnotation="false"
processIsolation="true"
stopOnError="false"
stopOnFailure="false"
stopOnIncomplete="false"
stopOnSkipped="false"
verbose="false">
backupGlobals="true"
backupStaticAttributes="false"
bootstrap="Bootstrap.php"
colors="true"
convertErrorsToExceptions="false"
convertWarningsToExceptions="false"
forceCoversAnnotation="false"
processIsolation="true"
stopOnError="false"
stopOnFailure="false"
stopOnIncomplete="false"
stopOnSkipped="false"
verbose="false">
<testsuites>
<testsuite name="functional-tests">

View file

@ -1,4 +1,5 @@
<?php
namespace Codappix\SearchCore\Tests\Functional\Hooks\DataHandler;
/*
@ -25,7 +26,6 @@ use Codappix\SearchCore\Domain\Index\IndexerFactory;
use Codappix\SearchCore\Domain\Service\DataHandler as DataHandlerService;
use Codappix\SearchCore\Hook\DataHandler as DataHandlerHook;
use Codappix\SearchCore\Tests\Functional\AbstractFunctionalTestCase;
use TYPO3\CMS\Core\DataHandling\DataHandler as Typo3DataHandler;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Object\ObjectManager;
@ -36,6 +36,9 @@ abstract class AbstractDataHandlerTest extends AbstractFunctionalTestCase
*/
protected $subject;
/**
* @throws \Doctrine\DBAL\DBALException
*/
public function setUp()
{
parent::setUp();

View file

@ -1,4 +1,5 @@
<?php
namespace Codappix\SearchCore\Tests\Functional\Hooks\DataHandler;
/*
@ -20,12 +21,9 @@ namespace Codappix\SearchCore\Tests\Functional\Hooks\DataHandler;
* 02110-1301, USA.
*/
use Codappix\SearchCore\Configuration\ConfigurationContainerInterface;
use Codappix\SearchCore\Domain\Service\DataHandler as DataHandlerService;
use Codappix\SearchCore\Hook\DataHandler as DataHandlerHook;
use TYPO3\CMS\Core\DataHandling\DataHandler as Typo3DataHandler;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Object\ObjectManager;
class NonAllowedTablesTest extends AbstractDataHandlerTest
{

View file

@ -1,4 +1,5 @@
<?php
namespace Codappix\SearchCore\Tests\Functional\Hooks\DataHandler;
/*

View file

@ -1,4 +1,5 @@
<?php
namespace Codappix\SearchCore\Tests\Functional\Hooks\DataHandler;
/*
@ -20,12 +21,9 @@ namespace Codappix\SearchCore\Tests\Functional\Hooks\DataHandler;
* 02110-1301, USA.
*/
use Codappix\SearchCore\Configuration\ConfigurationContainerInterface;
use Codappix\SearchCore\Domain\Service\DataHandler as DataHandlerService;
use Codappix\SearchCore\Hook\DataHandler as DataHandlerHook;
use TYPO3\CMS\Core\DataHandling\DataHandler as Typo3DataHandler;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Object\ObjectManager;
class ProcessesAllowedTablesTest extends AbstractDataHandlerTest
{
@ -85,14 +83,12 @@ class ProcessesAllowedTablesTest extends AbstractDataHandlerTest
if ($this->isLegacyVersion()) {
return isset($record['uid']) && $record['uid'] === '1'
&& isset($record['pid']) && $record['pid'] === '1'
&& isset($record['colPos']) && $record['colPos'] === '1'
;
&& isset($record['colPos']) && $record['colPos'] === '1';
}
return isset($record['uid']) && $record['uid'] === 1
&& isset($record['pid']) && $record['pid'] === 1
&& isset($record['colPos']) && $record['colPos'] === 1
;
&& isset($record['colPos']) && $record['colPos'] === 1;
})
],
[
@ -132,14 +128,12 @@ class ProcessesAllowedTablesTest extends AbstractDataHandlerTest
if ($this->isLegacyVersion()) {
return isset($record['uid']) && $record['uid'] === '2'
&& isset($record['pid']) && $record['pid'] === '1'
&& isset($record['header']) && $record['header'] === 'a new record'
;
&& isset($record['header']) && $record['header'] === 'a new record';
}
return isset($record['uid']) && $record['uid'] === 2
&& isset($record['pid']) && $record['pid'] === 1
&& isset($record['header']) && $record['header'] === 'a new record'
;
&& isset($record['header']) && $record['header'] === 'a new record';
})
],
[

View file

@ -1,4 +1,5 @@
<?php
namespace Codappix\SearchCore\Tests\Functional\Hooks\DataHandler;
/*

View file

@ -1,4 +1,5 @@
<?php
namespace Codappix\SearchCore\Tests\Indexing;
/*
@ -20,7 +21,6 @@ namespace Codappix\SearchCore\Tests\Indexing;
* 02110-1301, USA.
*/
use Codappix\SearchCore\Configuration\ConfigurationContainerInterface;
use Codappix\SearchCore\Connection\Elasticsearch;
use Codappix\SearchCore\Domain\Index\IndexerFactory;
use Codappix\SearchCore\Tests\Functional\AbstractFunctionalTestCase;
@ -54,8 +54,7 @@ class PagesIndexerTest extends AbstractFunctionalTestCase
' this is the content of header content element that should get indexed' .
' Indexed without html tags Some text in paragraph'
&& isset($documents[0]['search_abstract']) && $documents[0]['search_abstract'] ===
'Used as abstract as no abstract is defined.'
;
'Used as abstract as no abstract is defined.';
})
);

View file

@ -1,4 +1,5 @@
<?php
namespace Codappix\SearchCore\Tests\Indexing;
/*
@ -66,7 +67,7 @@ class TcaIndexerTest extends AbstractFunctionalTestCase
foreach ($documents as $document) {
// Page uids 1 and 2 are allowed while 3 and 4 are not allowed.
// Therefore only documents with page uid 1 and 2 should exist.
if (! isset($document['pid']) || ! in_array($document['pid'], [1, 2])) {
if (!isset($document['pid']) || !in_array($document['pid'], [1, 2])) {
return false;
}
}

View file

@ -1,4 +1,5 @@
<?php
namespace Codappix\SearchCore\Tests\Unit;
/*
@ -91,12 +92,12 @@ abstract class AbstractUnitTestCase extends CoreTestCase
GeneralUtility::setSingletonInstance(ObjectManager::class, $objectManager);
}
protected function isLegacyVersion() : bool
protected function isLegacyVersion(): bool
{
return \TYPO3\CMS\Core\Utility\VersionNumberUtility::convertVersionNumberToInteger(TYPO3_version) < 8000000;
}
protected function getCacheConfiguration() : array
protected function getCacheConfiguration(): array
{
$cacheConfiguration = [
'extbase_object' => [

View file

@ -1,4 +1,5 @@
<?php
namespace Codappix\SearchCore\Tests\Unit\Command;
/*
@ -25,8 +26,6 @@ use Codappix\SearchCore\Domain\Index\IndexerFactory;
use Codappix\SearchCore\Domain\Index\NoMatchingIndexerException;
use Codappix\SearchCore\Domain\Index\TcaIndexer;
use Codappix\SearchCore\Tests\Unit\AbstractUnitTestCase;
use TYPO3\CMS\Extbase\Mvc\Controller\CommandController;
use TYPO3\CMS\Extbase\Mvc\Exception\StopActionException;
class IndexCommandControllerTest extends AbstractUnitTestCase
{

View file

@ -1,4 +1,5 @@
<?php
namespace Codappix\SearchCore\Tests\Unit\Configuration;
/*
@ -48,7 +49,7 @@ class ConfigurationUtilityTest extends AbstractUnitTestCase
);
}
public function possibleRequestAndConfigurationForFluidtemplate() : array
public function possibleRequestAndConfigurationForFluidtemplate(): array
{
return [
'Nothing in array' => [
@ -109,7 +110,7 @@ class ConfigurationUtilityTest extends AbstractUnitTestCase
);
}
public function possibleConditionEntries() : array
public function possibleConditionEntries(): array
{
return [
'Nothing in array' => [

View file

@ -1,4 +1,5 @@
<?php
namespace Codappix\SearchCore\Tests\Unit\Connection\Elasticsearch;
/*

View file

@ -1,4 +1,5 @@
<?php
namespace Codappix\SearchCore\Tests\Unit\Connection\Elasticsearch;
/*

View file

@ -1,4 +1,5 @@
<?php
namespace Codappix\SearchCore\Tests\Unit\Connection\Elasticsearch;
/*

View file

@ -1,4 +1,5 @@
<?php
namespace Codappix\Tests\Unit\Controller;
/*

View file

@ -1,4 +1,5 @@
<?php
namespace Codappix\SearchCore\Tests\Unit\DataProcessing;
/*

View file

@ -1,4 +1,5 @@
<?php
namespace Codappix\SearchCore\Tests\Unit\DataProcessing;
/*

View file

@ -1,4 +1,5 @@
<?php
namespace Codappix\SearchCore\Tests\Unit\DataProcessing;
/*

View file

@ -1,4 +1,5 @@
<?php
namespace Codappix\SearchCore\Tests\Unit\DataProcessing;
/*
@ -23,8 +24,8 @@ namespace Codappix\SearchCore\Tests\Unit\DataProcessing;
use Codappix\SearchCore\Configuration\ConfigurationContainerInterface;
use Codappix\SearchCore\DataProcessing\TcaRelationResolvingProcessor;
use Codappix\SearchCore\Tests\Unit\AbstractUnitTestCase;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Object\ObjectManager;
use \TYPO3\CMS\Core\Utility\GeneralUtility;
class TcaRelationResolvingProcessorTest extends AbstractUnitTestCase
{

View file

@ -1,4 +1,5 @@
<?php
namespace Codappix\SearchCore\Tests\Unit\Domain\Index;
/*
@ -123,8 +124,7 @@ class AbstractIndexerTest extends AbstractUnitTestCase
$this->subject->expects($this->once())
->method('getRecord')
->with(1)
->willReturn($record)
;
->willReturn($record);
$this->connection->expects($this->once())->method('addDocument')->with('testTable', $expectedRecord);
$this->subject->indexDocument(1);
@ -147,8 +147,7 @@ class AbstractIndexerTest extends AbstractUnitTestCase
$this->subject->expects($this->once())
->method('getRecord')
->with(1)
->willReturn($record)
;
->willReturn($record);
$this->connection->expects($this->once())->method('addDocument')->with('testTable', $expectedRecord);
$this->subject->indexDocument(1);

View file

@ -1,4 +1,5 @@
<?php
namespace Codappix\SearchCore\Tests\Unit\Domain\Index\TcaIndexer;
/*
@ -21,10 +22,9 @@ namespace Codappix\SearchCore\Tests\Unit\Domain\Index\TcaIndexer;
*/
use Codappix\SearchCore\Configuration\ConfigurationContainerInterface;
use Codappix\SearchCore\DataProcessing\CopyToProcessor;
use Codappix\SearchCore\Domain\Index\TcaIndexer\RelationResolver;
use Codappix\SearchCore\Domain\Index\TcaIndexer\TcaTableService76;
use Codappix\SearchCore\Domain\Index\TcaIndexer\TcaTableService;
use Codappix\SearchCore\Domain\Index\TcaIndexer\TcaTableService76;
use Codappix\SearchCore\Tests\Unit\AbstractUnitTestCase;
use TYPO3\CMS\Core\Database\DatabaseConnection;

View file

@ -1,4 +1,5 @@
<?php
namespace Codappix\SearchCore\Tests\Unit\Domain\Model;
/*

View file

@ -1,4 +1,5 @@
<?php
namespace Codappix\SearchCore\Tests\Unit\Domain\Model;
/*

View file

@ -1,4 +1,5 @@
<?php
namespace Codappix\SearchCore\Tests\Unit\Domain\Model;
/*

View file

@ -1,4 +1,5 @@
<?php
namespace Codappix\SearchCore\Tests\Unit\Domain\Search;
/*
@ -232,9 +233,6 @@ class QueryFactoryTest extends AbstractUnitTestCase
'multi_match' => [
'type' => 'most_fields',
'query' => 'SearchWord',
'fields' => [
'_all',
],
],
],
],
@ -272,9 +270,6 @@ class QueryFactoryTest extends AbstractUnitTestCase
'multi_match' => [
'type' => 'most_fields',
'query' => 'SearchWord',
'fields' => [
'_all',
],
'minimum_should_match' => '50%',
],
],
@ -378,9 +373,6 @@ class QueryFactoryTest extends AbstractUnitTestCase
'multi_match' => [
'type' => 'most_fields',
'query' => 'SearchWord',
'fields' => [
'_all',
],
],
],
],
@ -670,7 +662,7 @@ class QueryFactoryTest extends AbstractUnitTestCase
->method('get')
->will($this->returnCallback(function ($configName) {
if ($configName === 'searching.fields.query') {
return '_all';
return '';
}
throw new InvalidArgumentException();

View file

@ -1,4 +1,5 @@
<?php
namespace Codappix\SearchCore\Tests\Unit\Domain\Search;
/*
@ -211,9 +212,9 @@ class SearchServiceTest extends AbstractUnitTestCase
->method('search')
->with($this->callback(function ($searchRequest) {
return $searchRequest->getFilter() === [
'anotherProperty' => 'anything',
'property' => 'something',
];
'anotherProperty' => 'anything',
'property' => 'something',
];
}))
->willReturn($this->getMockBuilder(SearchResultInterface::class)->getMock());

View file

@ -1,4 +1,5 @@
<?php
namespace Codappix\SearchCore\Tests\Unit\Hook;
/*
@ -66,7 +67,7 @@ class DataHandlerToProcessorTest extends AbstractUnitTestCase
$subject->clearCachePostProc($parameters, $coreDataHandlerMock);
}
public function getPossibleCallCombinations() : array
public function getPossibleCallCombinations(): array
{
return [
'Editor triggered cache clear of page manual' => [
@ -77,7 +78,7 @@ class DataHandlerToProcessorTest extends AbstractUnitTestCase
],
'Editor changed records on a page' => [
'parameters' => [
'uid_page' =>10,
'uid_page' => 10,
],
'expectCall' => true,
],
@ -112,6 +113,7 @@ class DataHandlerToProcessorTest extends AbstractUnitTestCase
'cacheCmd' => 'NEW343',
], $coreDataHandlerMock);
}
/**
* @test
*/

View file

@ -1,4 +1,5 @@
<?php
namespace Codappix\SearchCore\Tests\Unit\Integration\Form\Finisher;
/*
@ -84,7 +85,7 @@ class DataHandlerFinisherTest extends AbstractUnitTestCase
$this->subject->execute($this->finisherContextMock);
}
public function possibleFinisherSetup() : array
public function possibleFinisherSetup(): array
{
return [
'valid update configuration' => [
@ -118,7 +119,7 @@ class DataHandlerFinisherTest extends AbstractUnitTestCase
$this->subject->execute($this->finisherContextMock);
}
public function invalidFinisherSetup() : array
public function invalidFinisherSetup(): array
{
return [
'missing options' => [

View file

@ -1,18 +1,18 @@
<phpunit
backupGlobals="false"
backupStaticAttributes="false"
bootstrap="Bootstrap.php"
backupGlobals="false"
backupStaticAttributes="false"
bootstrap="Bootstrap.php"
colors="true"
convertErrorsToExceptions="false"
convertWarningsToExceptions="false"
forceCoversAnnotation="false"
processIsolation="false"
stopOnError="false"
stopOnFailure="false"
stopOnIncomplete="false"
stopOnSkipped="false"
verbose="false">
colors="true"
convertErrorsToExceptions="false"
convertWarningsToExceptions="false"
forceCoversAnnotation="false"
processIsolation="false"
stopOnError="false"
stopOnFailure="false"
stopOnIncomplete="false"
stopOnSkipped="false"
verbose="false">
<testsuites>
<testsuite name="unit-tests">