FEATURE: Improve tests

* As they fail on travis and have a dependency to result order.
* Resolve the dependency and query each document itself.
This commit is contained in:
Daniel Siepmann 2016-12-13 17:51:30 +01:00
parent 99fbb28b9d
commit a87610716b
Signed by: Daniel Siepmann
GPG key ID: 33D6629915560EF4

View file

@ -109,7 +109,7 @@ class IndexTcaTableTest extends AbstractFunctionalTestCase
$response = $this->client->request('typo3content/_search?q=*:*'); $response = $this->client->request('typo3content/_search?q=*:*');
$this->assertTrue($response->isOK()); $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( $this->assertArraySubset(
['_source' => ['header' => 'Also indexable record']], ['_source' => ['header' => 'Also indexable record']],
$response->getData()['hits']['hits'][0], $response->getData()['hits']['hits'][0],
@ -138,7 +138,10 @@ class IndexTcaTableTest extends AbstractFunctionalTestCase
; ;
$response = $this->client->request('typo3content/_search?q=*:*'); $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( $this->assertArraySubset(
['_source' => [ ['_source' => [
'uid' => '9', 'uid' => '9',
@ -147,24 +150,28 @@ class IndexTcaTableTest extends AbstractFunctionalTestCase
]], ]],
$response->getData()['hits']['hits'][0], $response->getData()['hits']['hits'][0],
false, 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( $this->assertArraySubset(
['_source' => [ ['_source' => [
'uid' => '10', 'uid' => '10',
'CType' => 'textmedia', 'CType' => 'textmedia',
'categories' => ['Category 2'], 'categories' => ['Category 2'],
]], ]],
$response->getData()['hits']['hits'][1], $response->getData()['hits']['hits'][0],
false, 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( $this->assertArraySubset(
['_source' => [ ['_source' => [
'uid' => '6', 'uid' => '6',
'categories' => null, 'categories' => null,
]], ]],
$response->getData()['hits']['hits'][2], $response->getData()['hits']['hits'][0],
false, false,
'Record was indexed with resolved category relation, but should not have any.' 'Record was indexed with resolved category relation, but should not have any.'
); );