Skip to content

Commit

Permalink
updated CompletionTest, payload and output are removed from completio…
Browse files Browse the repository at this point in the history
…n suggester (#1184) (#1213)
  • Loading branch information
p365labs authored and ruflin committed Nov 10, 2016
1 parent 8fa05bb commit a204fe6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 24 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ All notable changes to this project will be documented in this file based on the
## [Unreleased](https://github.com/ruflin/Elastica/compare/5.0.0-beta1...master)

### Backward Compatibility Fixes
- Updated Elastica\Test\Suggest\CompletionTest now payload and output are removed

### Bugfixes

Expand Down Expand Up @@ -89,7 +90,7 @@ $indices[$indexName]
- Elastica\Test\TypeTest::testUpdateDocumentWithIdForwardSlashes
- Elastica\Test\TypeTest::testUpdateDocumentWithParameter
- Elastica\Test\TypeTest::testUpdateDocumentWithFieldsSource
- Composer installations will no longer include tests and other development files.
- Composer installations will no longer include tests and other development files.


## [3.2.3](https://github.com/ruflin/Elastica/compare/3.2.2...3.2.3)
Expand Down
34 changes: 11 additions & 23 deletions test/lib/Elastica/Test/Suggest/CompletionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,40 +17,29 @@ protected function _getIndexForTest()
$index = $this->_createIndex();
$type = $index->getType('song');

$this->_markSkipped50('Mapping definition for [fieldName] has unsupported parameters: [payloads : true]');
$type->setMapping([
'fieldName' => [
'type' => 'completion',
'payloads' => true,
],
]);

$type->addDocuments([
new Document(1, [
'fieldName' => [
'input' => ['Nevermind', 'Nirvana'],
'output' => 'Nevermind - Nirvana',
'payload' => [
'year' => 1991,
],
'fieldName' => [
'input' => ['Nevermind', 'Nirvana'],
'weight' => 5
],
]),
new Document(2, [
'fieldName' => [
'input' => ['Bleach', 'Nirvana'],
'output' => 'Bleach - Nirvana',
'payload' => [
'year' => 1989,
],
'fieldName' => [
'input' => ['Bleach', 'Nirvana'],
'weight' => 2
],
]),
new Document(3, [
'fieldName' => [
'input' => ['Incesticide', 'Nirvana'],
'output' => 'Incesticide - Nirvana',
'payload' => [
'year' => 1992,
],
'fieldName' => [
'input' => ['Incesticide', 'Nirvana'],
'weight' => 7
],
]),
]);
Expand Down Expand Up @@ -95,8 +84,7 @@ public function testSuggestWorks()
$options = $suggests['suggestName'][0]['options'];

$this->assertCount(1, $options);
$this->assertEquals('Nevermind - Nirvana', $options[0]['text']);
$this->assertEquals(1991, $options[0]['payload']['year']);
$this->assertEquals('Nevermind', $options[0]['text']);
}

/**
Expand All @@ -117,7 +105,7 @@ public function testFuzzySuggestWorks()
$options = $suggests['suggestName'][0]['options'];

$this->assertCount(1, $options);
$this->assertEquals('Nevermind - Nirvana', $options[0]['text']);
$this->assertEquals('Nevermind', $options[0]['text']);
}

/**
Expand Down

0 comments on commit a204fe6

Please sign in to comment.