Skip to content

Commit

Permalink
foo
Browse files Browse the repository at this point in the history
  • Loading branch information
im-denisenko committed Jun 3, 2015
1 parent 8d9d71b commit f4b205e
Show file tree
Hide file tree
Showing 4 changed files with 119 additions and 118 deletions.
66 changes: 33 additions & 33 deletions test/lib/Elastica/Test/QueryBuilder/DSL/AggregationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,48 +11,48 @@ class AggregationTest extends AbstractDSLTest
*/
public function testType()
{
$dsl = new DSL\Aggregation();
$aggregationDSL = new DSL\Aggregation();

$this->assertInstanceOf('Elastica\QueryBuilder\DSL', $dsl);
$this->assertEquals(DSL::TYPE_AGGREGATION, $dsl->getType());
$this->assertInstanceOf('Elastica\QueryBuilder\DSL', $aggregationDSL);
$this->assertEquals(DSL::TYPE_AGGREGATION, $aggregationDSL->getType());
}

/**
* @group unit
*/
public function testInterface()
{
$dsl = new DSL\Aggregation();
$aggregationDSL = new DSL\Aggregation();

$this->_assertImplemented($dsl, 'avg', 'Elastica\Aggregation\Avg', array('name'));
$this->_assertImplemented($dsl, 'cardinality', 'Elastica\Aggregation\Cardinality', array('name'));
$this->_assertImplemented($dsl, 'date_histogram', 'Elastica\Aggregation\DateHistogram', array('name', 'field', 1));
$this->_assertImplemented($dsl, 'date_range', 'Elastica\Aggregation\DateRange', array('name'));
$this->_assertImplemented($dsl, 'extended_stats', 'Elastica\Aggregation\ExtendedStats', array('name'));
$this->_assertImplemented($dsl, 'filter', 'Elastica\Aggregation\Filter', array('name', new Exists('field')));
$this->_assertImplemented($dsl, 'filters', 'Elastica\Aggregation\Filters', array('name'));
$this->_assertImplemented($dsl, 'geo_distance', 'Elastica\Aggregation\GeoDistance', array('name', 'field', 'origin'));
$this->_assertImplemented($dsl, 'geohash_grid', 'Elastica\Aggregation\GeohashGrid', array('name', 'field'));
$this->_assertImplemented($dsl, 'global_agg', 'Elastica\Aggregation\GlobalAggregation', array('name'));
$this->_assertImplemented($dsl, 'histogram', 'Elastica\Aggregation\Histogram', array('name', 'field', 1));
$this->_assertImplemented($dsl, 'ipv4_range', 'Elastica\Aggregation\IpRange', array('name', 'field'));
$this->_assertImplemented($dsl, 'max', 'Elastica\Aggregation\Max', array('name'));
$this->_assertImplemented($dsl, 'min', 'Elastica\Aggregation\Min', array('name'));
$this->_assertImplemented($dsl, 'missing', 'Elastica\Aggregation\Missing', array('name', 'field'));
$this->_assertImplemented($dsl, 'nested', 'Elastica\Aggregation\Nested', array('name', 'path'));
$this->_assertImplemented($dsl, 'percentiles', 'Elastica\Aggregation\Percentiles', array('name'));
$this->_assertImplemented($dsl, 'range', 'Elastica\Aggregation\Range', array('name'));
$this->_assertImplemented($dsl, 'reverse_nested', 'Elastica\Aggregation\ReverseNested', array('name'));
$this->_assertImplemented($dsl, 'scripted_metric', 'Elastica\Aggregation\ScriptedMetric', array('name'));
$this->_assertImplemented($dsl, 'significant_terms', 'Elastica\Aggregation\SignificantTerms', array('name'));
$this->_assertImplemented($dsl, 'stats', 'Elastica\Aggregation\Stats', array('name'));
$this->_assertImplemented($dsl, 'sum', 'Elastica\Aggregation\Sum', array('name'));
$this->_assertImplemented($dsl, 'terms', 'Elastica\Aggregation\Terms', array('name'));
$this->_assertImplemented($dsl, 'top_hits', 'Elastica\Aggregation\TopHits', array('name'));
$this->_assertImplemented($dsl, 'value_count', 'Elastica\Aggregation\ValueCount', array('name', 'field'));
$this->_assertImplemented($aggregationDSL, 'avg', 'Elastica\Aggregation\Avg', array('name'));
$this->_assertImplemented($aggregationDSL, 'cardinality', 'Elastica\Aggregation\Cardinality', array('name'));
$this->_assertImplemented($aggregationDSL, 'date_histogram', 'Elastica\Aggregation\DateHistogram', array('name', 'field', 1));
$this->_assertImplemented($aggregationDSL, 'date_range', 'Elastica\Aggregation\DateRange', array('name'));
$this->_assertImplemented($aggregationDSL, 'extended_stats', 'Elastica\Aggregation\ExtendedStats', array('name'));
$this->_assertImplemented($aggregationDSL, 'filter', 'Elastica\Aggregation\Filter', array('name', new Exists('field')));
$this->_assertImplemented($aggregationDSL, 'filters', 'Elastica\Aggregation\Filters', array('name'));
$this->_assertImplemented($aggregationDSL, 'geo_distance', 'Elastica\Aggregation\GeoDistance', array('name', 'field', 'origin'));
$this->_assertImplemented($aggregationDSL, 'geohash_grid', 'Elastica\Aggregation\GeohashGrid', array('name', 'field'));
$this->_assertImplemented($aggregationDSL, 'global_agg', 'Elastica\Aggregation\GlobalAggregation', array('name'));
$this->_assertImplemented($aggregationDSL, 'histogram', 'Elastica\Aggregation\Histogram', array('name', 'field', 1));
$this->_assertImplemented($aggregationDSL, 'ipv4_range', 'Elastica\Aggregation\IpRange', array('name', 'field'));
$this->_assertImplemented($aggregationDSL, 'max', 'Elastica\Aggregation\Max', array('name'));
$this->_assertImplemented($aggregationDSL, 'min', 'Elastica\Aggregation\Min', array('name'));
$this->_assertImplemented($aggregationDSL, 'missing', 'Elastica\Aggregation\Missing', array('name', 'field'));
$this->_assertImplemented($aggregationDSL, 'nested', 'Elastica\Aggregation\Nested', array('name', 'path'));
$this->_assertImplemented($aggregationDSL, 'percentiles', 'Elastica\Aggregation\Percentiles', array('name'));
$this->_assertImplemented($aggregationDSL, 'range', 'Elastica\Aggregation\Range', array('name'));
$this->_assertImplemented($aggregationDSL, 'reverse_nested', 'Elastica\Aggregation\ReverseNested', array('name'));
$this->_assertImplemented($aggregationDSL, 'scripted_metric', 'Elastica\Aggregation\ScriptedMetric', array('name'));
$this->_assertImplemented($aggregationDSL, 'significant_terms', 'Elastica\Aggregation\SignificantTerms', array('name'));
$this->_assertImplemented($aggregationDSL, 'stats', 'Elastica\Aggregation\Stats', array('name'));
$this->_assertImplemented($aggregationDSL, 'sum', 'Elastica\Aggregation\Sum', array('name'));
$this->_assertImplemented($aggregationDSL, 'terms', 'Elastica\Aggregation\Terms', array('name'));
$this->_assertImplemented($aggregationDSL, 'top_hits', 'Elastica\Aggregation\TopHits', array('name'));
$this->_assertImplemented($aggregationDSL, 'value_count', 'Elastica\Aggregation\ValueCount', array('name', 'field'));

$this->_assertNotImplemented($dsl, 'children');
$this->_assertNotImplemented($dsl, 'geo_bounds');
$this->_assertNotImplemented($dsl, 'percentile_ranks');
$this->_assertNotImplemented($aggregationDSL, 'children');
$this->_assertNotImplemented($aggregationDSL, 'geo_bounds');
$this->_assertNotImplemented($aggregationDSL, 'percentile_ranks');
}
}
66 changes: 33 additions & 33 deletions test/lib/Elastica/Test/QueryBuilder/DSL/FilterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,47 +12,47 @@ class FilterTest extends AbstractDSLTest
*/
public function testType()
{
$dsl = new DSL\Filter();
$filterDSL = new DSL\Filter();

$this->assertInstanceOf('Elastica\QueryBuilder\DSL', $dsl);
$this->assertEquals(DSL::TYPE_FILTER, $dsl->getType());
$this->assertInstanceOf('Elastica\QueryBuilder\DSL', $filterDSL);
$this->assertEquals(DSL::TYPE_FILTER, $filterDSL->getType());
}

/**
* @group unit
*/
public function testInterface()
{
$dsl = new DSL\Filter();
$filterDSL = new DSL\Filter();

$this->_assertImplemented($dsl, 'bool', 'Elastica\Filter\BoolFilter', array());
$this->_assertImplemented($dsl, 'bool_and', 'Elastica\Filter\BoolAnd', array(array(new Exists('field'))));
$this->_assertImplemented($dsl, 'bool_not', 'Elastica\Filter\BoolNot', array(new Exists('field')));
$this->_assertImplemented($dsl, 'bool_or', 'Elastica\Filter\BoolOr', array(array(new Exists('field'))));
$this->_assertImplemented($dsl, 'exists', 'Elastica\Filter\Exists', array('field'));
$this->_assertImplemented($dsl, 'geo_bounding_box', 'Elastica\Filter\GeoBoundingBox', array('field', array(1, 2)));
$this->_assertImplemented($dsl, 'geo_distance', 'Elastica\Filter\GeoDistance', array('key', 'location', 'distance'));
$this->_assertImplemented($dsl, 'geo_distance_range', 'Elastica\Filter\GeoDistanceRange', array('key', 'location'));
$this->_assertImplemented($dsl, 'geo_polygon', 'Elastica\Filter\GeoPolygon', array('key', array()));
$this->_assertImplemented($dsl, 'geo_shape_pre_indexed', 'Elastica\Filter\GeoShapePreIndexed', array('path', 'indexedId', 'indexedType', 'indexedIndex', 'indexedPath'));
$this->_assertImplemented($dsl, 'geo_shape_provided', 'Elastica\Filter\GeoShapeProvided', array('path', array()));
$this->_assertImplemented($dsl, 'geohash_cell', 'Elastica\Filter\GeohashCell', array('field', 'location'));
$this->_assertImplemented($dsl, 'has_child', 'Elastica\Filter\HasChild', array(new Match(), 'type'));
$this->_assertImplemented($dsl, 'has_parent', 'Elastica\Filter\HasParent', array(new Match(), 'type'));
$this->_assertImplemented($dsl, 'ids', 'Elastica\Filter\Ids', array('type', array()));
$this->_assertImplemented($dsl, 'indices', 'Elastica\Filter\Indices', array(new Exists('field'), array()));
$this->_assertImplemented($dsl, 'limit', 'Elastica\Filter\Limit', array(1));
$this->_assertImplemented($dsl, 'match_all', 'Elastica\Filter\MatchAll', array());
$this->_assertImplemented($dsl, 'missing', 'Elastica\Filter\Missing', array('field'));
$this->_assertImplemented($dsl, 'nested', 'Elastica\Filter\Nested', array());
$this->_assertImplemented($dsl, 'numeric_range', 'Elastica\Filter\NumericRange', array());
$this->_assertImplemented($dsl, 'prefix', 'Elastica\Filter\Prefix', array('field', 'prefix'));
$this->_assertImplemented($dsl, 'query', 'Elastica\Filter\Query', array(new Match()));
$this->_assertImplemented($dsl, 'range', 'Elastica\Filter\Range', array('field', array()));
$this->_assertImplemented($dsl, 'regexp', 'Elastica\Filter\Regexp', array('field', 'regex'));
$this->_assertImplemented($dsl, 'script', 'Elastica\Filter\Script', array('script'));
$this->_assertImplemented($dsl, 'term', 'Elastica\Filter\Term', array());
$this->_assertImplemented($dsl, 'terms', 'Elastica\Filter\Terms', array('field', array()));
$this->_assertImplemented($dsl, 'type', 'Elastica\Filter\Type', array('type'));
$this->_assertImplemented($filterDSL, 'bool', 'Elastica\Filter\BoolFilter', array());
$this->_assertImplemented($filterDSL, 'bool_and', 'Elastica\Filter\BoolAnd', array(array(new Exists('field'))));
$this->_assertImplemented($filterDSL, 'bool_not', 'Elastica\Filter\BoolNot', array(new Exists('field')));
$this->_assertImplemented($filterDSL, 'bool_or', 'Elastica\Filter\BoolOr', array(array(new Exists('field'))));
$this->_assertImplemented($filterDSL, 'exists', 'Elastica\Filter\Exists', array('field'));
$this->_assertImplemented($filterDSL, 'geo_bounding_box', 'Elastica\Filter\GeoBoundingBox', array('field', array(1, 2)));
$this->_assertImplemented($filterDSL, 'geo_distance', 'Elastica\Filter\GeoDistance', array('key', 'location', 'distance'));
$this->_assertImplemented($filterDSL, 'geo_distance_range', 'Elastica\Filter\GeoDistanceRange', array('key', 'location'));
$this->_assertImplemented($filterDSL, 'geo_polygon', 'Elastica\Filter\GeoPolygon', array('key', array()));
$this->_assertImplemented($filterDSL, 'geo_shape_pre_indexed', 'Elastica\Filter\GeoShapePreIndexed', array('path', 'indexedId', 'indexedType', 'indexedIndex', 'indexedPath'));
$this->_assertImplemented($filterDSL, 'geo_shape_provided', 'Elastica\Filter\GeoShapeProvided', array('path', array()));
$this->_assertImplemented($filterDSL, 'geohash_cell', 'Elastica\Filter\GeohashCell', array('field', 'location'));
$this->_assertImplemented($filterDSL, 'has_child', 'Elastica\Filter\HasChild', array(new Match(), 'type'));
$this->_assertImplemented($filterDSL, 'has_parent', 'Elastica\Filter\HasParent', array(new Match(), 'type'));
$this->_assertImplemented($filterDSL, 'ids', 'Elastica\Filter\Ids', array('type', array()));
$this->_assertImplemented($filterDSL, 'indices', 'Elastica\Filter\Indices', array(new Exists('field'), array()));
$this->_assertImplemented($filterDSL, 'limit', 'Elastica\Filter\Limit', array(1));
$this->_assertImplemented($filterDSL, 'match_all', 'Elastica\Filter\MatchAll', array());
$this->_assertImplemented($filterDSL, 'missing', 'Elastica\Filter\Missing', array('field'));
$this->_assertImplemented($filterDSL, 'nested', 'Elastica\Filter\Nested', array());
$this->_assertImplemented($filterDSL, 'numeric_range', 'Elastica\Filter\NumericRange', array());
$this->_assertImplemented($filterDSL, 'prefix', 'Elastica\Filter\Prefix', array('field', 'prefix'));
$this->_assertImplemented($filterDSL, 'query', 'Elastica\Filter\Query', array(new Match()));
$this->_assertImplemented($filterDSL, 'range', 'Elastica\Filter\Range', array('field', array()));
$this->_assertImplemented($filterDSL, 'regexp', 'Elastica\Filter\Regexp', array('field', 'regex'));
$this->_assertImplemented($filterDSL, 'script', 'Elastica\Filter\Script', array('script'));
$this->_assertImplemented($filterDSL, 'term', 'Elastica\Filter\Term', array());
$this->_assertImplemented($filterDSL, 'terms', 'Elastica\Filter\Terms', array('field', array()));
$this->_assertImplemented($filterDSL, 'type', 'Elastica\Filter\Type', array('type'));
}
}
Loading

0 comments on commit f4b205e

Please sign in to comment.