mirror of
https://github.com/Codappix/search_core.git
synced 2024-11-22 10:56:12 +01:00
FEATURE: Add two more tests for indexing
This commit is contained in:
parent
8500b8fd57
commit
31c4108039
1 changed files with 33 additions and 2 deletions
|
@ -53,7 +53,38 @@ class IndexTcaTableTest extends FunctionalTestCase
|
||||||
$this->assertSame($response->getData()['hits']['total'], 1, 'Not exactly 1 document was indexed.');
|
$this->assertSame($response->getData()['hits']['total'], 1, 'Not exactly 1 document was indexed.');
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Add tests for hook.
|
/**
|
||||||
|
* @test
|
||||||
|
* @expectedException \Leonmrni\SearchCore\Domain\Index\IndexingException
|
||||||
|
*/
|
||||||
|
public function indexingNonConfiguredTableWillThrowException()
|
||||||
|
{
|
||||||
|
\TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(ObjectManager::class)
|
||||||
|
->get(IndexerFactory::class)
|
||||||
|
->getIndexer('non_existing_table')
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: Add tests for search in frontend.
|
/**
|
||||||
|
* @test
|
||||||
|
*/
|
||||||
|
public function canHandleExisingIndex()
|
||||||
|
{
|
||||||
|
$indexer = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(ObjectManager::class)
|
||||||
|
->get(IndexerFactory::class)
|
||||||
|
->getIndexer('tt_content')
|
||||||
|
;
|
||||||
|
|
||||||
|
$indexer->index();
|
||||||
|
|
||||||
|
// Index 2nd time, index already exists in elasticsearch.
|
||||||
|
$indexer->index();
|
||||||
|
|
||||||
|
$response = $this->client->request('typo3content/_search?q=*:*');
|
||||||
|
|
||||||
|
$this->assertTrue($response->isOK());
|
||||||
|
$this->assertSame($response->getData()['hits']['total'], 1, 'Not exactly 1 document was indexed.');
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: Add tests for hook.
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue