diff --git a/.circleci/config.yml b/.circleci/config.yml index 371c526..6549dfb 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,6 +1,6 @@ version: 2 # use CircleCI 2.0 -x-dockerbuild-7: &dockerbuild-7 +x-dockerbuild-phpdbg: &dockerbuild-phpdbg steps: - checkout - run: sudo docker-php-ext-install sockets @@ -19,16 +19,28 @@ x-dockerbuild-5: &dockerbuild-5 - run: composer lint jobs: + test-8.0: + <<: *dockerbuild-phpdbg + docker: + - image: circleci/php:8.0-node-browsers + test-7.4: + <<: *dockerbuild-phpdbg + docker: + - image: circleci/php:7.4-node-browsers + test-7.3: + <<: *dockerbuild-phpdbg + docker: + - image: circleci/php:7.3-node-browsers test-7.2: - <<: *dockerbuild-7 + <<: *dockerbuild-phpdbg docker: - image: circleci/php:7.2-node-browsers test-7.1: - <<: *dockerbuild-7 + <<: *dockerbuild-phpdbg docker: - image: circleci/php:7.1-node-browsers test-7.0: - <<: *dockerbuild-7 + <<: *dockerbuild-phpdbg docker: - image: circleci/php:7.0-node-browsers test-5.6: @@ -40,6 +52,9 @@ workflows: version: 2 check_compile: jobs: + - test-8.0 + - test-7.4 + - test-7.3 - test-7.2 - test-7.1 - test-7.0 diff --git a/composer.json b/composer.json index 0879208..df52530 100644 --- a/composer.json +++ b/composer.json @@ -49,7 +49,7 @@ "sort-packages": true }, "require-dev": { - "phpunit/phpunit": "5.7.27", + "yoast/phpunit-polyfills": "^1.0.1", "squizlabs/php_codesniffer": "^3.3" }, "scripts": { diff --git a/tests/TestHelpers/CurlSpyTestCase.php b/tests/TestHelpers/CurlSpyTestCase.php index 050afcf..09f6e2f 100644 --- a/tests/TestHelpers/CurlSpyTestCase.php +++ b/tests/TestHelpers/CurlSpyTestCase.php @@ -2,7 +2,7 @@ namespace DataDog\TestHelpers; -use PHPUnit\Framework\TestCase; +use Yoast\PHPUnitPolyfills\TestCases\TestCase; $curlSpy = new CurlSpy(); @@ -11,13 +11,12 @@ class CurlSpyTestCase extends TestCase /** * Set up a spy object to capture calls to built in curl functions */ - protected function setUp() + protected function set_up() { global $curlSpy; $curlSpy = new CurlSpy(); - - parent::setUp(); + parent::set_up(); } /** diff --git a/tests/TestHelpers/SocketSpyTestCase.php b/tests/TestHelpers/SocketSpyTestCase.php index 24b1514..7b85dda 100644 --- a/tests/TestHelpers/SocketSpyTestCase.php +++ b/tests/TestHelpers/SocketSpyTestCase.php @@ -3,7 +3,7 @@ namespace DataDog\TestHelpers; use DataDog\DogStatsd; -use PHPUnit\Framework\TestCase; +use Yoast\PHPUnitPolyfills\TestCases\TestCase; /** * Making this variable global to this file is necessary for interacting with @@ -24,13 +24,13 @@ class SocketSpyTestCase extends TestCase /** * Set up a spy object to capture calls to global built in socket functions */ - protected function setUp() + protected function set_up() { global $socketSpy; $socketSpy = new SocketSpy(); - parent::setUp(); + parent::set_up(); } /** diff --git a/tests/UnitTests/BatchedDogStatsdTest.php b/tests/UnitTests/BatchedDogStatsdTest.php index ae707de..7594d91 100644 --- a/tests/UnitTests/BatchedDogStatsdTest.php +++ b/tests/UnitTests/BatchedDogStatsdTest.php @@ -8,9 +8,9 @@ class BatchedDogStatsdTest extends SocketSpyTestCase { - protected function setUp() + protected function set_up() { - parent::setUp(); + parent::set_up(); // Flush the buffer to reset state for next test BatchedDogStatsd::$maxBufferLength = 50; diff --git a/tests/UnitTests/DogStatsd/SocketsTest.php b/tests/UnitTests/DogStatsd/SocketsTest.php index f9443b4..ee7ce97 100644 --- a/tests/UnitTests/DogStatsd/SocketsTest.php +++ b/tests/UnitTests/DogStatsd/SocketsTest.php @@ -9,9 +9,9 @@ class SocketsTest extends SocketSpyTestCase { - public function setUp() + public function set_up() { - parent::setUp(); + parent::set_up(); // Reset the stubs for mt_rand() and mt_getrandmax() global $mt_rand_stub_return_value; diff --git a/tests/curl_and_error_log_function_stubs.php b/tests/curl_and_error_log_function_stubs.php index 4d964a4..ebf7c64 100644 --- a/tests/curl_and_error_log_function_stubs.php +++ b/tests/curl_and_error_log_function_stubs.php @@ -24,7 +24,7 @@ function curl_init($url = null) $curlSpy->curlInitWasCalledWithArg($url); - $resource = fopen('/dev/null', 'r'); + $resource = tmpfile(); $curlSpy->curlInitDidReturn($resource); diff --git a/tests/socket_function_stubs.php b/tests/socket_function_stubs.php index cc2c7d7..554f877 100644 --- a/tests/socket_function_stubs.php +++ b/tests/socket_function_stubs.php @@ -29,7 +29,7 @@ function socket_create($domain, $type, $protocol) // A PHP resource of unimportance, useful primarily to assert that our stubs // of the global socket functions return or take a deterministic value. - $resource = fopen('/dev/null', 'r'); + $resource = tmpfile(); $socketSpy->socketCreateDidReturn($resource);