Skip to content
Snippets Groups Projects
Commit 872aa4a1 authored by LTRocky's avatar LTRocky
Browse files

Merge branch 'completion-test-coverage' of github.com:AndriusBil/ElasticsearchBundle

parents 1fd0f880 2673a4ea
No related branches found
No related tags found
No related merge requests found
...@@ -12,9 +12,19 @@ ...@@ -12,9 +12,19 @@
namespace ONGR\ElasticsearchBundle\Tests\Unit\DSL\Suggester; namespace ONGR\ElasticsearchBundle\Tests\Unit\DSL\Suggester;
use ONGR\ElasticsearchBundle\DSL\Suggester\Completion; use ONGR\ElasticsearchBundle\DSL\Suggester\Completion;
use ONGR\ElasticsearchBundle\Test\EncapsulationTestAwareTrait;
/**
* Test for Completion.
*
* Class CompletionTest
*
* @package ONGR\ElasticsearchBundle\Tests\Unit\DSL\Suggester
*/
class CompletionTest extends \PHPUnit_Framework_TestCase class CompletionTest extends \PHPUnit_Framework_TestCase
{ {
use EncapsulationTestAwareTrait;
/** /**
* @return array * @return array
*/ */
...@@ -90,13 +100,61 @@ class CompletionTest extends \PHPUnit_Framework_TestCase ...@@ -90,13 +100,61 @@ class CompletionTest extends \PHPUnit_Framework_TestCase
* Tests toArray method. * Tests toArray method.
* *
* @param array $expected * @param array $expected
* @param Completion $phrase * @param Completion $completion
* *
* @dataProvider getTestToArrayData * @dataProvider getTestToArrayData
*/ */
public function testToArray($expected, $phrase) public function testToArray($expected, $completion)
{
$this->assertEquals($expected, $completion->toArray());
}
/**
* Tests if toArray method throws Logic Exception.
*
* @expectedException \LogicException
*/
public function testToArrayException()
{ {
$this->assertEquals($expected, $phrase->toArray()); $completion = new Completion('foo', 'bar');
$completion->setField(null);
$completion->setText(null);
$completion->toArray();
}
/**
* Tests useFuzzy property.
*/
public function testUseFuzzy()
{
$completion = new Completion('foo', 'bar');
$completion->useFuzzy(true);
$this->assertEquals(true, $completion->isFuzzy());
}
/**
* @return string
*/
public function getClassName()
{
$this->setStub(new Completion('foo', 'bar'));
$this->addIgnoredField('useFuzzy');
return 'ONGR\ElasticsearchBundle\DSL\Suggester\Completion';
}
/**
* @return array
*/
public function getFieldsData()
{
return [
['fuzziness'],
['transpositions', 'boolean'],
['minLength'],
['prefixLength'],
['unicodeAware'],
];
} }
/** /**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment