Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
E
Elasticsearch DSL
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Public
Elasticsearch DSL
Commits
84d3369d
Commit
84d3369d
authored
10 years ago
by
Mantas Jonušas
Browse files
Options
Downloads
Patches
Plain Diff
Added geo distance aggregation
parent
9e3162f8
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Aggregation/GeoDistanceAggregationTest.php
+55
-0
55 additions, 0 deletions
Aggregation/GeoDistanceAggregationTest.php
with
55 additions
and
0 deletions
Aggregation/GeoDistanceAggregationTest.php
0 → 100644
+
55
−
0
View file @
84d3369d
<?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\GeoDistanceAggregation
;
class
GeoDistanceAggregationTest
extends
\PHPUnit_Framework_TestCase
{
/**
* Test if exception is thrown when field is not set.
*
* @expectedException \LogicException
* @expectedExceptionMessage Geo distance aggregation must have a field set.
*/
public
function
testGeoDistanceAggregationExceptionWhenFieldIsNotSet
()
{
$agg
=
new
GeoDistanceAggregation
(
'test_agg'
);
$agg
->
setOrigin
(
'50, 70'
);
$agg
->
getArray
();
}
/**
* Test if exception is thrown when origin is not set.
*
* @expectedException \LogicException
* @expectedExceptionMessage Geo distance aggregation must have an origin set.
*/
public
function
testGeoDistanceAggregationExceptionWhenOriginIsNotSet
()
{
$agg
=
new
GeoDistanceAggregation
(
'test_agg'
);
$agg
->
setField
(
'location'
);
$agg
->
getArray
();
}
/**
* Test if exception is thrown when field is not set.
*
* @expectedException \LogicException
* @expectedExceptionMessage Either from or to must be set. Both cannot be null.
*/
public
function
testGeoDistanceAggregationAddRangeException
()
{
$agg
=
new
GeoDistanceAggregation
(
'test_agg'
);
$agg
->
addRange
();
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment