Skip to content
Snippets Groups Projects
Commit 87ea2927 authored by Vagrant User's avatar Vagrant User
Browse files

Few tests

parent 77600ec2
No related branches found
No related tags found
No related merge requests found
......@@ -98,4 +98,15 @@ class CompletionTest extends \PHPUnit_Framework_TestCase
{
$this->assertEquals($expected, $phrase->toArray());
}
/**
* Tests toArray method exception.
*
* @expectedException \LogicException
*/
public function testToArrayException()
{
$completion = new Completion('', '');
$completion->toArray();
}
}
<?php
/*
* This file is part of the ONGR package.
*
* (c) NFQ Technologies UAB <info@nfq.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace ONGR\ElasticsearchBundle\Tests\Unit\DSL\Suggester;
use ONGR\ElasticsearchBundle\DSL\Suggester\Completion;
use ONGR\ElasticsearchBundle\DSL\Suggester\Context;
use ONGR\ElasticsearchBundle\DSL\Suggester\Phrase;
class ContextTest extends \PHPUnit_Framework_TestCase
{
/**
* Tests toArray method when $this->getSize() !== null.
*/
public function testToArrayNotNull()
{
$name = 'testName';
$context = new Context('', '', $name);
$context->setSize(123);
$context->setContext(new Phrase('', '', 'test'));
$result = $context->toArray();
$this->assertArrayHasKey($name, $result);
$data = $result[$name];
$this->assertArrayHasKey('completion', $data);
$completion = $data['completion'];
$this->assertArrayHasKey('size', $completion);
$this->assertEquals($completion['size'], 123);
}
}
......@@ -85,4 +85,15 @@ class PhraseTest extends \PHPUnit_Framework_TestCase
{
$this->assertEquals($expected, $phrase->toArray());
}
/**
* Tests toArray method exception.
*
* @expectedException \LogicException
*/
public function testToArrayException()
{
$phrase = new Phrase('', '');
$phrase->toArray();
}
}
......@@ -76,4 +76,15 @@ class TermTest extends \PHPUnit_Framework_TestCase
{
$this->assertEquals($expected, $suggester->toArray());
}
/**
* Tests toArray method exception.
*
* @expectedException \LogicException
*/
public function testToArrayException()
{
$term = new Term('', '');
$term->toArray();
}
}
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