Skip to content

Commit

Permalink
Fixed for PHP 8 Compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
lernhart authored and 84m committed Apr 27, 2021
1 parent 95e06d5 commit c0789c3
Show file tree
Hide file tree
Showing 12 changed files with 12 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/phpunit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
discovery.type: single-node
strategy:
matrix:
php: ['7.3', '7.4']
php: ['7.4', '8.0']
steps:
- uses: actions/checkout@v2

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
}
],
"require": {
"php": "^7.3",
"php": "^7.4 || ^8.0",
"symfony/serializer": "^5.0",
"elasticsearch/elasticsearch": "^7.0"
},
Expand Down
2 changes: 1 addition & 1 deletion src/Serializer/OrderedSerializer.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ private function order(array $data)
uasort(
$filteredData,
function (OrderedNormalizerInterface $a, OrderedNormalizerInterface $b) {
return $a->getOrder() > $b->getOrder();
return $a->getOrder() <=> $b->getOrder();
}
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public function testToArray()
{
$aggregation = new AdjacencyMatrixAggregation('test_agg');
$filter = $this->getMockBuilder('ONGR\ElasticsearchDSL\BuilderInterface')
->setMethods(['toArray', 'getType'])
->onlyMethods(['toArray', 'getType'])
->getMockForAbstractClass();
$filter->expects($this->any())
->method('toArray')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public function getDateRangeAggregationConstructorProvider()
public function testDateRangeAggregationConstructor($field = null, $format = null, array $ranges = null)
{
$aggregation = $this->getMockBuilder('ONGR\ElasticsearchDSL\Aggregation\Bucketing\DateRangeAggregation')
->setMethods(['setField', 'setFormat', 'addRange'])
->onlyMethods(['setField', 'setFormat', 'addRange'])
->disableOriginalConstructor()
->getMock();
$aggregation->expects($this->once())->method('setField')->with($field);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public function testToArray()
{
$aggregation = new FiltersAggregation('test_agg');
$filter = $this->getMockBuilder('ONGR\ElasticsearchDSL\BuilderInterface')
->setMethods(['toArray', 'getType'])
->onlyMethods(['toArray', 'getType'])
->getMockForAbstractClass();
$filter->expects($this->any())
->method('toArray')
Expand Down
3 changes: 2 additions & 1 deletion tests/Unit/BuilderBagTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ public function testGet()
private function getBuilder($name)
{
$friendlyBuilderMock = $this->getMockBuilder('ONGR\ElasticsearchDSL\BuilderInterface')
->setMethods(['getName', 'toArray', 'getType'])
->onlyMethods(['toArray', 'getType'])
->addMethods(['getName'])
->disableOriginalConstructor()
->getMock();

Expand Down
3 changes: 2 additions & 1 deletion tests/Unit/SearchEndpoint/InnerHitsEndpointTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ public function testNormalization()
->getMock();
$innerHit = $this
->getMockBuilder('ONGR\ElasticsearchDSL\BuilderInterface')
->setMethods(['getName', 'toArray', 'getType'])
->onlyMethods(['toArray', 'getType'])
->addMethods(['getName'])
->getMock();
$innerHit->expects($this->any())->method('getName')->willReturn('foo');
$innerHit->expects($this->any())->method('toArray')->willReturn(['foo' => 'bar']);
Expand Down
5 changes: 2 additions & 3 deletions tests/Unit/SearchEndpoint/SearchEndpointFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ public function testGet()
*/
public function testFactory()
{
$endpoinnt = SearchEndpointFactory::get(AggregationsEndpoint::NAME);

$this->assertInstanceOf(SearchEndpointInterface::class, $endpoinnt);
$endpoint = SearchEndpointFactory::get(AggregationsEndpoint::NAME);
$this->assertInstanceOf(SearchEndpointInterface::class, $endpoint);
}
}
1 change: 0 additions & 1 deletion tests/Unit/Sort/FieldSortTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ class FieldSortTest extends \PHPUnit\Framework\TestCase
{
/**
* Test for toArray() method.
*
*/
public function testToArray()
{
Expand Down
3 changes: 0 additions & 3 deletions tests/Unit/Sort/NestedSortTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ class NestedSortTest extends \PHPUnit\Framework\TestCase
{
/**
* Test for single nested.
*
*/
public function testSingle()
{
Expand All @@ -37,7 +36,6 @@ public function testSingle()

/**
* Test for single nested, no filter.
*
*/
public function testNoFilter()
{
Expand All @@ -51,7 +49,6 @@ public function testNoFilter()

/**
* Test for single nested.
*
*/
public function testMultipleNesting()
{
Expand Down
2 changes: 0 additions & 2 deletions tests/Unit/Suggest/SuggestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ public function testSuggestGetType()

/**
* Data provider for testToArray()
*
* @return array[]
*/
public function getTestToArrayData()
{
Expand Down

0 comments on commit c0789c3

Please sign in to comment.