Skip to content

Commit f728ede

Browse files
Allowed PHP8
1 parent 90cc2ef commit f728ede

22 files changed

+50
-49
lines changed

.ci/packer_cache.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
source /usr/local/bin/bash_standard_lib.sh
44

5-
DOCKER_IMAGES="php:7.4-cli
5+
DOCKER_IMAGES="php:8.0-cli
6+
php:7.4-cli
67
php:7.3-cli
78
php:7.2-cli
89
php:7.1-cli

.ci/test-matrix.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ STACK_VERSION:
33
- 7.x-SNAPSHOT
44

55
PHP_VERSION:
6+
- 8.0-cli
67
- 7.4-cli
78
- 7.3-cli
89
- 7.2-cli

.github/workflows/test.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99

1010
strategy:
1111
matrix:
12-
php-version: [7.1, 7.2, 7.3, 7.4]
12+
php-version: [7.2, 7.3, 7.4, 8.0]
1313
os: [ubuntu-latest]
1414
es-version: [7.x-SNAPSHOT]
1515

@@ -24,11 +24,11 @@ jobs:
2424
tools: prestissimo
2525
env:
2626
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
27-
27+
2828
- name: Get composer cache directory
2929
id: composercache
3030
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
31-
31+
3232
- name: Cache dependencies
3333
uses: actions/cache@v2
3434
with:
@@ -37,9 +37,15 @@ jobs:
3737
restore-keys: ${{ runner.os }}-composer-
3838

3939
- name: Install dependencies
40+
if: ${{ matrix.php-version != '8.0' }}
4041
run: |
4142
composer install --prefer-dist
4243
44+
- name: ignore ignore-platform-reqs if it is using php 8
45+
if: ${{ matrix.php-version == '8.0' }}
46+
run: |
47+
composer install --prefer-dist --ignore-platform-reqs
48+
4349
- name: PHP Coding Standards
4450
run: |
4551
composer run-script phpcs
@@ -71,4 +77,3 @@ jobs:
7177
vendor/bin/phpunit -c phpunit-integration-tests.xml
7278
env:
7379
TEST_SUITE: oss
74-

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
}
1414
],
1515
"require": {
16-
"php": "^7.1",
16+
"php": "^7.1 || ^8.0",
1717
"ext-json": ">=1.3.7",
1818
"ezimuel/ringphp": "^1.1.2",
1919
"psr/log": "~1.0"
@@ -25,7 +25,7 @@
2525
"doctrine/inflector": "^1.3",
2626
"mockery/mockery": "^1.2",
2727
"phpstan/phpstan": "^0.12",
28-
"phpunit/phpunit": "^7.5",
28+
"phpunit/phpunit": "^7.5 || ^8.5 || ^9.3",
2929
"squizlabs/php_codesniffer": "^3.4",
3030
"symfony/finder": "~4.0",
3131
"symfony/yaml": "~4.0"

tests/Elasticsearch/Tests/ClientBuilder/DummyLogger.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,5 @@
1919

2020
class DummyLogger
2121
{
22-
22+
2323
}

tests/Elasticsearch/Tests/ClientBuilderTest.php

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,26 +21,20 @@
2121
use Elasticsearch\Client;
2222
use Elasticsearch\ClientBuilder;
2323
use Elasticsearch\Common\Exceptions\ElasticsearchException;
24-
use Elasticsearch\Common\Exceptions\InvalidArgumentException;
2524
use Elasticsearch\Tests\ClientBuilder\DummyLogger;
26-
use GuzzleHttp\Ring\Client\MockHandler;
2725
use PHPUnit\Framework\TestCase;
2826

2927
class ClientBuilderTest extends TestCase
3028
{
31-
/**
32-
* @expectedException TypeError
33-
*/
3429
public function testClientBuilderThrowsExceptionForIncorrectLoggerClass()
3530
{
31+
$this->expectException(\TypeError::class);
3632
ClientBuilder::create()->setLogger(new DummyLogger);
3733
}
3834

39-
/**
40-
* @expectedException TypeError
41-
*/
4235
public function testClientBuilderThrowsExceptionForIncorrectTracerClass()
4336
{
37+
$this->expectException(\TypeError::class);
4438
ClientBuilder::create()->setTracer(new DummyLogger);
4539
}
4640

@@ -51,7 +45,7 @@ public function testGzipEnabledWhenElasticCloudId()
5145
->build();
5246

5347
$this->assertInstanceOf(Client::class, $client);
54-
48+
5549
try {
5650
$result = $client->info();
5751
} catch (ElasticsearchException $e) {
@@ -75,7 +69,7 @@ public function testElasticCloudIdNotOverrideCurlEncoding()
7569
->build();
7670

7771
$this->assertInstanceOf(Client::class, $client);
78-
72+
7973
try {
8074
$result = $client->info();
8175
} catch (ElasticsearchException $e) {

tests/Elasticsearch/Tests/ClientIntegrationTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class ClientIntegrationTest extends \PHPUnit\Framework\TestCase
4444
*/
4545
private $host;
4646

47-
public function setUp()
47+
public function setUp(): void
4848
{
4949
$this->host = Utility::getHost();
5050
if (null == $this->host) {
@@ -58,10 +58,10 @@ private function getClient(): Client
5858
$client = ClientBuilder::create()
5959
->setHosts([$this->host])
6060
->setLogger($this->logger);
61-
61+
6262
if (getenv('TEST_SUITE') === 'xpack') {
6363
$client->setSSLVerification(__DIR__ . '/../../../.ci/certs/ca.crt');
64-
}
64+
}
6565
return $client->build();
6666
}
6767

@@ -80,7 +80,7 @@ public function testLogRequestSuccessHasPortInInfo()
8080

8181
$result = $client->info();
8282

83-
$this->assertContains('"port"', $this->getLevelOutput(LogLevel::INFO, $this->logger->output));
83+
$this->assertStringContainsString('"port"', $this->getLevelOutput(LogLevel::INFO, $this->logger->output));
8484
}
8585

8686
public function testLogRequestFailHasWarning()

tests/Elasticsearch/Tests/ClientTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
*/
3434
class ClientTest extends \PHPUnit\Framework\TestCase
3535
{
36-
public function tearDown()
36+
public function tearDown(): void
3737
{
3838
m::close();
3939
}

tests/Elasticsearch/Tests/ConnectionPool/Selectors/StickyRoundRobinSelectorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
*/
3030
class StickyRoundRobinSelectorTest extends \PHPUnit\Framework\TestCase
3131
{
32-
public function tearDown()
32+
public function tearDown(): void
3333
{
3434
m::close();
3535
}

tests/Elasticsearch/Tests/ConnectionPool/SniffingConnectionPoolIntegrationTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
*/
3131
class SniffingConnectionPoolIntegrationTest extends \PHPUnit\Framework\TestCase
3232
{
33-
protected function setUp()
33+
protected function setUp(): void
3434
{
3535
static::markTestSkipped("All of Sniffing unit tests use outdated cluster state format, need to redo");
3636
}

0 commit comments

Comments
 (0)