Skip to content
Snippets Groups Projects
Commit 439d8211 authored by LTRocky's avatar LTRocky
Browse files

Fix code standart & test DSL/Aggregation

parent 75c466d1
No related branches found
No related tags found
No related merge requests found
...@@ -65,6 +65,4 @@ class CardinalityAggregationTest extends \PHPUnit_Framework_TestCase ...@@ -65,6 +65,4 @@ class CardinalityAggregationTest extends \PHPUnit_Framework_TestCase
$aggregation = new CardinalityAggregation('bar'); $aggregation = new CardinalityAggregation('bar');
$aggregation->getArray(); $aggregation->getArray();
} }
} }
<?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\Aggregation;
use ONGR\ElasticsearchBundle\DSL\Aggregation\ChildrenAggregation;
/**
* Unit test for children aggregation.
*/
class ChildrenAggregationTest extends \PHPUnit_Framework_TestCase
{
/**
* Tests if ChildrenAggregation#getArray throws exception when expected.
*
* @expectedException \LogicException
*/
public function testGetArrayException()
{
$aggregation = new ChildrenAggregation('foo');
$aggregation->getArray();
}
}
...@@ -12,6 +12,8 @@ ...@@ -12,6 +12,8 @@
namespace ONGR\ElasticsearchBundle\Tests\Unit\DSL\Aggregation; namespace ONGR\ElasticsearchBundle\Tests\Unit\DSL\Aggregation;
use ONGR\ElasticsearchBundle\DSL\Aggregation\FilterAggregation; use ONGR\ElasticsearchBundle\DSL\Aggregation\FilterAggregation;
use ONGR\ElasticsearchBundle\DSL\Filter\AndFilter;
use ONGR\ElasticsearchBundle\DSL\Filter\MissingFilter;
class FilterAggregationTest extends \PHPUnit_Framework_TestCase class FilterAggregationTest extends \PHPUnit_Framework_TestCase
{ {
...@@ -130,4 +132,15 @@ class FilterAggregationTest extends \PHPUnit_Framework_TestCase ...@@ -130,4 +132,15 @@ class FilterAggregationTest extends \PHPUnit_Framework_TestCase
$aggregation = new FilterAggregation('test_agg'); $aggregation = new FilterAggregation('test_agg');
$aggregation->toArray(); $aggregation->toArray();
} }
/**
* Test for toArray() with setting a filter.
*/
public function testToArrayWithFilter()
{
$aggregation = new FilterAggregation('test_agg');
$aggregation->setFilter(new MissingFilter('test'));
$aggregation->toArray();
}
} }
...@@ -109,7 +109,6 @@ class PhraseTest extends \PHPUnit_Framework_TestCase ...@@ -109,7 +109,6 @@ class PhraseTest extends \PHPUnit_Framework_TestCase
{ {
$this->setStub(new Phrase('foo', 'bar')); $this->setStub(new Phrase('foo', 'bar'));
return 'ONGR\ElasticsearchBundle\DSL\Suggester\Phrase'; return 'ONGR\ElasticsearchBundle\DSL\Suggester\Phrase';
} }
...@@ -130,4 +129,4 @@ class PhraseTest extends \PHPUnit_Framework_TestCase ...@@ -130,4 +129,4 @@ class PhraseTest extends \PHPUnit_Framework_TestCase
['size'], ['size'],
]; ];
} }
} }
\ No newline at end of file
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