Skip to content

Commit

Permalink
Merge e596dc1 into fa0b8e1
Browse files Browse the repository at this point in the history
  • Loading branch information
deguif committed Oct 29, 2020
2 parents fa0b8e1 + e596dc1 commit 22731c2
Show file tree
Hide file tree
Showing 9 changed files with 40 additions and 40 deletions.
12 changes: 6 additions & 6 deletions tests/Aggregation/TermsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public function testIncludePattern(): void
$agg = new Terms('terms');
$agg->setInclude('pattern*');

$this->assertSame($agg->getParam('include'), 'pattern*');
$this->assertSame('pattern*', $agg->getParam('include'));
}

/**
Expand All @@ -34,7 +34,7 @@ public function testIncludeExactMatch(): void
$agg = new Terms('terms');
$agg->setIncludeAsExactMatch(['first', 'second']);

$this->assertSame($agg->getParam('include'), ['first', 'second']);
$this->assertSame(['first', 'second'], $agg->getParam('include'));
}

/**
Expand All @@ -45,10 +45,10 @@ public function testIncludeWithPartitions(): void
$agg = new Terms('terms');
$agg->setIncludeWithPartitions(1, 23);

$this->assertSame($agg->getParam('include'), [
$this->assertSame([
'partition' => 1,
'num_partitions' => 23,
]);
], $agg->getParam('include'));
}

/**
Expand All @@ -59,7 +59,7 @@ public function testExcludePattern(): void
$agg = new Terms('terms');
$agg->setExclude('pattern*');

$this->assertSame($agg->getParam('exclude'), 'pattern*');
$this->assertSame('pattern*', $agg->getParam('exclude'));
}

/**
Expand All @@ -70,7 +70,7 @@ public function testExcludeExactMatch(): void
$agg = new Terms('terms');
$agg->setExcludeAsExactMatch(['first', 'second']);

$this->assertSame($agg->getParam('exclude'), ['first', 'second']);
$this->assertSame(['first', 'second'], $agg->getParam('exclude'));
}

public function testTermsAggregation(): void
Expand Down
20 changes: 10 additions & 10 deletions tests/IndexTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ public function testMapping(): void

$storedMapping = $index->getMapping();

$this->assertEquals($storedMapping['properties']['id']['type'], 'integer');
$this->assertEquals($storedMapping['properties']['id']['store'], true);
$this->assertEquals($storedMapping['properties']['email']['type'], 'text');
$this->assertEquals($storedMapping['properties']['username']['type'], 'text');
$this->assertEquals($storedMapping['properties']['test']['type'], 'integer');
$this->assertEquals('integer', $storedMapping['properties']['id']['type']);
$this->assertEquals(true, $storedMapping['properties']['id']['store']);
$this->assertEquals('text', $storedMapping['properties']['email']['type']);
$this->assertEquals('text', $storedMapping['properties']['username']['type']);
$this->assertEquals('integer', $storedMapping['properties']['test']['type']);
}

public function testGetMappingAlias(): void
Expand Down Expand Up @@ -503,11 +503,11 @@ public function testIndexGetMapping(): void
$index->refresh();
$indexMappings = $index->getMapping();

$this->assertEquals($indexMappings['properties']['id']['type'], 'integer');
$this->assertEquals($indexMappings['properties']['id']['store'], true);
$this->assertEquals($indexMappings['properties']['email']['type'], 'text');
$this->assertEquals($indexMappings['properties']['username']['type'], 'text');
$this->assertEquals($indexMappings['properties']['test']['type'], 'integer');
$this->assertEquals('integer', $indexMappings['properties']['id']['type']);
$this->assertEquals(true, $indexMappings['properties']['id']['store']);
$this->assertEquals('text', $indexMappings['properties']['email']['type']);
$this->assertEquals('text', $indexMappings['properties']['username']['type']);
$this->assertEquals('integer', $indexMappings['properties']['test']['type']);
}

public function testEmptyIndexGetMapping(): void
Expand Down
2 changes: 1 addition & 1 deletion tests/MappingTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public function testNestedMapping(): void

$index->refresh();
$resultSet = $index->search('ruflin');
$this->assertEquals($resultSet->count(), 1);
$this->assertEquals(1, $resultSet->count());

$index->delete();
}
Expand Down
8 changes: 4 additions & 4 deletions tests/PipelineTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,10 @@ public function testPipelineCreate(): void
$pipeGet = $pipeline->getPipeline('my_custom_pipeline');
$result = $pipeGet->getData();

$this->assertSame($result['my_custom_pipeline']['description'], 'pipeline for Set');
$this->assertSame($result['my_custom_pipeline']['processors'][0]['set']['field'], 'field4');
$this->assertSame($result['my_custom_pipeline']['processors'][0]['set']['value'], '333');
$this->assertSame($result['my_custom_pipeline']['processors'][0]['trim']['field'], 'field1');
$this->assertSame('pipeline for Set', $result['my_custom_pipeline']['description']);
$this->assertSame('field4', $result['my_custom_pipeline']['processors'][0]['set']['field']);
$this->assertSame('333', $result['my_custom_pipeline']['processors'][0]['set']['value']);
$this->assertSame('field1', $result['my_custom_pipeline']['processors'][0]['trim']['field']);
}

/**
Expand Down
6 changes: 3 additions & 3 deletions tests/Processor/KvTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ public function testKVIncludeExludeKeys(): void
$pipelineGet = $pipeline->getPipeline('my_custom_pipeline');
$result = $pipelineGet->getData();

$this->assertSame($result['my_custom_pipeline']['processors'][0]['kv']['field'], 'field1');
$this->assertSame($result['my_custom_pipeline']['processors'][0]['kv']['field_split'], '&');
$this->assertSame($result['my_custom_pipeline']['processors'][0]['kv']['value_split'], '=');
$this->assertSame('field1', $result['my_custom_pipeline']['processors'][0]['kv']['field']);
$this->assertSame('&', $result['my_custom_pipeline']['processors'][0]['kv']['field_split']);
$this->assertSame('=', $result['my_custom_pipeline']['processors'][0]['kv']['value_split']);
}
}
8 changes: 4 additions & 4 deletions tests/Query/BoostingTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ public function testNegativeBoost(): void
$query->setParam('boost', 42.0);

$queryToCheck = $query->toArray();
$this->assertEquals($queryToCheck['boosting']['boost'], 42.0);
$this->assertEquals($queryToCheck['boosting']['positive']['term']['name']['boost'], 5.0);
$this->assertEquals($queryToCheck['boosting']['negative']['term']['name']['boost'], 8.0);
$this->assertEquals($queryToCheck['boosting']['negative_boost'], 23.0);
$this->assertEquals(42.0, $queryToCheck['boosting']['boost']);
$this->assertEquals(5.0, $queryToCheck['boosting']['positive']['term']['name']['boost']);
$this->assertEquals(8.0, $queryToCheck['boosting']['negative']['term']['name']['boost']);
$this->assertEquals(23.0, $queryToCheck['boosting']['negative_boost']);
}
}
10 changes: 5 additions & 5 deletions tests/Query/InnerHitsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,8 @@ public function testInnerHitsNested(): void

$innerHitsResults = $firstResult->getInnerHits();

$this->assertEquals($firstResult->getId(), 4);
$this->assertEquals($innerHitsResults['users']['hits']['hits'][0]['_source']['name'], 'Newton');
$this->assertEquals(4, $firstResult->getId());
$this->assertEquals('Newton', $innerHitsResults['users']['hits']['hits'][0]['_source']['name']);
}

/**
Expand All @@ -183,7 +183,7 @@ public function testInnerHitsParentChildren(): void
$responsesId[] = $response['_id'];
}

$this->assertEquals($firstResult->getId(), 1);
$this->assertEquals(1, $firstResult->getId());
$this->assertEquals([6, 7], $responsesId);
}

Expand Down Expand Up @@ -224,7 +224,7 @@ public function testInnerHitsWithOffset(): void

$responses = $innerHits['answers']['hits']['hits'];

$this->assertEquals(\count($responses), 1);
$this->assertEquals(1, \count($responses));
$this->assertEquals(7, $responses[0]['_id']);
}

Expand All @@ -249,7 +249,7 @@ public function testInnerHitsWithSort(): void
$responsesId[] = $response['_id'];
}

$this->assertEquals($firstResult->getId(), 1);
$this->assertEquals(1, $firstResult->getId());
$this->assertEquals([7, 6], $responsesId);
}

Expand Down
4 changes: 2 additions & 2 deletions tests/Query/ParentIdTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public function testParentId(): void

$result = $results->current();
$data = $result->getData();
$this->assertEquals($data['text'], 'this is an answer, the 1st');
$this->assertEquals('this is an answer, the 1st', $data['text']);

$parentQuery = new ParentId('answer', '2', true);
$search = new Search($index->getClient());
Expand Down Expand Up @@ -192,7 +192,7 @@ public function testQueryBuilderParentId(): void

$result = $results->current();
$data = $result->getData();
$this->assertEquals($data['text'], 'this is an answer, the 1st');
$this->assertEquals('this is an answer, the 1st', $data['text']);

$parentId = $queryDSL->parent_id('answer', 2, true);
$search = new Search($index->getClient());
Expand Down
10 changes: 5 additions & 5 deletions tests/Script/ScriptFieldsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,20 @@ public function testNewScriptFields(): void
// addScript
$scriptFields = new ScriptFields();
$scriptFields->addScript('test', $script);
$this->assertSame($scriptFields->getParam('test'), $script);
$this->assertSame($script, $scriptFields->getParam('test'));

// setScripts
$scriptFields = new ScriptFields();
$scriptFields->setScripts([
'test' => $script,
]);
$this->assertSame($scriptFields->getParam('test'), $script);
$this->assertSame($script, $scriptFields->getParam('test'));

// Constructor
$scriptFields = new ScriptFields([
'test' => $script,
]);
$this->assertSame($scriptFields->getParam('test'), $script);
$this->assertSame($script, $scriptFields->getParam('test'));
}

/**
Expand All @@ -51,12 +51,12 @@ public function testSetScriptFields(): void
'test' => $script,
]);
$query->setScriptFields($scriptFields);
$this->assertSame($query->getParam('script_fields'), $scriptFields);
$this->assertSame($scriptFields, $query->getParam('script_fields'));

$query->setScriptFields([
'test' => $script,
]);
$this->assertSame($query->getParam('script_fields')->getParam('test'), $script);
$this->assertSame($script, $query->getParam('script_fields')->getParam('test'));
}

/**
Expand Down

0 comments on commit 22731c2

Please sign in to comment.