Skip to content

Commit f9f4569

Browse files
PHP8 Compatibility
Thanks to Yoast!
1 parent a148a1e commit f9f4569

File tree

6 files changed

+35
-16
lines changed

6 files changed

+35
-16
lines changed

.circleci/config.yml

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
version: 2 # use CircleCI 2.0
22

3-
x-dockerbuild-7: &dockerbuild-7
3+
x-dockerbuild-phpdbg: &dockerbuild-phpdbg
44
steps:
55
- checkout
66
- run: sudo docker-php-ext-install sockets
@@ -19,16 +19,32 @@ x-dockerbuild-5: &dockerbuild-5
1919
- run: composer lint
2020

2121
jobs:
22+
test-8.1:
23+
<<: *dockerbuild-phpdbg
24+
docker:
25+
- image: circleci/php:8.1-node-browsers
26+
test-8.0:
27+
<<: *dockerbuild-phpdbg
28+
docker:
29+
- image: circleci/php:8.0-node-browsers
30+
test-7.4:
31+
<<: *dockerbuild-phpdbg
32+
docker:
33+
- image: circleci/php:7.4-node-browsers
34+
test-7.3:
35+
<<: *dockerbuild-phpdbg
36+
docker:
37+
- image: circleci/php:7.3-node-browsers
2238
test-7.2:
23-
<<: *dockerbuild-7
39+
<<: *dockerbuild-phpdbg
2440
docker:
2541
- image: circleci/php:7.2-node-browsers
2642
test-7.1:
27-
<<: *dockerbuild-7
43+
<<: *dockerbuild-phpdbg
2844
docker:
2945
- image: circleci/php:7.1-node-browsers
3046
test-7.0:
31-
<<: *dockerbuild-7
47+
<<: *dockerbuild-phpdbg
3248
docker:
3349
- image: circleci/php:7.0-node-browsers
3450
test-5.6:
@@ -40,6 +56,10 @@ workflows:
4056
version: 2
4157
check_compile:
4258
jobs:
59+
- test-8.1
60+
- test-8.0
61+
- test-7.4
62+
- test-7.3
4363
- test-7.2
4464
- test-7.1
4565
- test-7.0

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
"sort-packages": true
5050
},
5151
"require-dev": {
52-
"phpunit/phpunit": "5.7.27",
52+
"yoast/phpunit-polyfills": "^1.0.1",
5353
"squizlabs/php_codesniffer": "^3.3"
5454
},
5555
"scripts": {

tests/TestHelpers/CurlSpyTestCase.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace DataDog\TestHelpers;
44

5-
use PHPUnit\Framework\TestCase;
5+
use Yoast\PHPUnitPolyfills\TestCases\TestCase;
66

77
$curlSpy = new CurlSpy();
88

@@ -11,13 +11,12 @@ class CurlSpyTestCase extends TestCase
1111
/**
1212
* Set up a spy object to capture calls to built in curl functions
1313
*/
14-
protected function setUp()
14+
protected function set_up()
1515
{
1616
global $curlSpy;
1717

1818
$curlSpy = new CurlSpy();
19-
20-
parent::setUp();
19+
parent::set_up();
2120
}
2221

2322
/**

tests/TestHelpers/SocketSpyTestCase.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
namespace DataDog\TestHelpers;
44

55
use DataDog\DogStatsd;
6-
use PHPUnit\Framework\TestCase;
6+
use Yoast\PHPUnitPolyfills\TestCases\TestCase;
77

88
/**
99
* Making this variable global to this file is necessary for interacting with
@@ -24,13 +24,13 @@ class SocketSpyTestCase extends TestCase
2424
/**
2525
* Set up a spy object to capture calls to global built in socket functions
2626
*/
27-
protected function setUp()
27+
protected function set_up()
2828
{
2929
global $socketSpy;
3030

3131
$socketSpy = new SocketSpy();
3232

33-
parent::setUp();
33+
parent::set_up();
3434
}
3535

3636
/**

tests/UnitTests/BatchedDogStatsdTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88

99
class BatchedDogStatsdTest extends SocketSpyTestCase
1010
{
11-
protected function setUp()
11+
protected function set_up()
1212
{
13-
parent::setUp();
13+
parent::set_up();
1414

1515
// Flush the buffer to reset state for next test
1616
BatchedDogStatsd::$maxBufferLength = 50;

tests/UnitTests/DogStatsd/SocketsTest.php

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

1010
class SocketsTest extends SocketSpyTestCase
1111
{
12-
public function setUp()
12+
public function set_up()
1313
{
14-
parent::setUp();
14+
parent::set_up();
1515

1616
// Reset the stubs for mt_rand() and mt_getrandmax()
1717
global $mt_rand_stub_return_value;

0 commit comments

Comments
 (0)