From a87610716b35966cac46a03fb41bc82165d7f643 Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Tue, 13 Dec 2016 17:51:30 +0100 Subject: [PATCH] FEATURE: Improve tests * As they fail on travis and have a dependency to result order. * Resolve the dependency and query each document itself. --- Tests/Functional/Indexing/IndexTcaTableTest.php | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/Tests/Functional/Indexing/IndexTcaTableTest.php b/Tests/Functional/Indexing/IndexTcaTableTest.php index 6d0999b..64fb55a 100644 --- a/Tests/Functional/Indexing/IndexTcaTableTest.php +++ b/Tests/Functional/Indexing/IndexTcaTableTest.php @@ -109,7 +109,7 @@ class IndexTcaTableTest extends AbstractFunctionalTestCase $response = $this->client->request('typo3content/_search?q=*:*'); $this->assertTrue($response->isOK()); - $this->assertSame($response->getData()['hits']['total'], 2, 'Not exactly 2 document was indexed.'); + $this->assertSame($response->getData()['hits']['total'], 2, 'Not exactly 2 documents were indexed.'); $this->assertArraySubset( ['_source' => ['header' => 'Also indexable record']], $response->getData()['hits']['hits'][0], @@ -138,7 +138,10 @@ class IndexTcaTableTest extends AbstractFunctionalTestCase ; $response = $this->client->request('typo3content/_search?q=*:*'); + $this->assertTrue($response->isOK()); + $this->assertSame($response->getData()['hits']['total'], 3, 'Not exactly 3 documents were indexed.'); + $response = $this->client->request('typo3content/_search?q=uid:9'); $this->assertArraySubset( ['_source' => [ 'uid' => '9', @@ -147,24 +150,28 @@ class IndexTcaTableTest extends AbstractFunctionalTestCase ]], $response->getData()['hits']['hits'][0], false, - 'Record was not indexed with resolved category relation to a single value.' + 'Record was not indexed with resolved category relations to multiple values.' ); + + $response = $this->client->request('typo3content/_search?q=uid:10'); $this->assertArraySubset( ['_source' => [ 'uid' => '10', 'CType' => 'textmedia', 'categories' => ['Category 2'], ]], - $response->getData()['hits']['hits'][1], + $response->getData()['hits']['hits'][0], false, - 'Record was not indexed with resolved category relation to multiple values.' + 'Record was not indexed with resolved category relations to a single value.' ); + + $response = $this->client->request('typo3content/_search?q=uid:6'); $this->assertArraySubset( ['_source' => [ 'uid' => '6', 'categories' => null, ]], - $response->getData()['hits']['hits'][2], + $response->getData()['hits']['hits'][0], false, 'Record was indexed with resolved category relation, but should not have any.' );