Skip to content

Cherrypick test fixes #127

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
May 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 19 additions & 4 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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:
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
7 changes: 3 additions & 4 deletions tests/TestHelpers/CurlSpyTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace DataDog\TestHelpers;

use PHPUnit\Framework\TestCase;
use Yoast\PHPUnitPolyfills\TestCases\TestCase;

$curlSpy = new CurlSpy();

Expand All @@ -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();
}

/**
Expand Down
6 changes: 3 additions & 3 deletions tests/TestHelpers/SocketSpyTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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();
}

/**
Expand Down
4 changes: 2 additions & 2 deletions tests/UnitTests/BatchedDogStatsdTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions tests/UnitTests/DogStatsd/SocketsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion tests/curl_and_error_log_function_stubs.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ function curl_init($url = null)

$curlSpy->curlInitWasCalledWithArg($url);

$resource = fopen('/dev/null', 'r');
$resource = tmpfile();

$curlSpy->curlInitDidReturn($resource);

Expand Down
2 changes: 1 addition & 1 deletion tests/socket_function_stubs.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down