Skip to content

Commit ef0fd0b

Browse files
author
Lindsay Snider
committed
applying PR ongr-io#354
1 parent b4c3c89 commit ef0fd0b

26 files changed

+53
-81
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
sudo: false
22
language: php
33
php:
4-
- 7.1
54
- 7.2
65
- 7.3
76
- 7.4snapshot
7+
- 8.0
88
matrix:
99
allow_failures:
1010
- php: 7.4snapshot

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@
1111
}
1212
],
1313
"require": {
14-
"php": "^7.0",
14+
"php": "^7.2 || ^8.0",
1515
"symfony/serializer": "^3.0|^4.0",
1616
"paragonie/random_compat": "*"
1717
},
1818
"require-dev": {
1919
"elasticsearch/elasticsearch": "^7.0",
20-
"phpunit/phpunit": "~6.0",
20+
"phpunit/phpunit": "^8.0",
2121
"squizlabs/php_codesniffer": "^3.0"
2222
},
2323
"suggest": {

tests/Functional/AbstractElasticsearchTestCase.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ abstract class AbstractElasticsearchTestCase extends TestCase
3131
/**
3232
* {@inheritdoc}
3333
*/
34-
protected function setUp()
34+
protected function setUp(): void
3535
{
3636
parent::setUp();
3737

@@ -109,7 +109,7 @@ protected function getDataArray()
109109
/**
110110
* {@inheritdoc}
111111
*/
112-
protected function tearDown()
112+
protected function tearDown(): void
113113
{
114114
parent::tearDown();
115115
$this->deleteIndex();

tests/Unit/Aggregation/Bucketing/ChildrenAggregationTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,10 @@ class ChildrenAggregationTest extends \PHPUnit\Framework\TestCase
2020
{
2121
/**
2222
* Tests if ChildrenAggregation#getArray throws exception when expected.
23-
*
24-
* @expectedException \LogicException
2523
*/
2624
public function testGetArrayException()
2725
{
26+
$this->expectException(\LogicException::class);
2827
$aggregation = new ChildrenAggregation('foo');
2928
$aggregation->getArray();
3029
}

tests/Unit/Aggregation/Bucketing/DateHistogramAggregationTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,10 @@ class DateHistogramAggregationTest extends \PHPUnit\Framework\TestCase
2020
{
2121
/**
2222
* Tests if ChildrenAggregation#getArray throws exception when expected.
23-
*
24-
* @expectedException \LogicException
2523
*/
2624
public function testGetArrayException()
2725
{
26+
$this->expectException(\LogicException::class);
2827
$aggregation = new DateHistogramAggregation('foo');
2928
$aggregation->getArray();
3029
}

tests/Unit/Aggregation/Bucketing/DateRangeAggregationTest.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,24 +17,22 @@ class DateRangeAggregationTest extends \PHPUnit\Framework\TestCase
1717
{
1818
/**
1919
* Test if exception is thrown.
20-
*
21-
* @expectedException \LogicException
22-
* @expectedExceptionMessage Date range aggregation must have field, format set and range added.
2320
*/
2421
public function testIfExceptionIsThrownWhenNoParametersAreSet()
2522
{
23+
$this->expectException(\LogicException::class);
24+
$this->expectExceptionMessage('Date range aggregation must have field, format set and range added.');
2625
$agg = new DateRangeAggregation('test_agg');
2726
$agg->getArray();
2827
}
2928

3029
/**
3130
* Test if exception is thrown when both range parameters are null.
32-
*
33-
* @expectedException \LogicException
34-
* @expectedExceptionMessage Either from or to must be set. Both cannot be null.
3531
*/
3632
public function testIfExceptionIsThrownWhenBothRangesAreNull()
3733
{
34+
$this->expectException(\LogicException::class);
35+
$this->expectExceptionMessage('Either from or to must be set. Both cannot be null.');
3836
$agg = new DateRangeAggregation('test_agg');
3937
$agg->addRange(null, null);
4038
}

tests/Unit/Aggregation/Bucketing/FilterAggregationTest.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -101,24 +101,22 @@ public function testToArray($aggregation, $expectedResult)
101101

102102
/**
103103
* Test for setField().
104-
*
105-
* @expectedException \LogicException
106-
* @expectedExceptionMessage doesn't support `field` parameter
107104
*/
108105
public function testSetField()
109106
{
107+
$this->expectException(\LogicException::class);
108+
$this->expectExceptionMessage("doesn't support `field` parameter");
110109
$aggregation = new FilterAggregation('test_agg');
111110
$aggregation->setField('test_field');
112111
}
113112

114113
/**
115114
* Test for toArray() without setting a filter.
116-
*
117-
* @expectedException \LogicException
118-
* @expectedExceptionMessage has no filter added
119115
*/
120116
public function testToArrayNoFilter()
121117
{
118+
$this->expectException(\LogicException::class);
119+
$this->expectExceptionMessage('has no filter added');
122120
$aggregation = new FilterAggregation('test_agg');
123121
$aggregation->toArray();
124122
}

tests/Unit/Aggregation/Bucketing/FiltersAggregationTest.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,11 @@ class FiltersAggregationTest extends \PHPUnit\Framework\TestCase
2121
{
2222
/**
2323
* Test if exception is thrown when not anonymous filter is without name.
24-
*
25-
* @expectedException \LogicException
26-
* @expectedExceptionMessage In not anonymous filters filter name must be set.
2724
*/
2825
public function testIfExceptionIsThrown()
2926
{
27+
$this->expectException(\LogicException::class);
28+
$this->expectExceptionMessage('In not anonymous filters filter name must be set.');
3029
$mock = $this->getMockBuilder('ONGR\ElasticsearchDSL\BuilderInterface')->getMock();
3130
$aggregation = new FiltersAggregation('test_agg');
3231
$aggregation->addFilter($mock);

tests/Unit/Aggregation/Bucketing/GeoDistanceAggregationTest.php

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,38 +17,35 @@ class GeoDistanceAggregationTest extends \PHPUnit\Framework\TestCase
1717
{
1818
/**
1919
* Test if exception is thrown when field is not set.
20-
*
21-
* @expectedException \LogicException
22-
* @expectedExceptionMessage Geo distance aggregation must have a field set.
2320
*/
2421
public function testGeoDistanceAggregationExceptionWhenFieldIsNotSet()
2522
{
23+
$this->expectException(\LogicException::class);
24+
$this->expectExceptionMessage('Geo distance aggregation must have a field set.');
2625
$agg = new GeoDistanceAggregation('test_agg');
2726
$agg->setOrigin('50, 70');
2827
$agg->getArray();
2928
}
3029

3130
/**
3231
* Test if exception is thrown when origin is not set.
33-
*
34-
* @expectedException \LogicException
35-
* @expectedExceptionMessage Geo distance aggregation must have an origin set.
3632
*/
3733
public function testGeoDistanceAggregationExceptionWhenOriginIsNotSet()
3834
{
35+
$this->expectException(\LogicException::class);
36+
$this->expectExceptionMessage('Geo distance aggregation must have an origin set.');
3937
$agg = new GeoDistanceAggregation('test_agg');
4038
$agg->setField('location');
4139
$agg->getArray();
4240
}
4341

4442
/**
4543
* Test if exception is thrown when field is not set.
46-
*
47-
* @expectedException \LogicException
48-
* @expectedExceptionMessage Either from or to must be set. Both cannot be null.
4944
*/
5045
public function testGeoDistanceAggregationAddRangeException()
5146
{
47+
$this->expectException(\LogicException::class);
48+
$this->expectExceptionMessage('Either from or to must be set. Both cannot be null.');
5249
$agg = new GeoDistanceAggregation('test_agg');
5350
$agg->addRange();
5451
}

tests/Unit/Aggregation/Bucketing/GeoHashGridAggregationTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,10 @@ class GeoHashGridAggregationTest extends \PHPUnit\Framework\TestCase
2020
{
2121
/**
2222
* Test if exception is thrown.
23-
*
24-
* @expectedException \LogicException
2523
*/
2624
public function testGeoHashGridAggregationException()
2725
{
26+
$this->expectException(\LogicException::class);
2827
$agg = new GeoHashGridAggregation('test_agg');
2928
$agg->getArray();
3029
}

0 commit comments

Comments
 (0)