Skip to content
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

chore: add support for PHPUnit 8 #5252

Merged
merged 11 commits into from
May 13, 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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 2 additions & 2 deletions .github/emulator/start-emulator.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/bin/sh -eux

docker pull -q gcr.io/google.com/cloudsdktool/cloud-sdk:342.0.0-emulators
docker pull -q gcr.io/google.com/cloudsdktool/cloud-sdk:384.0.1-emulators
CONTAINER=`docker run \
-d \
-p 8085:8085 \
gcr.io/google.com/cloudsdktool/cloud-sdk:342.0.0-emulators gcloud beta emulators $1 start --host-port=0.0.0.0:8085 --project=emulator-project`
gcr.io/google.com/cloudsdktool/cloud-sdk:384.0.1-emulators gcloud beta emulators $1 start --host-port=0.0.0.0:8085 --project=emulator-project`
sleep 10
docker logs $CONTAINER
4 changes: 3 additions & 1 deletion .github/workflows/bigtable-emulator-system-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ jobs:

- name: Install dependencies
run: |
composer update --prefer-dist --no-interaction --no-suggest -d Bigtable/
composer config minimum-stability dev -d Bigtable/
composer config repositories.local path "../Core" -d Bigtable
composer require "google/cloud-core:*" -d Bigtable/
Copy link
Contributor Author

@bshaffer bshaffer May 5, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These additional lines make sure that the tests run the emulator using the current branch for the google/cloud-core dependency, instead of using a tagged version. This is required for this PR because we made changes in Core that these tests need to pass.


- name: Run system tests
run: |
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/datastore-emulator-system-tests.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
name: Run Datastore System Tests With Emulator
on:
push:
branches:
Expand All @@ -7,7 +8,6 @@ on:
pull_request:
paths:
- 'Datastore/**'
name: Run Datastore System Tests With Emulator
jobs:
test:
runs-on: ubuntu-latest
Expand All @@ -26,7 +26,9 @@ jobs:

- name: Install dependencies
run: |
composer update --prefer-dist --no-interaction --no-suggest -d Datastore/
composer config minimum-stability dev -d Datastore/
composer config repositories.local path "../Core" -d Datastore
composer require "google/cloud-core:*" -d Datastore/

- name: Run system tests
run: |
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/firestore-emulator-system-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ jobs:

- name: Install dependencies
run: |
composer update --prefer-dist --no-interaction --no-suggest -d Firestore/
composer config minimum-stability dev -d Firestore/
composer config repositories.local path "../Core" -d Firestore
composer require "google/cloud-core:*" -d Firestore/

- name: Run system tests
run: |
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/pubsub-emulator-system-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,13 @@ jobs:
with:
php-version: '7.4'
tools: pecl
extensions: grpc-1.38.0
extensions: grpc

- name: Install dependencies
run: |
composer update --prefer-dist --no-interaction --no-suggest -d PubSub/
composer config minimum-stability dev -d PubSub/
composer config repositories.local path "../Core" -d PubSub
composer require "google/cloud-core:*" -d PubSub/

- name: Run system tests
run: |
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/spanner-emulator-system-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
- 'Spanner/**'
name: Run Spanner System Tests With Emulator
jobs:
php-test:
test:
runs-on: ubuntu-latest

services:
Expand Down Expand Up @@ -39,10 +39,12 @@ jobs:
with:
php-version: '7.4'
tools: pecl
extensions: bcmath, grpc-1.37.1
extensions: bcmath, grpc

- name: Install dependencies
run: |
composer config minimum-stability dev -d Spanner/
composer config repositories.local --json '{"type":"path", "url": "../Core", "options": {"versions": {"google/cloud-core": "1.45"}}}' -d Spanner
dwsupplee marked this conversation as resolved.
Show resolved Hide resolved
composer update --prefer-dist --no-interaction --no-suggest -d Spanner/

- name: Run system tests
Expand Down
3 changes: 2 additions & 1 deletion AccessApproval/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
"google/gax": "^1.7.0"
},
"require-dev": {
"phpunit/phpunit": "^4.8|^5.0",
"phpunit/phpunit": "^4.8|^5.0|^8.0",
"yoast/phpunit-polyfills": "^1.0",
"phpdocumentor/reflection": "^3.0"
},
"suggest": {
Expand Down
3 changes: 2 additions & 1 deletion AccessContextManager/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
"google/gax": "^1.8.0"
},
"require-dev": {
"phpunit/phpunit": "^4.8|^5.0",
"phpunit/phpunit": "^4.8|^5.0|^8.0",
"yoast/phpunit-polyfills": "^1.0",
"phpdocumentor/reflection": "^3.0"
},
"conflict": {
Expand Down
3 changes: 2 additions & 1 deletion AiPlatform/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
"google/gax": "^1.12.0"
},
"require-dev": {
"phpunit/phpunit": "^4.8|^5.0",
"phpunit/phpunit": "^4.8|^5.0|^8.0",
"yoast/phpunit-polyfills": "^1.0",
"phpdocumentor/reflection": "^3.0"
},
"suggest": {
Expand Down
3 changes: 2 additions & 1 deletion AnalyticsAdmin/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
"google/gax": "^1.6.0"
},
"require-dev": {
"phpunit/phpunit": "^4.8|^5.0",
"phpunit/phpunit": "^4.8|^5.0|^8.0",
"yoast/phpunit-polyfills": "^1.0",
"phpdocumentor/reflection": "^3.0"
},
"suggest": {
Expand Down
3 changes: 2 additions & 1 deletion AnalyticsData/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
"google/gax": "^1.6.0"
},
"require-dev": {
"phpunit/phpunit": "^4.8|^5.0",
"phpunit/phpunit": "^4.8|^5.0|^8.0",
"yoast/phpunit-polyfills": "^1.0",
"phpdocumentor/reflection": "^3.0"
},
"suggest": {
Expand Down
3 changes: 2 additions & 1 deletion ApiGateway/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
"google/gax": "^1.7.0"
},
"require-dev": {
"phpunit/phpunit": "^4.8|^5.0",
"phpunit/phpunit": "^4.8|^5.0|^8.0",
"yoast/phpunit-polyfills": "^1.0",
"phpdocumentor/reflection": "^3.0"
},
"suggest": {
Expand Down
3 changes: 2 additions & 1 deletion ApigeeConnect/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
"google/gax": "^1.7.0"
},
"require-dev": {
"phpunit/phpunit": "^4.8|^5.0",
"phpunit/phpunit": "^4.8|^5.0|^8.0",
"yoast/phpunit-polyfills": "^1.0",
"phpdocumentor/reflection": "^3.0"
},
"suggest": {
Expand Down
3 changes: 2 additions & 1 deletion AppEngineAdmin/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
"google/gax": "^1.7.0"
},
"require-dev": {
"phpunit/phpunit": "^4.8|^5.0",
"phpunit/phpunit": "^4.8|^5.0|^8.0",
"yoast/phpunit-polyfills": "^1.0",
"phpdocumentor/reflection": "^3.0"
},
"suggest": {
Expand Down
3 changes: 2 additions & 1 deletion ArtifactRegistry/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
"google/gax": "^1.7.0"
},
"require-dev": {
"phpunit/phpunit": "^4.8|^5.0",
"phpunit/phpunit": "^4.8|^5.0|^8.0",
"yoast/phpunit-polyfills": "^1.0",
"phpdocumentor/reflection": "^3.0"
},
"suggest": {
Expand Down
3 changes: 2 additions & 1 deletion Asset/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
"google/cloud-osconfig": "^0.5"
},
"require-dev": {
"phpunit/phpunit": "^4.8|^5.0",
"phpunit/phpunit": "^4.8|^5.0|^8.0",
"yoast/phpunit-polyfills": "^1.0",
"google/cloud-core": "^1.39",
"phpdocumentor/reflection": "^3.0"
},
Expand Down
3 changes: 2 additions & 1 deletion AssuredWorkloads/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
"google/gax": "^1.6.0"
},
"require-dev": {
"phpunit/phpunit": "^4.8|^5.0",
"phpunit/phpunit": "^4.8|^5.0|^8.0",
"yoast/phpunit-polyfills": "^1.0",
"phpdocumentor/reflection": "^3.0"
},
"suggest": {
Expand Down
3 changes: 2 additions & 1 deletion AutoMl/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
"google/gax": "^1.1"
},
"require-dev": {
"phpunit/phpunit": "^4.8|^5.0",
"phpunit/phpunit": "^4.8|^5.0|^8.0",
"yoast/phpunit-polyfills": "^1.0",
"google/cloud-core": "^1.39",
"phpdocumentor/reflection": "^3.0"
},
Expand Down
2 changes: 1 addition & 1 deletion AutoMl/tests/System/V1/AutoMlSmokeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class AutoMlSmokeTest extends SystemTestCase
private static $location = 'us-central1';
private static $hasSetUp = false;

public static function setUpBeforeClass()
public static function set_up_before_class()
{
if (self::$hasSetUp) {
return;
Expand Down
4 changes: 2 additions & 2 deletions AutoMl/tests/System/V1beta1/AutoMlSmokeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class AutoMlSmokeTest extends SystemTestCase
private static $location = 'us-central1';
private static $hasSetUp = false;

public static function setUpBeforeClass()
public static function set_up_before_class()
{
if (self::$hasSetUp) {
return;
Expand Down Expand Up @@ -88,7 +88,7 @@ public function testAutoMl(AutoMlClient $automl)

public function clientsProvider()
{
self::setUpBeforeClass();
self::set_up_before_class();
return self::$clients;
}
}
3 changes: 2 additions & 1 deletion BigQuery/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"ramsey/uuid": "^3.0|^4.0"
},
"require-dev": {
"phpunit/phpunit": "^4.8|^5.0",
"phpunit/phpunit": "^4.8|^5.0|^8.0",
"yoast/phpunit-polyfills": "^1.0",
"squizlabs/php_codesniffer": "2.*",
"phpdocumentor/reflection": "^3.0",
"erusev/parsedown": "^1.6",
Expand Down
2 changes: 1 addition & 1 deletion BigQuery/phpunit-snippets.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<phpunit
bootstrap="./vendor/google/cloud-core/snippet-bootstrap.php"
colors="true"
printerClass="Google\Cloud\Core\Testing\Snippet\Coverage\ResultPrinter">
>
<testsuites>
<testsuite>
<directory>tests/Snippet</directory>
Expand Down
4 changes: 2 additions & 2 deletions BigQuery/tests/Perf/BigQueryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
namespace Google\Cloud\BigQuery\Tests\Perf;

use Google\Cloud\BigQuery\BigQueryClient;
use PHPUnit\Framework\TestCase;
use Yoast\PHPUnitPolyfills\TestCases\TestCase;

/**
* @group bigquery
Expand All @@ -29,7 +29,7 @@ class BigQueryTest extends TestCase

private $client;

public function setUp()
public function set_up()
{
$keyFilePath = getenv('GOOGLE_CLOUD_PHP_TESTS_KEY_PATH');
$this->client = new BigQueryClient([
Expand Down
2 changes: 1 addition & 1 deletion BigQuery/tests/Snippet/BigQueryClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class BigQueryClientTest extends SnippetTestCase
]
];

public function setUp()
public function set_up()
{
$this->connection = $this->prophesize(ConnectionInterface::class);
$this->client = TestHelpers::stub(BigQueryTestClient::class);
Expand Down
2 changes: 1 addition & 1 deletion BigQuery/tests/Snippet/CopyJobConfigurationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class CopyJobConfigurationTest extends SnippetTestCase

private $config;

public function setUp()
public function set_up()
{
$this->config = new CopyJobConfiguration(
self::PROJECT_ID,
Expand Down
2 changes: 1 addition & 1 deletion BigQuery/tests/Snippet/DatasetTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class DatasetTest extends SnippetTestCase
private $connection;
private $mapper;

public function setUp()
public function set_up()
{
$this->mapper = new ValueMapper(false);
$this->identity = ['datasetId' => 'id', 'projectId' => 'projectId'];
Expand Down
2 changes: 1 addition & 1 deletion BigQuery/tests/Snippet/ExtractJobConfigurationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class ExtractJobConfigurationTest extends SnippetTestCase

private $config;

public function setUp()
public function set_up()
{
$this->config = new ExtractJobConfiguration(
self::PROJECT_ID,
Expand Down
2 changes: 1 addition & 1 deletion BigQuery/tests/Snippet/InsertResponseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class InsertResponseTest extends SnippetTestCase
]
];

public function setUp()
public function set_up()
{
$this->insertResponse = new InsertResponse($this->info, $this->rows);
}
Expand Down
2 changes: 1 addition & 1 deletion BigQuery/tests/Snippet/JobTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class JobTest extends SnippetTestCase
private $identity;
private $connection;

public function setUp()
public function set_up()
{
$this->identity = ['jobId' => 'id', 'projectId' => 'projectId'];
$this->connection = $this->prophesize(ConnectionInterface::class);
Expand Down
2 changes: 1 addition & 1 deletion BigQuery/tests/Snippet/LoadJobConfigurationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class LoadJobConfigurationTest extends SnippetTestCase

private $config;

public function setUp()
public function set_up()
{
$this->config = new LoadJobConfiguration(
self::PROJECT_ID,
Expand Down
2 changes: 1 addition & 1 deletion BigQuery/tests/Snippet/ModelTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class ModelTest extends SnippetTestCase
const MODEL_ID = 'myModelId';
const JOB_ID = 'myJob';

public function setUp()
public function set_up()
{
$this->connection = $this->prophesize(ConnectionInterface::class);
$this->model = TestHelpers::stub(Model::class, [
Expand Down
2 changes: 1 addition & 1 deletion BigQuery/tests/Snippet/QueryJobConfigurationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class QueryJobConfigurationTest extends SnippetTestCase

private $config;

public function setUp()
public function set_up()
{
$this->config = new QueryJobConfiguration(
new ValueMapper(false),
Expand Down
2 changes: 1 addition & 1 deletion BigQuery/tests/Snippet/QueryResultsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class QueryResultsTest extends SnippetTestCase
private $connection;
private $qr;

public function setUp()
public function set_up()
{
$this->info = [
'totalBytesProcessed' => 3,
Expand Down
2 changes: 1 addition & 1 deletion BigQuery/tests/Snippet/RoutineTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class RoutineTest extends SnippetTestCase
private $routine;
private $identity;

public function setUp()
public function set_up()
{
$this->connection = $this->prophesize(ConnectionInterface::class);
$this->identity = [
Expand Down
2 changes: 1 addition & 1 deletion BigQuery/tests/Snippet/TableTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class TableTest extends SnippetTestCase
private $table;
private $mapper;

public function setUp()
public function set_up()
{
$this->info = [
'rows' => [
Expand Down
2 changes: 1 addition & 1 deletion BigQuery/tests/System/BigQueryTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class BigQueryTestCase extends SystemTestCase
protected static $table;
private static $hasSetUp = false;

public static function setUpBeforeClass()
public static function set_up_before_class()
{
if (self::$hasSetUp) {
return;
Expand Down
Loading