Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
E
Elasticsearch DSL
Manage
Activity
Members
Labels
Plan
Work items
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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Public
Elasticsearch DSL
Commits
cdb4bbdf
Commit
cdb4bbdf
authored
Mar 5, 2015
by
Mantas Jonušas
Browse files
Options
Downloads
Patches
Plain Diff
Exception tests moved to Unit tests
parent
77600ec2
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
Aggregation/DateRangeAggregationTest.php
+41
-0
41 additions, 0 deletions
Aggregation/DateRangeAggregationTest.php
Aggregation/MissingAggregationTest.php
+29
-0
29 additions, 0 deletions
Aggregation/MissingAggregationTest.php
with
70 additions
and
0 deletions
Aggregation/DateRangeAggregationTest.php
0 → 100644
+
41
−
0
View file @
cdb4bbdf
<?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\DateRangeAggregation
;
class
DateRangeAggregationTest
extends
\PHPUnit_Framework_TestCase
{
/**
* Test if exception is thrown.
*
* @expectedException \LogicException
* @expectedExceptionMessage Date range aggregation must have field, format set and range added.
*/
public
function
testIfExceptionIsThrownWhenNoParametersAreSet
()
{
$agg
=
new
DateRangeAggregation
(
'test_agg'
);
$agg
->
getArray
();
}
/**
* Test if exception is thrown when both range parameters are null.
*
* @expectedException \LogicException
* @expectedExceptionMessage Either from or to must be set. Both cannot be null.
*/
public
function
testIfExceptionIsThrownWhenBothRangesAreNull
()
{
$agg
=
new
DateRangeAggregation
(
'test_agg'
);
$agg
->
addRange
(
null
,
null
);
}
}
This diff is collapsed.
Click to expand it.
Aggregation/MissingAggregationTest.php
0 → 100644
+
29
−
0
View file @
cdb4bbdf
<?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\MissingAggregation
;
class
MissingAggregationTest
extends
\PHPUnit_Framework_TestCase
{
/**
* Test if exception is thrown when field is not set.
*
* @expectedException \LogicException
* @expectedExceptionMessage Missing aggregation must have a field set.
*/
public
function
testIfExceptionIsThrown
()
{
$agg
=
new
MissingAggregation
(
'test_agg'
);
$agg
->
getArray
();
}
}
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