From 81438061a0bc48e8743e3382dbc61efe36014656 Mon Sep 17 00:00:00 2001 From: Michael Bausor Date: Fri, 22 Dec 2017 15:10:14 -0800 Subject: [PATCH 01/36] manual changes --- composer.json | 4 ++-- {tests => src/Core/Testing}/ArrayHasSameValuesToken.php | 2 +- {dev/src => src/Core/Testing}/Functions.php | 2 +- {tests => src/Core/Testing}/GrpcTestTrait.php | 2 +- {tests => src/Core/Testing}/KeyPairGenerateTrait.php | 2 +- {dev/src => src/Core/Testing}/Snippet/SnippetTestCase.php | 2 +- {tests/system => src/Core/Testing/System}/DeletionQueue.php | 2 +- {tests/system => src/Core/Testing/System}/SystemTestCase.php | 2 +- tests/unit/Core/GrpcRequestWrapperTest.php | 2 +- tests/unit/Core/GrpcTraitTest.php | 2 +- tests/unit/Core/ServiceBuilderTest.php | 2 +- tests/unit/Firestore/CollectionReferenceTest.php | 2 +- tests/unit/Firestore/Connection/GrpcTest.php | 2 +- 13 files changed, 14 insertions(+), 14 deletions(-) rename {tests => src/Core/Testing}/ArrayHasSameValuesToken.php (96%) rename {dev/src => src/Core/Testing}/Functions.php (97%) rename {tests => src/Core/Testing}/GrpcTestTrait.php (96%) rename {tests => src/Core/Testing}/KeyPairGenerateTrait.php (97%) rename {dev/src => src/Core/Testing}/Snippet/SnippetTestCase.php (98%) rename {tests/system => src/Core/Testing/System}/DeletionQueue.php (98%) rename {tests/system => src/Core/Testing/System}/SystemTestCase.php (99%) diff --git a/composer.json b/composer.json index e80aba0f5e66..d48ec384e4d9 100644 --- a/composer.json +++ b/composer.json @@ -104,7 +104,7 @@ "Google\\Cloud\\Tests\\Unit\\": "tests/unit" }, "files": [ - "dev/src/Functions.php" + "src/Core/Testing/Functions.php" ], "classmap": [ "tests/conformance-fixtures" @@ -127,4 +127,4 @@ ] } } -} \ No newline at end of file +} diff --git a/tests/ArrayHasSameValuesToken.php b/src/Core/Testing/ArrayHasSameValuesToken.php similarity index 96% rename from tests/ArrayHasSameValuesToken.php rename to src/Core/Testing/ArrayHasSameValuesToken.php index 2a5b5f622604..5472aafebf04 100644 --- a/tests/ArrayHasSameValuesToken.php +++ b/src/Core/Testing/ArrayHasSameValuesToken.php @@ -1,6 +1,6 @@ prophesize(ConnectionInterface::class); - $collection = \Google\Cloud\Dev\stub(CollectionReference::class, [ + $collection = \Google\Cloud\Core\Testing\stub(CollectionReference::class, [ $connection->reveal(), new ValueMapper($connection->reveal(), false), self::NAME diff --git a/tests/unit/Firestore/Connection/GrpcTest.php b/tests/unit/Firestore/Connection/GrpcTest.php index 12a2a4a7743d..4440f6089861 100644 --- a/tests/unit/Firestore/Connection/GrpcTest.php +++ b/tests/unit/Firestore/Connection/GrpcTest.php @@ -19,8 +19,8 @@ use Google\Cloud\Core\GrpcRequestWrapper; use Google\Cloud\Core\GrpcTrait; +use Google\Cloud\Core\Testing\GrpcTestTrait; use Google\Cloud\Firestore\Connection\Grpc; -use Google\Cloud\Tests\GrpcTestTrait; use Google\Cloud\Firestore\V1beta1\Document; use Google\Cloud\Firestore\V1beta1\DocumentMask; use Google\Cloud\Firestore\V1beta1\Precondition; From d7742e435f090948579ee8ec93277bed95e9f95e Mon Sep 17 00:00:00 2001 From: Michael Bausor Date: Fri, 22 Dec 2017 15:10:25 -0800 Subject: [PATCH 02/36] Grpc trait rename --- tests/snippets/Firestore/CollectionReferenceTest.php | 2 +- tests/snippets/Firestore/DocumentReferenceTest.php | 2 +- tests/snippets/Firestore/DocumentSnapshotTest.php | 2 +- tests/snippets/Firestore/FieldPathTest.php | 2 +- tests/snippets/Firestore/FieldValueTest.php | 2 +- tests/snippets/Firestore/FirestoreClientTest.php | 2 +- tests/snippets/Firestore/QuerySnapshotTest.php | 2 +- tests/snippets/Firestore/QueryTest.php | 2 +- tests/snippets/Firestore/TransactionTest.php | 2 +- tests/snippets/Firestore/WriteBatchTest.php | 2 +- tests/snippets/Spanner/BytesTest.php | 2 +- tests/snippets/Spanner/DatabaseTest.php | 2 +- tests/snippets/Spanner/DateTest.php | 2 +- tests/snippets/Spanner/DurationTest.php | 2 +- tests/snippets/Spanner/InstanceConfigurationTest.php | 2 +- tests/snippets/Spanner/InstanceTest.php | 2 +- tests/snippets/Spanner/KeyRangeTest.php | 2 +- tests/snippets/Spanner/KeySetTest.php | 2 +- tests/snippets/Spanner/ResultTest.php | 2 +- tests/snippets/Spanner/SnapshotTest.php | 2 +- tests/snippets/Spanner/SpannerClientTest.php | 2 +- tests/snippets/Spanner/TimestampTest.php | 2 +- tests/snippets/Spanner/TransactionTest.php | 2 +- tests/unit/Firestore/FirestoreClientTest.php | 2 +- tests/unit/Logging/Connection/GrpcTest.php | 2 +- tests/unit/Logging/LoggingClientTest.php | 2 +- tests/unit/PubSub/Connection/GrpcTest.php | 2 +- tests/unit/PubSub/PubSubClientTest.php | 2 +- tests/unit/Spanner/BytesTest.php | 2 +- tests/unit/Spanner/Connection/GrpcTest.php | 2 +- tests/unit/Spanner/DatabaseTest.php | 2 +- tests/unit/Spanner/DateTest.php | 2 +- tests/unit/Spanner/InstanceConfigurationTest.php | 2 +- tests/unit/Spanner/InstanceTest.php | 2 +- tests/unit/Spanner/KeyRangeTest.php | 2 +- tests/unit/Spanner/OperationTest.php | 2 +- tests/unit/Spanner/ResultTest.php | 2 +- tests/unit/Spanner/Session/CacheSessionPoolTest.php | 2 +- tests/unit/Spanner/SnapshotTest.php | 2 +- tests/unit/Spanner/SpannerClientTest.php | 2 +- tests/unit/Spanner/TimestampTest.php | 2 +- tests/unit/Spanner/TransactionConfigurationTraitTest.php | 2 +- tests/unit/Spanner/TransactionTest.php | 2 +- tests/unit/Spanner/TransactionTypeTest.php | 2 +- tests/unit/Spanner/ValueMapperTest.php | 2 +- 45 files changed, 45 insertions(+), 45 deletions(-) diff --git a/tests/snippets/Firestore/CollectionReferenceTest.php b/tests/snippets/Firestore/CollectionReferenceTest.php index 0f9d084b0b8a..5f3cbdf20405 100644 --- a/tests/snippets/Firestore/CollectionReferenceTest.php +++ b/tests/snippets/Firestore/CollectionReferenceTest.php @@ -19,7 +19,7 @@ use Prophecy\Argument; use Google\Cloud\Firestore\Query; -use Google\Cloud\Tests\GrpcTestTrait; +use Google\Cloud\Core\Testing\GrpcTestTrait; use Google\Cloud\Firestore\ValueMapper; use Google\Cloud\Dev\Snippet\SnippetTestCase; use Google\Cloud\Firestore\DocumentReference; diff --git a/tests/snippets/Firestore/DocumentReferenceTest.php b/tests/snippets/Firestore/DocumentReferenceTest.php index 1f00c4598be7..91217fe4f10e 100644 --- a/tests/snippets/Firestore/DocumentReferenceTest.php +++ b/tests/snippets/Firestore/DocumentReferenceTest.php @@ -26,7 +26,7 @@ use Google\Cloud\Firestore\FirestoreClient; use Google\Cloud\Firestore\ValueMapper; use Google\Cloud\Firestore\WriteBatch; -use Google\Cloud\Tests\GrpcTestTrait; +use Google\Cloud\Core\Testing\GrpcTestTrait; use Prophecy\Argument; /** diff --git a/tests/snippets/Firestore/DocumentSnapshotTest.php b/tests/snippets/Firestore/DocumentSnapshotTest.php index 6fcd2fa2299d..86b6e34b89fe 100644 --- a/tests/snippets/Firestore/DocumentSnapshotTest.php +++ b/tests/snippets/Firestore/DocumentSnapshotTest.php @@ -24,7 +24,7 @@ use Google\Cloud\Firestore\DocumentSnapshot; use Google\Cloud\Firestore\FirestoreClient; use Google\Cloud\Firestore\ValueMapper; -use Google\Cloud\Tests\GrpcTestTrait; +use Google\Cloud\Core\Testing\GrpcTestTrait; use Prophecy\Argument; /** diff --git a/tests/snippets/Firestore/FieldPathTest.php b/tests/snippets/Firestore/FieldPathTest.php index a4320d62a904..ffef6e60d4c4 100644 --- a/tests/snippets/Firestore/FieldPathTest.php +++ b/tests/snippets/Firestore/FieldPathTest.php @@ -18,7 +18,7 @@ namespace Google\Cloud\Tests\Snippets\Firestore; use Google\Cloud\Firestore\FieldPath; -use Google\Cloud\Tests\GrpcTestTrait; +use Google\Cloud\Core\Testing\GrpcTestTrait; use Google\Cloud\Dev\Snippet\SnippetTestCase; /** diff --git a/tests/snippets/Firestore/FieldValueTest.php b/tests/snippets/Firestore/FieldValueTest.php index 1d4bbb7c3e60..2e48fa9fb5ae 100644 --- a/tests/snippets/Firestore/FieldValueTest.php +++ b/tests/snippets/Firestore/FieldValueTest.php @@ -18,7 +18,7 @@ namespace Google\Cloud\Tests\Snippets\Firestore; use Prophecy\Argument; -use Google\Cloud\Tests\GrpcTestTrait; +use Google\Cloud\Core\Testing\GrpcTestTrait; use Google\Cloud\Firestore\FieldValue; use Google\Cloud\Firestore\FirestoreClient; use Google\Cloud\Dev\Snippet\SnippetTestCase; diff --git a/tests/snippets/Firestore/FirestoreClientTest.php b/tests/snippets/Firestore/FirestoreClientTest.php index 95675edbefe1..90333f7eb47a 100644 --- a/tests/snippets/Firestore/FirestoreClientTest.php +++ b/tests/snippets/Firestore/FirestoreClientTest.php @@ -21,7 +21,7 @@ use Google\Cloud\Core\Blob; use Google\Cloud\Core\GeoPoint; use Google\Cloud\Firestore\FieldPath; -use Google\Cloud\Tests\GrpcTestTrait; +use Google\Cloud\Core\Testing\GrpcTestTrait; use Google\Cloud\Firestore\WriteBatch; use Google\Cloud\Firestore\Transaction; use Google\Cloud\Firestore\FirestoreClient; diff --git a/tests/snippets/Firestore/QuerySnapshotTest.php b/tests/snippets/Firestore/QuerySnapshotTest.php index ae6acd5648c5..71e6df78f2a1 100644 --- a/tests/snippets/Firestore/QuerySnapshotTest.php +++ b/tests/snippets/Firestore/QuerySnapshotTest.php @@ -23,7 +23,7 @@ use Google\Cloud\Firestore\Query; use Google\Cloud\Firestore\QuerySnapshot; use Google\Cloud\Firestore\ValueMapper; -use Google\Cloud\Tests\GrpcTestTrait; +use Google\Cloud\Core\Testing\GrpcTestTrait; use Prophecy\Argument; /** diff --git a/tests/snippets/Firestore/QueryTest.php b/tests/snippets/Firestore/QueryTest.php index 94820873f466..12382dc0706d 100644 --- a/tests/snippets/Firestore/QueryTest.php +++ b/tests/snippets/Firestore/QueryTest.php @@ -19,7 +19,7 @@ use Prophecy\Argument; use Google\Cloud\Firestore\Query; -use Google\Cloud\Tests\GrpcTestTrait; +use Google\Cloud\Core\Testing\GrpcTestTrait; use Google\Cloud\Firestore\ValueMapper; use Google\Cloud\Firestore\QuerySnapshot; use Google\Cloud\Dev\Snippet\Parser\Snippet; diff --git a/tests/snippets/Firestore/TransactionTest.php b/tests/snippets/Firestore/TransactionTest.php index 9a8b02077fda..fb956d7513ba 100644 --- a/tests/snippets/Firestore/TransactionTest.php +++ b/tests/snippets/Firestore/TransactionTest.php @@ -29,7 +29,7 @@ use Google\Cloud\Firestore\Transaction; use Google\Cloud\Firestore\ValueMapper; use Google\Cloud\Firestore\WriteBatch; -use Google\Cloud\Tests\GrpcTestTrait; +use Google\Cloud\Core\Testing\GrpcTestTrait; use Prophecy\Argument; /** diff --git a/tests/snippets/Firestore/WriteBatchTest.php b/tests/snippets/Firestore/WriteBatchTest.php index 46c5b5ca3cfd..ec6722d9a7fe 100644 --- a/tests/snippets/Firestore/WriteBatchTest.php +++ b/tests/snippets/Firestore/WriteBatchTest.php @@ -22,7 +22,7 @@ use Google\Cloud\Firestore\Connection\ConnectionInterface; use Google\Cloud\Firestore\ValueMapper; use Google\Cloud\Firestore\WriteBatch; -use Google\Cloud\Tests\GrpcTestTrait; +use Google\Cloud\Core\Testing\GrpcTestTrait; use Google\Cloud\Firestore\V1beta1\DocumentTransform_FieldTransform_ServerValue; use Prophecy\Argument; diff --git a/tests/snippets/Spanner/BytesTest.php b/tests/snippets/Spanner/BytesTest.php index e629d8caa87f..e324b40816c6 100644 --- a/tests/snippets/Spanner/BytesTest.php +++ b/tests/snippets/Spanner/BytesTest.php @@ -21,7 +21,7 @@ use Google\Cloud\Spanner\Bytes; use Google\Cloud\Spanner\Database; use Google\Cloud\Spanner\ValueMapper; -use Google\Cloud\Tests\GrpcTestTrait; +use Google\Cloud\Core\Testing\GrpcTestTrait; use Psr\Http\Message\StreamInterface; /** diff --git a/tests/snippets/Spanner/DatabaseTest.php b/tests/snippets/Spanner/DatabaseTest.php index 5218e566b56f..62a9b3589765 100644 --- a/tests/snippets/Spanner/DatabaseTest.php +++ b/tests/snippets/Spanner/DatabaseTest.php @@ -36,7 +36,7 @@ use Google\Cloud\Spanner\Timestamp; use Google\Cloud\Spanner\Transaction; use Google\Cloud\Spanner\ValueMapper; -use Google\Cloud\Tests\GrpcTestTrait; +use Google\Cloud\Core\Testing\GrpcTestTrait; use Prophecy\Argument; /** diff --git a/tests/snippets/Spanner/DateTest.php b/tests/snippets/Spanner/DateTest.php index f0365a7bd667..83993bfbca7a 100644 --- a/tests/snippets/Spanner/DateTest.php +++ b/tests/snippets/Spanner/DateTest.php @@ -21,7 +21,7 @@ use Google\Cloud\Spanner\Database; use Google\Cloud\Spanner\Date; use Google\Cloud\Spanner\ValueMapper; -use Google\Cloud\Tests\GrpcTestTrait; +use Google\Cloud\Core\Testing\GrpcTestTrait; /** * @group spanner diff --git a/tests/snippets/Spanner/DurationTest.php b/tests/snippets/Spanner/DurationTest.php index 308ffc8965fd..7add2c7933ad 100644 --- a/tests/snippets/Spanner/DurationTest.php +++ b/tests/snippets/Spanner/DurationTest.php @@ -19,7 +19,7 @@ use Google\Cloud\Dev\Snippet\SnippetTestCase; use Google\Cloud\Spanner\Duration; -use Google\Cloud\Tests\GrpcTestTrait; +use Google\Cloud\Core\Testing\GrpcTestTrait; /** * @group spanner diff --git a/tests/snippets/Spanner/InstanceConfigurationTest.php b/tests/snippets/Spanner/InstanceConfigurationTest.php index fb32afff0131..44ad82307836 100644 --- a/tests/snippets/Spanner/InstanceConfigurationTest.php +++ b/tests/snippets/Spanner/InstanceConfigurationTest.php @@ -21,7 +21,7 @@ use Google\Cloud\Spanner\Admin\Instance\V1\InstanceAdminClient; use Google\Cloud\Spanner\Connection\ConnectionInterface; use Google\Cloud\Spanner\InstanceConfiguration; -use Google\Cloud\Tests\GrpcTestTrait; +use Google\Cloud\Core\Testing\GrpcTestTrait; use Prophecy\Argument; /** diff --git a/tests/snippets/Spanner/InstanceTest.php b/tests/snippets/Spanner/InstanceTest.php index 06c6fe9b74e8..111eaafe4a07 100644 --- a/tests/snippets/Spanner/InstanceTest.php +++ b/tests/snippets/Spanner/InstanceTest.php @@ -28,7 +28,7 @@ use Google\Cloud\Spanner\Database; use Google\Cloud\Spanner\Instance; use Google\Cloud\Spanner\InstanceConfiguration; -use Google\Cloud\Tests\GrpcTestTrait; +use Google\Cloud\Core\Testing\GrpcTestTrait; use Prophecy\Argument; /** diff --git a/tests/snippets/Spanner/KeyRangeTest.php b/tests/snippets/Spanner/KeyRangeTest.php index b342abf91d1e..8124f57b9677 100644 --- a/tests/snippets/Spanner/KeyRangeTest.php +++ b/tests/snippets/Spanner/KeyRangeTest.php @@ -19,7 +19,7 @@ use Google\Cloud\Dev\Snippet\SnippetTestCase; use Google\Cloud\Spanner\KeyRange; -use Google\Cloud\Tests\GrpcTestTrait; +use Google\Cloud\Core\Testing\GrpcTestTrait; /** * @group spanner diff --git a/tests/snippets/Spanner/KeySetTest.php b/tests/snippets/Spanner/KeySetTest.php index 4c0927287788..06698f78aed0 100644 --- a/tests/snippets/Spanner/KeySetTest.php +++ b/tests/snippets/Spanner/KeySetTest.php @@ -20,7 +20,7 @@ use Google\Cloud\Dev\Snippet\SnippetTestCase; use Google\Cloud\Spanner\KeyRange; use Google\Cloud\Spanner\KeySet; -use Google\Cloud\Tests\GrpcTestTrait; +use Google\Cloud\Core\Testing\GrpcTestTrait; /** * @group spanner diff --git a/tests/snippets/Spanner/ResultTest.php b/tests/snippets/Spanner/ResultTest.php index fb4e37cfb6d1..2e7e75630fae 100644 --- a/tests/snippets/Spanner/ResultTest.php +++ b/tests/snippets/Spanner/ResultTest.php @@ -26,7 +26,7 @@ use Google\Cloud\Spanner\SpannerClient; use Google\Cloud\Spanner\Transaction; use Google\Cloud\Spanner\ValueMapper; -use Google\Cloud\Tests\GrpcTestTrait; +use Google\Cloud\Core\Testing\GrpcTestTrait; use Prophecy\Argument; /** diff --git a/tests/snippets/Spanner/SnapshotTest.php b/tests/snippets/Spanner/SnapshotTest.php index 33fa77d086e0..d2af8b6eee25 100644 --- a/tests/snippets/Spanner/SnapshotTest.php +++ b/tests/snippets/Spanner/SnapshotTest.php @@ -28,7 +28,7 @@ use Google\Cloud\Spanner\SpannerClient; use Google\Cloud\Spanner\Timestamp; use Google\Cloud\Spanner\ValueMapper; -use Google\Cloud\Tests\GrpcTestTrait; +use Google\Cloud\Core\Testing\GrpcTestTrait; use Prophecy\Argument; /** diff --git a/tests/snippets/Spanner/SpannerClientTest.php b/tests/snippets/Spanner/SpannerClientTest.php index aace5adfb41b..594cb7eed464 100644 --- a/tests/snippets/Spanner/SpannerClientTest.php +++ b/tests/snippets/Spanner/SpannerClientTest.php @@ -33,7 +33,7 @@ use Google\Cloud\Spanner\KeySet; use Google\Cloud\Spanner\SpannerClient; use Google\Cloud\Spanner\Timestamp; -use Google\Cloud\Tests\GrpcTestTrait; +use Google\Cloud\Core\Testing\GrpcTestTrait; use Prophecy\Argument; /** diff --git a/tests/snippets/Spanner/TimestampTest.php b/tests/snippets/Spanner/TimestampTest.php index 63ad9b9fd0e0..dfdf14c2ac57 100644 --- a/tests/snippets/Spanner/TimestampTest.php +++ b/tests/snippets/Spanner/TimestampTest.php @@ -21,7 +21,7 @@ use Google\Cloud\Spanner\Database; use Google\Cloud\Spanner\Timestamp; use Google\Cloud\Spanner\ValueMapper; -use Google\Cloud\Tests\GrpcTestTrait; +use Google\Cloud\Core\Testing\GrpcTestTrait; /** * @group spanner diff --git a/tests/snippets/Spanner/TransactionTest.php b/tests/snippets/Spanner/TransactionTest.php index 0043e4c1dc4f..a533adbeca45 100644 --- a/tests/snippets/Spanner/TransactionTest.php +++ b/tests/snippets/Spanner/TransactionTest.php @@ -27,7 +27,7 @@ use Google\Cloud\Spanner\Timestamp; use Google\Cloud\Spanner\Transaction; use Google\Cloud\Spanner\ValueMapper; -use Google\Cloud\Tests\GrpcTestTrait; +use Google\Cloud\Core\Testing\GrpcTestTrait; use Prophecy\Argument; /** diff --git a/tests/unit/Firestore/FirestoreClientTest.php b/tests/unit/Firestore/FirestoreClientTest.php index ae05c976f0ac..8c9a57f43d2b 100644 --- a/tests/unit/Firestore/FirestoreClientTest.php +++ b/tests/unit/Firestore/FirestoreClientTest.php @@ -28,7 +28,7 @@ use Google\Cloud\Firestore\FieldPath; use Google\Cloud\Firestore\FirestoreClient; use Google\Cloud\Firestore\WriteBatch; -use Google\Cloud\Tests\GrpcTestTrait; +use Google\Cloud\Core\Testing\GrpcTestTrait; use PHPUnit\Framework\TestCase; use Prophecy\Argument; diff --git a/tests/unit/Logging/Connection/GrpcTest.php b/tests/unit/Logging/Connection/GrpcTest.php index 010df6e167c9..ad4c73cd4a55 100644 --- a/tests/unit/Logging/Connection/GrpcTest.php +++ b/tests/unit/Logging/Connection/GrpcTest.php @@ -18,7 +18,7 @@ namespace Google\Cloud\Tests\Unit\Logging\Connection; use Google\Cloud\Logging\Connection\Grpc; -use Google\Cloud\Tests\GrpcTestTrait; +use Google\Cloud\Core\Testing\GrpcTestTrait; use Google\Cloud\Core\GrpcRequestWrapper; use Google\ApiCore\Serializer; use Google\Cloud\Logging\V2\LogEntry; diff --git a/tests/unit/Logging/LoggingClientTest.php b/tests/unit/Logging/LoggingClientTest.php index cafd4c0fd28b..0f193a7b5fe8 100644 --- a/tests/unit/Logging/LoggingClientTest.php +++ b/tests/unit/Logging/LoggingClientTest.php @@ -24,7 +24,7 @@ use Google\Cloud\Logging\PsrLogger; use Google\Cloud\Logging\Sink; use Google\Cloud\Logging\Connection\ConnectionInterface; -use Google\Cloud\Tests\GrpcTestTrait; +use Google\Cloud\Core\Testing\GrpcTestTrait; use Prophecy\Argument; use PHPUnit\Framework\TestCase; diff --git a/tests/unit/PubSub/Connection/GrpcTest.php b/tests/unit/PubSub/Connection/GrpcTest.php index 10092a16712f..9b028ff960a1 100644 --- a/tests/unit/PubSub/Connection/GrpcTest.php +++ b/tests/unit/PubSub/Connection/GrpcTest.php @@ -20,7 +20,7 @@ use Google\Cloud\Core\GrpcRequestWrapper; use Google\Cloud\Core\GrpcTrait; use Google\Cloud\PubSub\Connection\Grpc; -use Google\Cloud\Tests\GrpcTestTrait; +use Google\Cloud\Core\Testing\GrpcTestTrait; use Google\ApiCore\Serializer; use Google\Protobuf\FieldMask; use Google\Protobuf\Timestamp; diff --git a/tests/unit/PubSub/PubSubClientTest.php b/tests/unit/PubSub/PubSubClientTest.php index c43041bb515b..2aa9294565ba 100644 --- a/tests/unit/PubSub/PubSubClientTest.php +++ b/tests/unit/PubSub/PubSubClientTest.php @@ -28,7 +28,7 @@ use Google\Cloud\PubSub\Snapshot; use Google\Cloud\PubSub\Subscription; use Google\Cloud\PubSub\Topic; -use Google\Cloud\Tests\GrpcTestTrait; +use Google\Cloud\Core\Testing\GrpcTestTrait; use Prophecy\Argument; use PHPUnit\Framework\TestCase; diff --git a/tests/unit/Spanner/BytesTest.php b/tests/unit/Spanner/BytesTest.php index 527bf3082c09..92ff09f42710 100644 --- a/tests/unit/Spanner/BytesTest.php +++ b/tests/unit/Spanner/BytesTest.php @@ -18,7 +18,7 @@ namespace Google\Cloud\Tests\Unit\Spanner; use Google\Cloud\Spanner\Bytes; -use Google\Cloud\Tests\GrpcTestTrait; +use Google\Cloud\Core\Testing\GrpcTestTrait; use PHPUnit\Framework\TestCase; /** diff --git a/tests/unit/Spanner/Connection/GrpcTest.php b/tests/unit/Spanner/Connection/GrpcTest.php index 63fc4aa46d24..b38082d25a5b 100644 --- a/tests/unit/Spanner/Connection/GrpcTest.php +++ b/tests/unit/Spanner/Connection/GrpcTest.php @@ -23,7 +23,7 @@ use Google\Cloud\Spanner\Connection\Grpc; use Google\Cloud\Spanner\V1\SpannerClient; use Google\Cloud\Spanner\ValueMapper; -use Google\Cloud\Tests\GrpcTestTrait; +use Google\Cloud\Core\Testing\GrpcTestTrait; use Google\ApiCore\GrpcCredentialsHelper; use Google\ApiCore\OperationResponse; use Google\ApiCore\Serializer; diff --git a/tests/unit/Spanner/DatabaseTest.php b/tests/unit/Spanner/DatabaseTest.php index 3ce6b960139e..9b0c83c0ecda 100644 --- a/tests/unit/Spanner/DatabaseTest.php +++ b/tests/unit/Spanner/DatabaseTest.php @@ -36,7 +36,7 @@ use Google\Cloud\Spanner\Timestamp; use Google\Cloud\Spanner\Transaction; use Google\Cloud\Spanner\ValueMapper; -use Google\Cloud\Tests\GrpcTestTrait; +use Google\Cloud\Core\Testing\GrpcTestTrait; use Prophecy\Argument; use PHPUnit\Framework\TestCase; diff --git a/tests/unit/Spanner/DateTest.php b/tests/unit/Spanner/DateTest.php index 2ac456b4a0d3..b0a56f143750 100644 --- a/tests/unit/Spanner/DateTest.php +++ b/tests/unit/Spanner/DateTest.php @@ -18,7 +18,7 @@ namespace Google\Cloud\Tests\Unit\Spanner; use Google\Cloud\Spanner\Date; -use Google\Cloud\Tests\GrpcTestTrait; +use Google\Cloud\Core\Testing\GrpcTestTrait; use PHPUnit\Framework\TestCase; /** diff --git a/tests/unit/Spanner/InstanceConfigurationTest.php b/tests/unit/Spanner/InstanceConfigurationTest.php index 7b4fee80eb5c..580acff84d61 100644 --- a/tests/unit/Spanner/InstanceConfigurationTest.php +++ b/tests/unit/Spanner/InstanceConfigurationTest.php @@ -21,7 +21,7 @@ use Google\Cloud\Spanner\Admin\Instance\V1\InstanceAdminClient; use Google\Cloud\Spanner\InstanceConfiguration; use Google\Cloud\Spanner\Connection\ConnectionInterface; -use Google\Cloud\Tests\GrpcTestTrait; +use Google\Cloud\Core\Testing\GrpcTestTrait; use Prophecy\Argument; use PHPUnit\Framework\TestCase; diff --git a/tests/unit/Spanner/InstanceTest.php b/tests/unit/Spanner/InstanceTest.php index 16216de0b5ff..c5adee8d9b97 100644 --- a/tests/unit/Spanner/InstanceTest.php +++ b/tests/unit/Spanner/InstanceTest.php @@ -29,7 +29,7 @@ use Google\Cloud\Spanner\Database; use Google\Cloud\Spanner\Instance; use Google\Cloud\Spanner\Session\SessionPoolInterface; -use Google\Cloud\Tests\GrpcTestTrait; +use Google\Cloud\Core\Testing\GrpcTestTrait; use Prophecy\Argument; use PHPUnit\Framework\TestCase; diff --git a/tests/unit/Spanner/KeyRangeTest.php b/tests/unit/Spanner/KeyRangeTest.php index 968a19311999..0fa5fa4523fd 100644 --- a/tests/unit/Spanner/KeyRangeTest.php +++ b/tests/unit/Spanner/KeyRangeTest.php @@ -18,7 +18,7 @@ namespace Google\Cloud\Tests\Unit\Spanner; use Google\Cloud\Spanner\KeyRange; -use Google\Cloud\Tests\GrpcTestTrait; +use Google\Cloud\Core\Testing\GrpcTestTrait; use PHPUnit\Framework\TestCase; /** diff --git a/tests/unit/Spanner/OperationTest.php b/tests/unit/Spanner/OperationTest.php index 38c09ba66087..77c3f155ac44 100644 --- a/tests/unit/Spanner/OperationTest.php +++ b/tests/unit/Spanner/OperationTest.php @@ -29,7 +29,7 @@ use Google\Cloud\Spanner\Timestamp; use Google\Cloud\Spanner\Transaction; use Google\Cloud\Spanner\ValueMapper; -use Google\Cloud\Tests\GrpcTestTrait; +use Google\Cloud\Core\Testing\GrpcTestTrait; use Prophecy\Argument; use PHPUnit\Framework\TestCase; diff --git a/tests/unit/Spanner/ResultTest.php b/tests/unit/Spanner/ResultTest.php index f4161d4867ae..e60760cfdc50 100644 --- a/tests/unit/Spanner/ResultTest.php +++ b/tests/unit/Spanner/ResultTest.php @@ -23,7 +23,7 @@ use Google\Cloud\Spanner\Session\Session; use Google\Cloud\Spanner\Snapshot; use Google\Cloud\Spanner\ValueMapper; -use Google\Cloud\Tests\GrpcTestTrait; +use Google\Cloud\Core\Testing\GrpcTestTrait; use Prophecy\Argument; use PHPUnit\Framework\TestCase; diff --git a/tests/unit/Spanner/Session/CacheSessionPoolTest.php b/tests/unit/Spanner/Session/CacheSessionPoolTest.php index 51da3ef64f30..713008ac33fa 100644 --- a/tests/unit/Spanner/Session/CacheSessionPoolTest.php +++ b/tests/unit/Spanner/Session/CacheSessionPoolTest.php @@ -25,7 +25,7 @@ use Google\Cloud\Spanner\Database; use Google\Cloud\Spanner\Session\CacheSessionPool; use Google\Cloud\Spanner\Session\Session; -use Google\Cloud\Tests\GrpcTestTrait; +use Google\Cloud\Core\Testing\GrpcTestTrait; use Grpc\UnaryCall; use Psr\Cache\CacheItemInterface; use Psr\Cache\CacheItemPoolInterface; diff --git a/tests/unit/Spanner/SnapshotTest.php b/tests/unit/Spanner/SnapshotTest.php index 78e8ddbc53c5..114516736bbe 100644 --- a/tests/unit/Spanner/SnapshotTest.php +++ b/tests/unit/Spanner/SnapshotTest.php @@ -21,7 +21,7 @@ use Google\Cloud\Spanner\Session\Session; use Google\Cloud\Spanner\Snapshot; use Google\Cloud\Spanner\Timestamp; -use Google\Cloud\Tests\GrpcTestTrait; +use Google\Cloud\Core\Testing\GrpcTestTrait; use Prophecy\Argument; use PHPUnit\Framework\TestCase; diff --git a/tests/unit/Spanner/SpannerClientTest.php b/tests/unit/Spanner/SpannerClientTest.php index 571604982eb6..1964e0511ace 100644 --- a/tests/unit/Spanner/SpannerClientTest.php +++ b/tests/unit/Spanner/SpannerClientTest.php @@ -33,7 +33,7 @@ use Google\Cloud\Spanner\KeySet; use Google\Cloud\Spanner\SpannerClient; use Google\Cloud\Spanner\Timestamp; -use Google\Cloud\Tests\GrpcTestTrait; +use Google\Cloud\Core\Testing\GrpcTestTrait; use Prophecy\Argument; use PHPUnit\Framework\TestCase; diff --git a/tests/unit/Spanner/TimestampTest.php b/tests/unit/Spanner/TimestampTest.php index fbef39e87f5a..d54bee28f7fb 100644 --- a/tests/unit/Spanner/TimestampTest.php +++ b/tests/unit/Spanner/TimestampTest.php @@ -18,7 +18,7 @@ namespace Google\Cloud\Tests\Unit\Spanner; use Google\Cloud\Spanner\Timestamp; -use Google\Cloud\Tests\GrpcTestTrait; +use Google\Cloud\Core\Testing\GrpcTestTrait; use PHPUnit\Framework\TestCase; /** diff --git a/tests/unit/Spanner/TransactionConfigurationTraitTest.php b/tests/unit/Spanner/TransactionConfigurationTraitTest.php index c1e8a489a9c9..f46d8cc29dbf 100644 --- a/tests/unit/Spanner/TransactionConfigurationTraitTest.php +++ b/tests/unit/Spanner/TransactionConfigurationTraitTest.php @@ -21,7 +21,7 @@ use Google\Cloud\Spanner\Session\SessionPoolInterface; use Google\Cloud\Spanner\Timestamp; use Google\Cloud\Spanner\TransactionConfigurationTrait; -use Google\Cloud\Tests\GrpcTestTrait; +use Google\Cloud\Core\Testing\GrpcTestTrait; use PHPUnit\Framework\TestCase; /** diff --git a/tests/unit/Spanner/TransactionTest.php b/tests/unit/Spanner/TransactionTest.php index 7d47103d8d93..c7c5fec7a603 100644 --- a/tests/unit/Spanner/TransactionTest.php +++ b/tests/unit/Spanner/TransactionTest.php @@ -28,7 +28,7 @@ use Google\Cloud\Spanner\Timestamp; use Google\Cloud\Spanner\Transaction; use Google\Cloud\Spanner\ValueMapper; -use Google\Cloud\Tests\GrpcTestTrait; +use Google\Cloud\Core\Testing\GrpcTestTrait; use Prophecy\Argument; use PHPUnit\Framework\TestCase; diff --git a/tests/unit/Spanner/TransactionTypeTest.php b/tests/unit/Spanner/TransactionTypeTest.php index a17c809f2899..d5867e94a475 100644 --- a/tests/unit/Spanner/TransactionTypeTest.php +++ b/tests/unit/Spanner/TransactionTypeTest.php @@ -30,7 +30,7 @@ use Google\Cloud\Spanner\Timestamp; use Google\Cloud\Spanner\Transaction; use Google\Cloud\Spanner\V1\SpannerClient; -use Google\Cloud\Tests\GrpcTestTrait; +use Google\Cloud\Core\Testing\GrpcTestTrait; use Prophecy\Argument; use PHPUnit\Framework\TestCase; diff --git a/tests/unit/Spanner/ValueMapperTest.php b/tests/unit/Spanner/ValueMapperTest.php index 3baa565287f6..c41358883db4 100644 --- a/tests/unit/Spanner/ValueMapperTest.php +++ b/tests/unit/Spanner/ValueMapperTest.php @@ -24,7 +24,7 @@ use Google\Cloud\Spanner\Result; use Google\Cloud\Spanner\Timestamp; use Google\Cloud\Spanner\ValueMapper; -use Google\Cloud\Tests\GrpcTestTrait; +use Google\Cloud\Core\Testing\GrpcTestTrait; use PHPUnit\Framework\TestCase; /** From e267e07e1e83fe582cc6c5dcdb9b006173880c27 Mon Sep 17 00:00:00 2001 From: Michael Bausor Date: Fri, 22 Dec 2017 15:13:37 -0800 Subject: [PATCH 03/36] Rename key storage trait --- tests/snippets/Storage/StorageObjectTest.php | 2 +- tests/unit/Storage/EncryptionTraitTest.php | 2 +- tests/unit/Storage/StorageObjectTest.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/snippets/Storage/StorageObjectTest.php b/tests/snippets/Storage/StorageObjectTest.php index 41f31db7def7..fea518e5aa22 100644 --- a/tests/snippets/Storage/StorageObjectTest.php +++ b/tests/snippets/Storage/StorageObjectTest.php @@ -25,7 +25,7 @@ use Google\Cloud\Storage\Connection\Rest; use Google\Cloud\Storage\StorageClient; use Google\Cloud\Storage\StorageObject; -use Google\Cloud\Tests\KeyPairGenerateTrait; +use Google\Cloud\Core\Testing\KeyPairGenerateTrait; use GuzzleHttp\Psr7\Response; use Prophecy\Argument; use Psr\Http\Message\RequestInterface; diff --git a/tests/unit/Storage/EncryptionTraitTest.php b/tests/unit/Storage/EncryptionTraitTest.php index 6923db0083cd..c88a5411b9e6 100644 --- a/tests/unit/Storage/EncryptionTraitTest.php +++ b/tests/unit/Storage/EncryptionTraitTest.php @@ -17,7 +17,7 @@ namespace Google\Cloud\Tests\Unit\Storage; -use Google\Cloud\Tests\KeyPairGenerateTrait; +use Google\Cloud\Core\Testing\KeyPairGenerateTrait; use Google\Cloud\Storage\EncryptionTrait; use PHPUnit\Framework\TestCase; diff --git a/tests/unit/Storage/StorageObjectTest.php b/tests/unit/Storage/StorageObjectTest.php index 6e932004c16a..d5056c006640 100644 --- a/tests/unit/Storage/StorageObjectTest.php +++ b/tests/unit/Storage/StorageObjectTest.php @@ -20,7 +20,7 @@ use Google\Cloud\Core\Exception\NotFoundException; use Google\Cloud\Core\RequestWrapper; use Google\Cloud\Core\Timestamp; -use Google\Cloud\Tests\KeyPairGenerateTrait; +use Google\Cloud\Core\Testing\KeyPairGenerateTrait; use Google\Cloud\Storage\Acl; use Google\Cloud\Storage\Bucket; use Google\Cloud\Storage\Connection\Rest; From 233156ece937f0d13d4301ef5b1430aa8b29419b Mon Sep 17 00:00:00 2001 From: Michael Bausor Date: Fri, 22 Dec 2017 15:15:18 -0800 Subject: [PATCH 04/36] Rename stub --- tests/conformance/FirestoreTest.php | 2 +- tests/snippets/BigQuery/BigQueryClientTest.php | 2 +- tests/snippets/BigQuery/CopyJobConfigurationTest.php | 2 +- tests/snippets/BigQuery/ExtractJobConfigurationTest.php | 2 +- tests/snippets/BigQuery/LoadJobConfigurationTest.php | 2 +- tests/snippets/BigQuery/QueryJobConfigurationTest.php | 2 +- tests/snippets/BigQuery/QueryResultsTest.php | 2 +- tests/snippets/BigQuery/TableTest.php | 6 +++--- tests/snippets/BigQuery/TimeTest.php | 2 +- tests/snippets/BigQuery/TimestampTest.php | 2 +- tests/snippets/Core/Iam/IamTest.php | 2 +- .../snippets/Core/LongRunning/LongRunningOperationTest.php | 2 +- tests/snippets/Datastore/Query/QueryTest.php | 2 +- tests/snippets/Datastore/TransactionTest.php | 2 +- tests/snippets/Firestore/CollectionReferenceTest.php | 2 +- tests/snippets/Firestore/DocumentReferenceTest.php | 2 +- tests/snippets/Firestore/DocumentSnapshotTest.php | 4 ++-- tests/snippets/Firestore/FieldValueTest.php | 2 +- tests/snippets/Firestore/FirestoreClientTest.php | 2 +- tests/snippets/Firestore/QuerySnapshotTest.php | 4 ++-- tests/snippets/Firestore/QueryTest.php | 2 +- tests/snippets/Firestore/TransactionTest.php | 4 ++-- tests/snippets/Firestore/WriteBatchTest.php | 2 +- tests/snippets/Language/LanguageClientTest.php | 2 +- tests/snippets/Logging/LoggerTest.php | 2 +- tests/snippets/Logging/LoggingClientTest.php | 2 +- tests/snippets/Logging/MetricTest.php | 2 +- tests/snippets/Logging/SinkTest.php | 2 +- tests/snippets/PubSub/PubSubClientTest.php | 2 +- tests/snippets/PubSub/SnapshotTest.php | 2 +- tests/snippets/PubSub/SubscriptionTest.php | 4 ++-- tests/snippets/PubSub/TopicTest.php | 4 ++-- tests/snippets/Spanner/DatabaseTest.php | 4 ++-- tests/snippets/Spanner/InstanceConfigurationTest.php | 2 +- tests/snippets/Spanner/InstanceTest.php | 2 +- tests/snippets/Spanner/SnapshotTest.php | 4 ++-- tests/snippets/Spanner/SpannerClientTest.php | 2 +- tests/snippets/Spanner/TransactionTest.php | 4 ++-- tests/snippets/Speech/OperationTest.php | 2 +- tests/snippets/Speech/SpeechClientTest.php | 2 +- tests/snippets/Storage/AclTest.php | 2 +- tests/snippets/Storage/BucketTest.php | 2 +- tests/snippets/Storage/NotificationTest.php | 2 +- tests/snippets/Storage/StorageClientTest.php | 2 +- tests/snippets/Storage/StorageObjectTest.php | 2 +- tests/snippets/Trace/TraceClientTest.php | 2 +- tests/snippets/Translate/TranslateClientTest.php | 2 +- tests/snippets/Vision/VisionClientTest.php | 2 +- tests/unit/BigQuery/BigQueryClientTest.php | 2 +- tests/unit/Firestore/CollectionReferenceTest.php | 2 +- tests/unit/Firestore/DocumentReferenceTest.php | 2 +- tests/unit/Firestore/DocumentSnapshotTest.php | 2 +- tests/unit/Firestore/FirestoreClientTest.php | 2 +- tests/unit/Firestore/QuerySnapshotTest.php | 2 +- tests/unit/Firestore/QueryTest.php | 2 +- tests/unit/Firestore/TransactionTest.php | 2 +- tests/unit/Firestore/ValueMapperTest.php | 2 +- tests/unit/Firestore/WriteBatchTest.php | 2 +- tests/unit/Spanner/Connection/IamDatabaseTest.php | 2 +- tests/unit/Spanner/Connection/IamInstanceTest.php | 2 +- tests/unit/Spanner/Connection/LongRunningConnectionTest.php | 2 +- tests/unit/Spanner/DatabaseTest.php | 2 +- tests/unit/Spanner/InstanceConfigurationTest.php | 4 ++-- tests/unit/Spanner/InstanceTest.php | 2 +- tests/unit/Spanner/OperationTest.php | 2 +- tests/unit/Spanner/SpannerClientTest.php | 2 +- tests/unit/Spanner/TransactionTest.php | 6 +++--- tests/unit/Spanner/TransactionTypeTest.php | 2 +- tests/unit/Storage/RequesterPaysTest.php | 2 +- tests/unit/Storage/StorageClientTest.php | 2 +- 70 files changed, 83 insertions(+), 83 deletions(-) diff --git a/tests/conformance/FirestoreTest.php b/tests/conformance/FirestoreTest.php index 0086e4a1715f..3edc823bc1d9 100644 --- a/tests/conformance/FirestoreTest.php +++ b/tests/conformance/FirestoreTest.php @@ -63,7 +63,7 @@ class FirestoreTest extends TestCase public function setUp() { - $this->client = \Google\Cloud\Dev\stub(FirestoreClient::class, [ + $this->client = \Google\Cloud\Core\Testing\stub(FirestoreClient::class, [ [ 'projectId' => 'projectID' ] diff --git a/tests/snippets/BigQuery/BigQueryClientTest.php b/tests/snippets/BigQuery/BigQueryClientTest.php index ff54169a825a..39f7b2fa38d0 100644 --- a/tests/snippets/BigQuery/BigQueryClientTest.php +++ b/tests/snippets/BigQuery/BigQueryClientTest.php @@ -70,7 +70,7 @@ class BigQueryClientTest extends SnippetTestCase public function setUp() { $this->connection = $this->prophesize(ConnectionInterface::class); - $this->client = \Google\Cloud\Dev\stub(BigQueryTestClient::class); + $this->client = \Google\Cloud\Core\Testing\stub(BigQueryTestClient::class); $this->client->___setProperty('connection', $this->connection->reveal()); } diff --git a/tests/snippets/BigQuery/CopyJobConfigurationTest.php b/tests/snippets/BigQuery/CopyJobConfigurationTest.php index ddfab1f03a0d..e8958e4b6e24 100644 --- a/tests/snippets/BigQuery/CopyJobConfigurationTest.php +++ b/tests/snippets/BigQuery/CopyJobConfigurationTest.php @@ -70,7 +70,7 @@ public function testSetters($method, $expected, $bq = null) public function setterDataProvider() { - $bq = \Google\Cloud\Dev\stub(BigQueryClient::class, [ + $bq = \Google\Cloud\Core\Testing\stub(BigQueryClient::class, [ ['projectId' => self::PROJECT_ID] ]); diff --git a/tests/snippets/BigQuery/ExtractJobConfigurationTest.php b/tests/snippets/BigQuery/ExtractJobConfigurationTest.php index ae09c5f281f5..142475b2de9e 100644 --- a/tests/snippets/BigQuery/ExtractJobConfigurationTest.php +++ b/tests/snippets/BigQuery/ExtractJobConfigurationTest.php @@ -71,7 +71,7 @@ public function testSetters($method, $expected, $bq = null) public function setterDataProvider() { - $bq = \Google\Cloud\Dev\stub(BigQueryClient::class, [ + $bq = \Google\Cloud\Core\Testing\stub(BigQueryClient::class, [ ['projectId' => self::PROJECT_ID] ]); diff --git a/tests/snippets/BigQuery/LoadJobConfigurationTest.php b/tests/snippets/BigQuery/LoadJobConfigurationTest.php index 3a059c9078c5..45c90284e9cc 100644 --- a/tests/snippets/BigQuery/LoadJobConfigurationTest.php +++ b/tests/snippets/BigQuery/LoadJobConfigurationTest.php @@ -81,7 +81,7 @@ public function testSetters($method, $expected, $bq = null) public function setterDataProvider() { - $bq = \Google\Cloud\Dev\stub(BigQueryClient::class, [ + $bq = \Google\Cloud\Core\Testing\stub(BigQueryClient::class, [ ['projectId' => self::PROJECT_ID] ]); diff --git a/tests/snippets/BigQuery/QueryJobConfigurationTest.php b/tests/snippets/BigQuery/QueryJobConfigurationTest.php index eeb100e2adf0..ebe34be2b9cb 100644 --- a/tests/snippets/BigQuery/QueryJobConfigurationTest.php +++ b/tests/snippets/BigQuery/QueryJobConfigurationTest.php @@ -72,7 +72,7 @@ public function testSetters($method, $expected, $bq = null) public function setterDataProvider() { - $bq = \Google\Cloud\Dev\stub(BigQueryClient::class, [ + $bq = \Google\Cloud\Core\Testing\stub(BigQueryClient::class, [ ['projectId' => self::PROJECT_ID] ]); diff --git a/tests/snippets/BigQuery/QueryResultsTest.php b/tests/snippets/BigQuery/QueryResultsTest.php index 9efefcbf0d51..eee3fc5f858c 100644 --- a/tests/snippets/BigQuery/QueryResultsTest.php +++ b/tests/snippets/BigQuery/QueryResultsTest.php @@ -63,7 +63,7 @@ public function setUp() ]; $this->connection = $this->prophesize(ConnectionInterface::class); - $this->qr = \Google\Cloud\Dev\stub(QueryResults::class, [ + $this->qr = \Google\Cloud\Core\Testing\stub(QueryResults::class, [ $this->connection->reveal(), self::JOB_ID, self::PROJECT, diff --git a/tests/snippets/BigQuery/TableTest.php b/tests/snippets/BigQuery/TableTest.php index b20b648ccf1e..34cc65953036 100644 --- a/tests/snippets/BigQuery/TableTest.php +++ b/tests/snippets/BigQuery/TableTest.php @@ -202,7 +202,7 @@ public function testStartJob() public function testCopy() { - $bq = \Google\Cloud\Dev\stub(BigQueryClient::class); + $bq = \Google\Cloud\Core\Testing\stub(BigQueryClient::class); $snippet = $this->snippetFromMethod(Table::class, 'copy'); $snippet->addLocal('bigQuery', $bq); $bq->___setProperty('connection', $this->connection->reveal()); @@ -229,7 +229,7 @@ public function testCopy() public function testExtract() { - $storage = \Google\Cloud\Dev\stub(StorageClient::class); + $storage = \Google\Cloud\Core\Testing\stub(StorageClient::class); $storage->___setProperty('connection', $this->prophesize(StorageConnection::class)->reveal()); $snippet = $this->snippetFromMethod(Table::class, 'extract'); $snippet->addLocal('storage', $storage); @@ -274,7 +274,7 @@ public function testLoad() public function testLoadFromStorage() { - $storage = \Google\Cloud\Dev\stub(StorageClient::class); + $storage = \Google\Cloud\Core\Testing\stub(StorageClient::class); $storage->___setProperty('connection', $this->prophesize(StorageConnection::class)->reveal()); $snippet = $this->snippetFromMethod(Table::class, 'loadFromStorage'); $snippet->addLocal('storage', $storage); diff --git a/tests/snippets/BigQuery/TimeTest.php b/tests/snippets/BigQuery/TimeTest.php index 0b3e072da53e..f866c26fa361 100644 --- a/tests/snippets/BigQuery/TimeTest.php +++ b/tests/snippets/BigQuery/TimeTest.php @@ -29,7 +29,7 @@ class TimeTest extends SnippetTestCase public function testClass() { $snippet = $this->snippetFromClass(Time::class); - $snippet->addLocal('bigQuery', \Google\Cloud\Dev\stub(BigQueryClient::class)); + $snippet->addLocal('bigQuery', \Google\Cloud\Core\Testing\stub(BigQueryClient::class)); $res = $snippet->invoke('time'); $this->assertInstanceOf(Time::class, $res->returnVal()); diff --git a/tests/snippets/BigQuery/TimestampTest.php b/tests/snippets/BigQuery/TimestampTest.php index d732c8ce3cec..0ef7f2368ee3 100644 --- a/tests/snippets/BigQuery/TimestampTest.php +++ b/tests/snippets/BigQuery/TimestampTest.php @@ -29,7 +29,7 @@ class TimestampTest extends SnippetTestCase public function testClass() { $snippet = $this->snippetFromClass(Timestamp::class); - $snippet->addLocal('bigQuery', \Google\Cloud\Dev\stub(BigQueryClient::class)); + $snippet->addLocal('bigQuery', \Google\Cloud\Core\Testing\stub(BigQueryClient::class)); $res = $snippet->invoke('timestamp'); $this->assertInstanceOf(Timestamp::class, $res->returnVal()); diff --git a/tests/snippets/Core/Iam/IamTest.php b/tests/snippets/Core/Iam/IamTest.php index 456e92f4d6e6..102ef6c656e0 100644 --- a/tests/snippets/Core/Iam/IamTest.php +++ b/tests/snippets/Core/Iam/IamTest.php @@ -39,7 +39,7 @@ public function setUp() $this->resource = 'testObject'; $this->connection = $this->prophesize(IamConnectionInterface::class); - $this->iam = \Google\Cloud\Dev\stub(Iam::class, [$this->connection->reveal(), $this->resource]); + $this->iam = \Google\Cloud\Core\Testing\stub(Iam::class, [$this->connection->reveal(), $this->resource]); $this->iam->___setProperty('connection', $this->connection->reveal()); } diff --git a/tests/snippets/Core/LongRunning/LongRunningOperationTest.php b/tests/snippets/Core/LongRunning/LongRunningOperationTest.php index 7f02270652b9..14fe6cab18a5 100644 --- a/tests/snippets/Core/LongRunning/LongRunningOperationTest.php +++ b/tests/snippets/Core/LongRunning/LongRunningOperationTest.php @@ -41,7 +41,7 @@ public function setUp() $this->callables = [ ['typeUrl' => self::TYPE, 'callable' => function($res) { return $res; }] ]; - $this->operation = \Google\Cloud\Dev\stub(LongRunningOperation::class, [ + $this->operation = \Google\Cloud\Core\Testing\stub(LongRunningOperation::class, [ $this->connection->reveal(), self::NAME, $this->callables diff --git a/tests/snippets/Datastore/Query/QueryTest.php b/tests/snippets/Datastore/Query/QueryTest.php index d7074c6e5079..533537bdcb71 100644 --- a/tests/snippets/Datastore/Query/QueryTest.php +++ b/tests/snippets/Datastore/Query/QueryTest.php @@ -43,7 +43,7 @@ public function setUp() $this->datastore = new DatastoreClient; $this->connection = $this->prophesize(ConnectionInterface::class); - $this->operation = \Google\Cloud\Dev\stub(Operation::class, [ + $this->operation = \Google\Cloud\Core\Testing\stub(Operation::class, [ $this->connection->reveal(), 'my-awesome-project', '', diff --git a/tests/snippets/Datastore/TransactionTest.php b/tests/snippets/Datastore/TransactionTest.php index a6f701677d79..edbd95983ce9 100644 --- a/tests/snippets/Datastore/TransactionTest.php +++ b/tests/snippets/Datastore/TransactionTest.php @@ -44,7 +44,7 @@ class TransactionTest extends SnippetTestCase public function setUp() { $this->connection = $this->prophesize(ConnectionInterface::class); - $this->operation = \Google\Cloud\Dev\stub(Operation::class, [ + $this->operation = \Google\Cloud\Core\Testing\stub(Operation::class, [ $this->connection->reveal(), self::PROJECT, '', diff --git a/tests/snippets/Firestore/CollectionReferenceTest.php b/tests/snippets/Firestore/CollectionReferenceTest.php index 5f3cbdf20405..497a74368ce9 100644 --- a/tests/snippets/Firestore/CollectionReferenceTest.php +++ b/tests/snippets/Firestore/CollectionReferenceTest.php @@ -44,7 +44,7 @@ class CollectionReferenceTest extends SnippetTestCase public function setUp() { $this->connection = $this->prophesize(ConnectionInterface::class); - $this->collection = \Google\Cloud\Dev\stub(CollectionReference::class, [ + $this->collection = \Google\Cloud\Core\Testing\stub(CollectionReference::class, [ $this->connection->reveal(), new ValueMapper($this->connection->reveal(), false), self::NAME diff --git a/tests/snippets/Firestore/DocumentReferenceTest.php b/tests/snippets/Firestore/DocumentReferenceTest.php index 91217fe4f10e..12842ffbd339 100644 --- a/tests/snippets/Firestore/DocumentReferenceTest.php +++ b/tests/snippets/Firestore/DocumentReferenceTest.php @@ -45,7 +45,7 @@ class DocumentReferenceTest extends SnippetTestCase public function setUp() { $this->connection = $this->prophesize(ConnectionInterface::class); - $this->document = \Google\Cloud\Dev\stub(DocumentReferenceStub::class, [ + $this->document = \Google\Cloud\Core\Testing\stub(DocumentReferenceStub::class, [ $this->connection->reveal(), new ValueMapper($this->connection->reveal(), false), $this->prophesize(CollectionReference::class)->reveal(), diff --git a/tests/snippets/Firestore/DocumentSnapshotTest.php b/tests/snippets/Firestore/DocumentSnapshotTest.php index 86b6e34b89fe..a02f7644cca3 100644 --- a/tests/snippets/Firestore/DocumentSnapshotTest.php +++ b/tests/snippets/Firestore/DocumentSnapshotTest.php @@ -47,7 +47,7 @@ public function setUp() $ref->id()->willReturn(array_pop($parts)); $ref->path()->willReturn(explode('/documents/', self::DOCUMENT)[1]); - $this->snapshot = \Google\Cloud\Dev\stub(DocumentSnapshot::class, [ + $this->snapshot = \Google\Cloud\Core\Testing\stub(DocumentSnapshot::class, [ $ref->reveal(), new ValueMapper($this->prophesize(ConnectionInterface::class)->reveal(), false), [], @@ -67,7 +67,7 @@ public function testClass() ['missing' => self::DOCUMENT] ])); - $client = \Google\Cloud\Dev\stub(FirestoreClient::class); + $client = \Google\Cloud\Core\Testing\stub(FirestoreClient::class); $client->___setProperty('connection', $connection->reveal()); $snippet = $this->snippetFromClass(DocumentSnapshot::class); $snippet->setLine(2, ''); diff --git a/tests/snippets/Firestore/FieldValueTest.php b/tests/snippets/Firestore/FieldValueTest.php index 2e48fa9fb5ae..c878134e76ee 100644 --- a/tests/snippets/Firestore/FieldValueTest.php +++ b/tests/snippets/Firestore/FieldValueTest.php @@ -41,7 +41,7 @@ public function setUp() $this->checkAndSkipGrpcTests(); $this->connection = $this->prophesize(ConnectionInterface::class); - $this->firestore = \Google\Cloud\Dev\stub(FirestoreClient::class); + $this->firestore = \Google\Cloud\Core\Testing\stub(FirestoreClient::class); } public function testDeleteField() diff --git a/tests/snippets/Firestore/FirestoreClientTest.php b/tests/snippets/Firestore/FirestoreClientTest.php index 90333f7eb47a..56bab83bbda4 100644 --- a/tests/snippets/Firestore/FirestoreClientTest.php +++ b/tests/snippets/Firestore/FirestoreClientTest.php @@ -51,7 +51,7 @@ public function setUp() $this->checkAndSkipGrpcTests(); $this->connection = $this->prophesize(ConnectionInterface::class); - $this->client = \Google\Cloud\Dev\stub(FirestoreClient::class, [ + $this->client = \Google\Cloud\Core\Testing\stub(FirestoreClient::class, [ ['projectId' => self::PROJECT] ]); } diff --git a/tests/snippets/Firestore/QuerySnapshotTest.php b/tests/snippets/Firestore/QuerySnapshotTest.php index 71e6df78f2a1..1cdf4eb3c092 100644 --- a/tests/snippets/Firestore/QuerySnapshotTest.php +++ b/tests/snippets/Firestore/QuerySnapshotTest.php @@ -40,7 +40,7 @@ class QuerySnapshotTest extends SnippetTestCase public function setUp() { $this->connection = $this->prophesize(ConnectionInterface::class); - $this->snapshot = \Google\Cloud\Dev\stub(QuerySnapshot::class, [ + $this->snapshot = \Google\Cloud\Core\Testing\stub(QuerySnapshot::class, [ $this->prophesize(Query::class)->reveal(), [] ], ['rows']); @@ -54,7 +54,7 @@ public function testClass() ->shouldBeCalled() ->willReturn(new \ArrayIterator([])); - $client = \Google\Cloud\Dev\stub(FirestoreClient::class); + $client = \Google\Cloud\Core\Testing\stub(FirestoreClient::class); $client->___setProperty('connection', $this->connection->reveal()); $snippet = $this->snippetFromClass(QuerySnapshot::class); diff --git a/tests/snippets/Firestore/QueryTest.php b/tests/snippets/Firestore/QueryTest.php index 12382dc0706d..d534bdbe780f 100644 --- a/tests/snippets/Firestore/QueryTest.php +++ b/tests/snippets/Firestore/QueryTest.php @@ -43,7 +43,7 @@ class QueryTest extends SnippetTestCase public function setUp() { $this->connection = $this->prophesize(ConnectionInterface::class); - $this->query = \Google\Cloud\Dev\stub(Query::class, [ + $this->query = \Google\Cloud\Core\Testing\stub(Query::class, [ $this->connection->reveal(), new ValueMapper($this->connection->reveal(), false), self::NAME, diff --git a/tests/snippets/Firestore/TransactionTest.php b/tests/snippets/Firestore/TransactionTest.php index fb956d7513ba..97d4a7925f93 100644 --- a/tests/snippets/Firestore/TransactionTest.php +++ b/tests/snippets/Firestore/TransactionTest.php @@ -52,7 +52,7 @@ class TransactionTest extends SnippetTestCase public function setUp() { $this->connection = $this->prophesize(ConnectionInterface::class); - $this->transaction = \Google\Cloud\Dev\stub(TransactionStub::class, [ + $this->transaction = \Google\Cloud\Core\Testing\stub(TransactionStub::class, [ $this->connection->reveal(), new ValueMapper($this->connection->reveal(), false), self::DATABASE, @@ -76,7 +76,7 @@ public function testClass() $this->connection->rollback(Argument::any()) ->shouldBeCalled(); - $client = \Google\Cloud\Dev\stub(FirestoreClient::class); + $client = \Google\Cloud\Core\Testing\stub(FirestoreClient::class); $client->___setProperty('connection', $this->connection->reveal()); $snippet = $this->snippetFromClass(Transaction::class); diff --git a/tests/snippets/Firestore/WriteBatchTest.php b/tests/snippets/Firestore/WriteBatchTest.php index ec6722d9a7fe..db950cf245c0 100644 --- a/tests/snippets/Firestore/WriteBatchTest.php +++ b/tests/snippets/Firestore/WriteBatchTest.php @@ -43,7 +43,7 @@ class WriteBatchTest extends SnippetTestCase public function setUp() { $this->connection = $this->prophesize(ConnectionInterface::class); - $this->batch = \Google\Cloud\Dev\stub(WriteBatch::class, [ + $this->batch = \Google\Cloud\Core\Testing\stub(WriteBatch::class, [ $this->connection->reveal(), new ValueMapper($this->connection->reveal(), false), self::DATABASE diff --git a/tests/snippets/Language/LanguageClientTest.php b/tests/snippets/Language/LanguageClientTest.php index 6e7302e17a69..ce4d78951947 100644 --- a/tests/snippets/Language/LanguageClientTest.php +++ b/tests/snippets/Language/LanguageClientTest.php @@ -33,7 +33,7 @@ class LanguageClientTest extends SnippetTestCase public function setUp() { $this->connection = $this->prophesize(ConnectionInterface::class); - $this->client = \Google\Cloud\Dev\stub(LanguageClient::class); + $this->client = \Google\Cloud\Core\Testing\stub(LanguageClient::class); $this->client->___setProperty('connection', $this->connection->reveal()); } diff --git a/tests/snippets/Logging/LoggerTest.php b/tests/snippets/Logging/LoggerTest.php index 5c74fcd2d3a9..208faa3eb353 100644 --- a/tests/snippets/Logging/LoggerTest.php +++ b/tests/snippets/Logging/LoggerTest.php @@ -38,7 +38,7 @@ class LoggerTest extends SnippetTestCase public function setUp() { $this->connection = $this->prophesize(ConnectionInterface::class); - $this->logger = \Google\Cloud\Dev\stub(Logger::class, [ + $this->logger = \Google\Cloud\Core\Testing\stub(Logger::class, [ $this->connection->reveal(), self::NAME, self::PROJECT diff --git a/tests/snippets/Logging/LoggingClientTest.php b/tests/snippets/Logging/LoggingClientTest.php index 14108d31e4e4..20812367824f 100644 --- a/tests/snippets/Logging/LoggingClientTest.php +++ b/tests/snippets/Logging/LoggingClientTest.php @@ -38,7 +38,7 @@ class LoggingClientTest extends SnippetTestCase public function setUp() { $this->connection = $this->prophesize(ConnectionInterface::class); - $this->client = \Google\Cloud\Dev\stub(LoggingClient::class); + $this->client = \Google\Cloud\Core\Testing\stub(LoggingClient::class); $this->client->___setProperty('connection', $this->connection->reveal()); } diff --git a/tests/snippets/Logging/MetricTest.php b/tests/snippets/Logging/MetricTest.php index 240cf7c890d2..be571bf592ef 100644 --- a/tests/snippets/Logging/MetricTest.php +++ b/tests/snippets/Logging/MetricTest.php @@ -36,7 +36,7 @@ class MetricTest extends SnippetTestCase public function setUp() { $this->connection = $this->prophesize(ConnectionInterface::class); - $this->metric = \Google\Cloud\Dev\stub(Metric::class, [ + $this->metric = \Google\Cloud\Core\Testing\stub(Metric::class, [ $this->connection->reveal(), self::METRIC, self::PROJECT diff --git a/tests/snippets/Logging/SinkTest.php b/tests/snippets/Logging/SinkTest.php index 91cd4c77392a..2fa580d57567 100644 --- a/tests/snippets/Logging/SinkTest.php +++ b/tests/snippets/Logging/SinkTest.php @@ -36,7 +36,7 @@ class SinkTest extends SnippetTestCase public function setUp() { $this->connection = $this->prophesize(ConnectionInterface::class); - $this->sink = \Google\Cloud\Dev\stub(Sink::class, [ + $this->sink = \Google\Cloud\Core\Testing\stub(Sink::class, [ $this->connection->reveal(), self::SINK, self::PROJECT diff --git a/tests/snippets/PubSub/PubSubClientTest.php b/tests/snippets/PubSub/PubSubClientTest.php index 5c2fcff18d45..b924288649f2 100644 --- a/tests/snippets/PubSub/PubSubClientTest.php +++ b/tests/snippets/PubSub/PubSubClientTest.php @@ -45,7 +45,7 @@ class PubSubClientTest extends SnippetTestCase public function setUp() { $this->connection = $this->prophesize(ConnectionInterface::class); - $this->client = \Google\Cloud\Dev\stub(PubSubClient::class, [['transport' => 'rest']]); + $this->client = \Google\Cloud\Core\Testing\stub(PubSubClient::class, [['transport' => 'rest']]); } public function testClassExample() diff --git a/tests/snippets/PubSub/SnapshotTest.php b/tests/snippets/PubSub/SnapshotTest.php index 9f4c144d7da2..4e19fc6494f1 100644 --- a/tests/snippets/PubSub/SnapshotTest.php +++ b/tests/snippets/PubSub/SnapshotTest.php @@ -38,7 +38,7 @@ class SnapshotTest extends SnippetTestCase public function setUp() { $this->connection = $this->prophesize(ConnectionInterface::class); - $this->snapshot = \Google\Cloud\Dev\stub(Snapshot::class, [ + $this->snapshot = \Google\Cloud\Core\Testing\stub(Snapshot::class, [ $this->connection->reveal(), self::PROJECT, self::SNAPSHOT, diff --git a/tests/snippets/PubSub/SubscriptionTest.php b/tests/snippets/PubSub/SubscriptionTest.php index df9c6e9f94de..44203cc1c80e 100644 --- a/tests/snippets/PubSub/SubscriptionTest.php +++ b/tests/snippets/PubSub/SubscriptionTest.php @@ -41,7 +41,7 @@ class SubscriptionTest extends SnippetTestCase public function setUp() { $this->connection = $this->prophesize(ConnectionInterface::class); - $this->subscription = \Google\Cloud\Dev\stub(Subscription::class, [ + $this->subscription = \Google\Cloud\Core\Testing\stub(Subscription::class, [ $this->connection->reveal(), 'foo', self::SUBSCRIPTION, @@ -49,7 +49,7 @@ public function setUp() false ]); - $this->pubsub = \Google\Cloud\Dev\stub(PubSubClient::class, [['transport' => 'rest']]); + $this->pubsub = \Google\Cloud\Core\Testing\stub(PubSubClient::class, [['transport' => 'rest']]); $this->pubsub->___setProperty('connection', $this->connection->reveal()); } diff --git a/tests/snippets/PubSub/TopicTest.php b/tests/snippets/PubSub/TopicTest.php index c776699f9b04..32e9a82a5326 100644 --- a/tests/snippets/PubSub/TopicTest.php +++ b/tests/snippets/PubSub/TopicTest.php @@ -42,8 +42,8 @@ class TopicTest extends SnippetTestCase public function setUp() { $this->connection = $this->prophesize(ConnectionInterface::class); - $this->pubsub = \Google\Cloud\Dev\stub(PubSubClient::class); - $this->topic = \Google\Cloud\Dev\stub(Topic::class, [ + $this->pubsub = \Google\Cloud\Core\Testing\stub(PubSubClient::class); + $this->topic = \Google\Cloud\Core\Testing\stub(Topic::class, [ $this->connection->reveal(), 'my-awesome-project', self::TOPIC, diff --git a/tests/snippets/Spanner/DatabaseTest.php b/tests/snippets/Spanner/DatabaseTest.php index 62a9b3589765..6d71f5999bb9 100644 --- a/tests/snippets/Spanner/DatabaseTest.php +++ b/tests/snippets/Spanner/DatabaseTest.php @@ -70,7 +70,7 @@ public function setUp() ->willReturn(null); $this->connection = $this->prophesize(ConnectionInterface::class); - $this->database = \Google\Cloud\Dev\stub(Database::class, [ + $this->database = \Google\Cloud\Core\Testing\stub(Database::class, [ $this->connection->reveal(), $instance->reveal(), $this->prophesize(LongRunningConnectionInterface::class)->reveal(), @@ -83,7 +83,7 @@ public function setUp() private function stubOperation() { - $operation = \Google\Cloud\Dev\stub(Operation::class, [ + $operation = \Google\Cloud\Core\Testing\stub(Operation::class, [ $this->connection->reveal(), false ]); diff --git a/tests/snippets/Spanner/InstanceConfigurationTest.php b/tests/snippets/Spanner/InstanceConfigurationTest.php index 44ad82307836..0c4a6f961f5f 100644 --- a/tests/snippets/Spanner/InstanceConfigurationTest.php +++ b/tests/snippets/Spanner/InstanceConfigurationTest.php @@ -43,7 +43,7 @@ public function setUp() $this->checkAndSkipGrpcTests(); $this->connection = $this->prophesize(ConnectionInterface::class); - $this->config = \Google\Cloud\Dev\stub(InstanceConfiguration::class, [ + $this->config = \Google\Cloud\Core\Testing\stub(InstanceConfiguration::class, [ $this->connection->reveal(), self::PROJECT, self::CONFIG diff --git a/tests/snippets/Spanner/InstanceTest.php b/tests/snippets/Spanner/InstanceTest.php index 111eaafe4a07..7077ae872b45 100644 --- a/tests/snippets/Spanner/InstanceTest.php +++ b/tests/snippets/Spanner/InstanceTest.php @@ -51,7 +51,7 @@ public function setUp() $this->checkAndSkipGrpcTests(); $this->connection = $this->prophesize(ConnectionInterface::class); - $this->instance = \Google\Cloud\Dev\stub(Instance::class, [ + $this->instance = \Google\Cloud\Core\Testing\stub(Instance::class, [ $this->connection->reveal(), $this->prophesize(LongRunningConnectionInterface::class)->reveal(), [], diff --git a/tests/snippets/Spanner/SnapshotTest.php b/tests/snippets/Spanner/SnapshotTest.php index d2af8b6eee25..52a7460c94fb 100644 --- a/tests/snippets/Spanner/SnapshotTest.php +++ b/tests/snippets/Spanner/SnapshotTest.php @@ -51,7 +51,7 @@ public function setUp() $operation = $this->prophesize(Operation::class); $session = $this->prophesize(Session::class); - $this->snapshot = \Google\Cloud\Dev\stub(Snapshot::class, [ + $this->snapshot = \Google\Cloud\Core\Testing\stub(Snapshot::class, [ $operation->reveal(), $session->reveal(), [ @@ -63,7 +63,7 @@ public function setUp() private function stubOperation($stub = null) { - $operation = \Google\Cloud\Dev\stub(Operation::class, [ + $operation = \Google\Cloud\Core\Testing\stub(Operation::class, [ $this->connection->reveal(), false ]); diff --git a/tests/snippets/Spanner/SpannerClientTest.php b/tests/snippets/Spanner/SpannerClientTest.php index 594cb7eed464..64b0d10f0da9 100644 --- a/tests/snippets/Spanner/SpannerClientTest.php +++ b/tests/snippets/Spanner/SpannerClientTest.php @@ -55,7 +55,7 @@ public function setUp() $this->checkAndSkipGrpcTests(); $this->connection = $this->prophesize(ConnectionInterface::class); - $this->client = \Google\Cloud\Dev\stub(SpannerClient::class); + $this->client = \Google\Cloud\Core\Testing\stub(SpannerClient::class); $this->client->___setProperty('connection', $this->connection->reveal()); } diff --git a/tests/snippets/Spanner/TransactionTest.php b/tests/snippets/Spanner/TransactionTest.php index a533adbeca45..745553b8c043 100644 --- a/tests/snippets/Spanner/TransactionTest.php +++ b/tests/snippets/Spanner/TransactionTest.php @@ -50,7 +50,7 @@ public function setUp() $operation = $this->prophesize(Operation::class); $session = $this->prophesize(Session::class); - $this->transaction = \Google\Cloud\Dev\stub(Transaction::class, [ + $this->transaction = \Google\Cloud\Core\Testing\stub(Transaction::class, [ $operation->reveal(), $session->reveal(), self::TRANSACTION @@ -59,7 +59,7 @@ public function setUp() private function stubOperation($stub = null) { - $operation = \Google\Cloud\Dev\stub(Operation::class, [ + $operation = \Google\Cloud\Core\Testing\stub(Operation::class, [ $this->connection->reveal(), false ]); diff --git a/tests/snippets/Speech/OperationTest.php b/tests/snippets/Speech/OperationTest.php index e6f06e449e05..d3c036ceeff0 100644 --- a/tests/snippets/Speech/OperationTest.php +++ b/tests/snippets/Speech/OperationTest.php @@ -48,7 +48,7 @@ public function setUp() ]; $this->connection = $this->prophesize(ConnectionInterface::class); - $this->operation = \Google\Cloud\Dev\stub(Operation::class, [ + $this->operation = \Google\Cloud\Core\Testing\stub(Operation::class, [ $this->connection->reveal(), $this->opData['name'], $this->opData diff --git a/tests/snippets/Speech/SpeechClientTest.php b/tests/snippets/Speech/SpeechClientTest.php index 5621d9527f99..31e0c9d00649 100644 --- a/tests/snippets/Speech/SpeechClientTest.php +++ b/tests/snippets/Speech/SpeechClientTest.php @@ -36,7 +36,7 @@ public function setUp() { $this->testFile = "'" . __DIR__ . '/../fixtures/Speech/demo.flac' . "'"; $this->connection = $this->prophesize(ConnectionInterface::class); - $this->client = \Google\Cloud\Dev\stub(SpeechClient::class, [ + $this->client = \Google\Cloud\Core\Testing\stub(SpeechClient::class, [ ['languageCode' => 'en-US'] ]); $this->client->___setProperty('connection', $this->connection->reveal()); diff --git a/tests/snippets/Storage/AclTest.php b/tests/snippets/Storage/AclTest.php index 0a34b035a685..be9d90a782df 100644 --- a/tests/snippets/Storage/AclTest.php +++ b/tests/snippets/Storage/AclTest.php @@ -33,7 +33,7 @@ class AclTest extends SnippetTestCase public function setUp() { $this->connection = $this->prophesize(ConnectionInterface::class); - $this->acl = \Google\Cloud\Dev\stub(Acl::class, [ + $this->acl = \Google\Cloud\Core\Testing\stub(Acl::class, [ $this->connection->reveal(), 'bucketAccessControls', [] diff --git a/tests/snippets/Storage/BucketTest.php b/tests/snippets/Storage/BucketTest.php index 07f43d2a6d86..c87161f73349 100644 --- a/tests/snippets/Storage/BucketTest.php +++ b/tests/snippets/Storage/BucketTest.php @@ -51,7 +51,7 @@ public function setUp() $this->connection = $this->prophesize(Rest::class); $this->connection->projectId() ->willReturn(self::PROJECT_ID); - $this->bucket = \Google\Cloud\Dev\stub(Bucket::class, [ + $this->bucket = \Google\Cloud\Core\Testing\stub(Bucket::class, [ $this->connection->reveal(), self::BUCKET, [] diff --git a/tests/snippets/Storage/NotificationTest.php b/tests/snippets/Storage/NotificationTest.php index 0107e8d9fd51..14c49f776965 100644 --- a/tests/snippets/Storage/NotificationTest.php +++ b/tests/snippets/Storage/NotificationTest.php @@ -40,7 +40,7 @@ class NotificationTest extends SnippetTestCase public function setUp() { $this->connection = $this->prophesize(Rest::class); - $this->notification = \Google\Cloud\Dev\stub(Notification::class, [ + $this->notification = \Google\Cloud\Core\Testing\stub(Notification::class, [ $this->connection->reveal(), self::NOTIFICATION_ID, self::BUCKET diff --git a/tests/snippets/Storage/StorageClientTest.php b/tests/snippets/Storage/StorageClientTest.php index c6fc5ec4df3f..7cbd5674aafb 100644 --- a/tests/snippets/Storage/StorageClientTest.php +++ b/tests/snippets/Storage/StorageClientTest.php @@ -43,7 +43,7 @@ public function setUp() $this->connection = $this->prophesize(Rest::class); $this->connection->projectId() ->willReturn(self::PROJECT_ID); - $this->client = \Google\Cloud\Dev\stub(StorageClient::class); + $this->client = \Google\Cloud\Core\Testing\stub(StorageClient::class); $this->client->___setProperty('connection', $this->connection->reveal()); } diff --git a/tests/snippets/Storage/StorageObjectTest.php b/tests/snippets/Storage/StorageObjectTest.php index fea518e5aa22..c4e02f3fd2a6 100644 --- a/tests/snippets/Storage/StorageObjectTest.php +++ b/tests/snippets/Storage/StorageObjectTest.php @@ -47,7 +47,7 @@ class StorageObjectTest extends SnippetTestCase public function setUp() { $this->connection = $this->prophesize(Rest::class); - $this->object = \Google\Cloud\Dev\stub(StorageObject::class, [ + $this->object = \Google\Cloud\Core\Testing\stub(StorageObject::class, [ $this->connection->reveal(), self::OBJECT, self::BUCKET diff --git a/tests/snippets/Trace/TraceClientTest.php b/tests/snippets/Trace/TraceClientTest.php index 3294648e0734..df6ac2c40d11 100644 --- a/tests/snippets/Trace/TraceClientTest.php +++ b/tests/snippets/Trace/TraceClientTest.php @@ -34,7 +34,7 @@ class TraceClientTest extends SnippetTestCase public function setUp() { $this->connection = $this->prophesize(ConnectionInterface::class); - $this->client = \Google\Cloud\Dev\stub(TraceClient::class); + $this->client = \Google\Cloud\Core\Testing\stub(TraceClient::class); $this->client->___setProperty('connection', $this->connection->reveal()); } diff --git a/tests/snippets/Translate/TranslateClientTest.php b/tests/snippets/Translate/TranslateClientTest.php index 00ba0252d86f..90e86349f077 100644 --- a/tests/snippets/Translate/TranslateClientTest.php +++ b/tests/snippets/Translate/TranslateClientTest.php @@ -33,7 +33,7 @@ class TranslateClientTest extends SnippetTestCase public function setUp() { $this->connection = $this->prophesize(ConnectionInterface::class); - $this->client = \Google\Cloud\Dev\stub(TranslateClient::class); + $this->client = \Google\Cloud\Core\Testing\stub(TranslateClient::class); $this->client->___setProperty('connection', $this->connection->reveal()); } diff --git a/tests/snippets/Vision/VisionClientTest.php b/tests/snippets/Vision/VisionClientTest.php index 1df139578599..dbc0ace79383 100644 --- a/tests/snippets/Vision/VisionClientTest.php +++ b/tests/snippets/Vision/VisionClientTest.php @@ -35,7 +35,7 @@ class VisionClientTest extends SnippetTestCase public function setUp() { $this->connection = $this->prophesize(ConnectionInterface::class); - $this->client = \Google\Cloud\Dev\stub(VisionClient::class); + $this->client = \Google\Cloud\Core\Testing\stub(VisionClient::class); $this->client->___setProperty('connection', $this->connection->reveal()); } diff --git a/tests/unit/BigQuery/BigQueryClientTest.php b/tests/unit/BigQuery/BigQueryClientTest.php index 6ff125e23961..6bf581249f3b 100644 --- a/tests/unit/BigQuery/BigQueryClientTest.php +++ b/tests/unit/BigQuery/BigQueryClientTest.php @@ -47,7 +47,7 @@ class BigQueryClientTest extends TestCase public function setUp() { $this->connection = $this->prophesize(ConnectionInterface::class); - $this->client = \Google\Cloud\Dev\stub(BigQueryClient::class, ['options' => ['projectId' => self::PROJECT_ID]]); + $this->client = \Google\Cloud\Core\Testing\stub(BigQueryClient::class, ['options' => ['projectId' => self::PROJECT_ID]]); } public function testQueryConfig() diff --git a/tests/unit/Firestore/CollectionReferenceTest.php b/tests/unit/Firestore/CollectionReferenceTest.php index 63ca950f5712..7cf82e8e7fcf 100644 --- a/tests/unit/Firestore/CollectionReferenceTest.php +++ b/tests/unit/Firestore/CollectionReferenceTest.php @@ -42,7 +42,7 @@ class CollectionReferenceTest extends TestCase public function setUp() { $this->connection = $this->prophesize(ConnectionInterface::class); - $this->collection = \Google\Cloud\Dev\stub(CollectionReference::class, [ + $this->collection = \Google\Cloud\Core\Testing\stub(CollectionReference::class, [ $this->connection->reveal(), new ValueMapper($this->connection->reveal(), false), self::NAME diff --git a/tests/unit/Firestore/DocumentReferenceTest.php b/tests/unit/Firestore/DocumentReferenceTest.php index e1789e57edd0..2ec4d7feed62 100644 --- a/tests/unit/Firestore/DocumentReferenceTest.php +++ b/tests/unit/Firestore/DocumentReferenceTest.php @@ -46,7 +46,7 @@ public function setUp() $this->connection = $this->prophesize(ConnectionInterface::class); $valueMapper = new ValueMapper($this->connection->reveal(), false); - $this->document = \Google\Cloud\Dev\stub(DocumentReference::class, [ + $this->document = \Google\Cloud\Core\Testing\stub(DocumentReference::class, [ $this->connection->reveal(), $valueMapper, new CollectionReference($this->connection->reveal(), $valueMapper, self::COLLECTION), diff --git a/tests/unit/Firestore/DocumentSnapshotTest.php b/tests/unit/Firestore/DocumentSnapshotTest.php index 5d4ceecd2375..dfa3fea999cf 100644 --- a/tests/unit/Firestore/DocumentSnapshotTest.php +++ b/tests/unit/Firestore/DocumentSnapshotTest.php @@ -43,7 +43,7 @@ public function setUp() $ref->id()->willReturn(self::ID); $ref->path()->willReturn('a/b'); - $this->snapshot = \Google\Cloud\Dev\stub(DocumentSnapshot::class, [ + $this->snapshot = \Google\Cloud\Core\Testing\stub(DocumentSnapshot::class, [ $ref->reveal(), new ValueMapper($this->prophesize(ConnectionInterface::class)->reveal(), false), [], [], true diff --git a/tests/unit/Firestore/FirestoreClientTest.php b/tests/unit/Firestore/FirestoreClientTest.php index 8c9a57f43d2b..081c6975e75f 100644 --- a/tests/unit/Firestore/FirestoreClientTest.php +++ b/tests/unit/Firestore/FirestoreClientTest.php @@ -51,7 +51,7 @@ public function setUp() $this->checkAndSkipGrpcTests(); $this->connection = $this->prophesize(ConnectionInterface::class); - $this->client = \Google\Cloud\Dev\stub(FirestoreClient::class); + $this->client = \Google\Cloud\Core\Testing\stub(FirestoreClient::class); } public function testBatch() diff --git a/tests/unit/Firestore/QuerySnapshotTest.php b/tests/unit/Firestore/QuerySnapshotTest.php index fcaa60f90ac4..ef599bce47be 100644 --- a/tests/unit/Firestore/QuerySnapshotTest.php +++ b/tests/unit/Firestore/QuerySnapshotTest.php @@ -37,7 +37,7 @@ class QuerySnapshotTest extends TestCase public function setUp() { $this->connection = $this->prophesize(ConnectionInterface::class); - $this->snapshot = \Google\Cloud\Dev\stub(QuerySnapshot::class, [ + $this->snapshot = \Google\Cloud\Core\Testing\stub(QuerySnapshot::class, [ $this->prophesize(Query::class)->reveal(), [] ], ['rows']); diff --git a/tests/unit/Firestore/QueryTest.php b/tests/unit/Firestore/QueryTest.php index bf29705ba954..c471f471b269 100644 --- a/tests/unit/Firestore/QueryTest.php +++ b/tests/unit/Firestore/QueryTest.php @@ -51,7 +51,7 @@ class QueryTest extends TestCase public function setUp() { $this->connection = $this->prophesize(ConnectionInterface::class); - $this->query = \Google\Cloud\Dev\stub(Query::class, [ + $this->query = \Google\Cloud\Core\Testing\stub(Query::class, [ $this->connection->reveal(), new ValueMapper($this->connection->reveal(), false), self::PARENT, diff --git a/tests/unit/Firestore/TransactionTest.php b/tests/unit/Firestore/TransactionTest.php index a6a4ce9353ed..4ef657759a6d 100644 --- a/tests/unit/Firestore/TransactionTest.php +++ b/tests/unit/Firestore/TransactionTest.php @@ -48,7 +48,7 @@ public function setUp() { $this->connection = $this->prophesize(ConnectionInterface::class); $this->valueMapper = new ValueMapper($this->connection->reveal(), false); - $this->transaction = \Google\Cloud\Dev\stub(Transaction::class, [ + $this->transaction = \Google\Cloud\Core\Testing\stub(Transaction::class, [ $this->connection->reveal(), $this->valueMapper, sprintf('projects/%s/databases/%s', self::PROJECT, self::DATABASE), diff --git a/tests/unit/Firestore/ValueMapperTest.php b/tests/unit/Firestore/ValueMapperTest.php index d8148ccd48fa..7a3939dc83c0 100644 --- a/tests/unit/Firestore/ValueMapperTest.php +++ b/tests/unit/Firestore/ValueMapperTest.php @@ -43,7 +43,7 @@ class ValueMapperTest extends TestCase public function setUp() { $this->connection = $this->prophesize(ConnectionInterface::class); - $this->mapper = \Google\Cloud\Dev\stub(ValueMapper::class, [ + $this->mapper = \Google\Cloud\Core\Testing\stub(ValueMapper::class, [ $this->connection->reveal(), false ], ['connection', 'returnInt64AsObject']); diff --git a/tests/unit/Firestore/WriteBatchTest.php b/tests/unit/Firestore/WriteBatchTest.php index f822e92b0d7b..720a9718a522 100644 --- a/tests/unit/Firestore/WriteBatchTest.php +++ b/tests/unit/Firestore/WriteBatchTest.php @@ -45,7 +45,7 @@ class WriteBatchTest extends TestCase public function setUp() { $this->connection = $this->prophesize(ConnectionInterface::class); - $this->batch = \Google\Cloud\Dev\stub(WriteBatch::class, [ + $this->batch = \Google\Cloud\Core\Testing\stub(WriteBatch::class, [ $this->connection->reveal(), new ValueMapper($this->connection->reveal(), false), sprintf('projects/%s/databases/%s', self::PROJECT, self::DATABASE) diff --git a/tests/unit/Spanner/Connection/IamDatabaseTest.php b/tests/unit/Spanner/Connection/IamDatabaseTest.php index a9354c73bef6..06cdf52d725a 100644 --- a/tests/unit/Spanner/Connection/IamDatabaseTest.php +++ b/tests/unit/Spanner/Connection/IamDatabaseTest.php @@ -36,7 +36,7 @@ public function setUp() { $this->connection = $this->prophesize(ConnectionInterface::class); - $this->iam = \Google\Cloud\Dev\stub(IamDatabase::class, [$this->connection->reveal()]); + $this->iam = \Google\Cloud\Core\Testing\stub(IamDatabase::class, [$this->connection->reveal()]); } /** diff --git a/tests/unit/Spanner/Connection/IamInstanceTest.php b/tests/unit/Spanner/Connection/IamInstanceTest.php index 5e68e4d52f02..4eec57895a89 100644 --- a/tests/unit/Spanner/Connection/IamInstanceTest.php +++ b/tests/unit/Spanner/Connection/IamInstanceTest.php @@ -36,7 +36,7 @@ public function setUp() { $this->connection = $this->prophesize(ConnectionInterface::class); - $this->iam = \Google\Cloud\Dev\stub(IamInstance::class, [$this->connection->reveal()]); + $this->iam = \Google\Cloud\Core\Testing\stub(IamInstance::class, [$this->connection->reveal()]); } /** diff --git a/tests/unit/Spanner/Connection/LongRunningConnectionTest.php b/tests/unit/Spanner/Connection/LongRunningConnectionTest.php index 43fec7725dc6..1b307b9fea33 100644 --- a/tests/unit/Spanner/Connection/LongRunningConnectionTest.php +++ b/tests/unit/Spanner/Connection/LongRunningConnectionTest.php @@ -33,7 +33,7 @@ class LongRunningConnectionTest extends TestCase public function setUp() { $this->connection = $this->prophesize(ConnectionInterface::class); - $this->lro = \Google\Cloud\Dev\stub(LongRunningConnection::class, [ + $this->lro = \Google\Cloud\Core\Testing\stub(LongRunningConnection::class, [ $this->connection->reveal() ]); } diff --git a/tests/unit/Spanner/DatabaseTest.php b/tests/unit/Spanner/DatabaseTest.php index 9b0c83c0ecda..4987c6376bb3 100644 --- a/tests/unit/Spanner/DatabaseTest.php +++ b/tests/unit/Spanner/DatabaseTest.php @@ -99,7 +99,7 @@ public function setUp() 'connection', 'operation' ]; - $this->database = \Google\Cloud\Dev\stub(Database::class, $args, $props); + $this->database = \Google\Cloud\Core\Testing\stub(Database::class, $args, $props); } public function testName() diff --git a/tests/unit/Spanner/InstanceConfigurationTest.php b/tests/unit/Spanner/InstanceConfigurationTest.php index 580acff84d61..04a26e5f27fe 100644 --- a/tests/unit/Spanner/InstanceConfigurationTest.php +++ b/tests/unit/Spanner/InstanceConfigurationTest.php @@ -44,7 +44,7 @@ public function setUp() $this->checkAndSkipGrpcTests(); $this->connection = $this->prophesize(ConnectionInterface::class); - $this->configuration = \Google\Cloud\Dev\stub(InstanceConfiguration::class, [ + $this->configuration = \Google\Cloud\Core\Testing\stub(InstanceConfiguration::class, [ $this->connection->reveal(), self::PROJECT_ID, self::NAME @@ -62,7 +62,7 @@ public function testInfo() $this->configuration->___setProperty('connection', $this->connection->reveal()); $info = ['foo' => 'bar']; - $config = \Google\Cloud\Dev\stub(InstanceConfiguration::class, [ + $config = \Google\Cloud\Core\Testing\stub(InstanceConfiguration::class, [ $this->connection->reveal(), self::PROJECT_ID, self::NAME, diff --git a/tests/unit/Spanner/InstanceTest.php b/tests/unit/Spanner/InstanceTest.php index c5adee8d9b97..a403aac07b7b 100644 --- a/tests/unit/Spanner/InstanceTest.php +++ b/tests/unit/Spanner/InstanceTest.php @@ -52,7 +52,7 @@ public function setUp() $this->checkAndSkipGrpcTests(); $this->connection = $this->prophesize(ConnectionInterface::class); - $this->instance = \Google\Cloud\Dev\stub(Instance::class, [ + $this->instance = \Google\Cloud\Core\Testing\stub(Instance::class, [ $this->connection->reveal(), $this->prophesize(LongRunningConnectionInterface::class)->reveal(), [], diff --git a/tests/unit/Spanner/OperationTest.php b/tests/unit/Spanner/OperationTest.php index 77c3f155ac44..4c3417228039 100644 --- a/tests/unit/Spanner/OperationTest.php +++ b/tests/unit/Spanner/OperationTest.php @@ -55,7 +55,7 @@ public function setUp() $this->connection = $this->prophesize(ConnectionInterface::class); - $this->operation = \Google\Cloud\Dev\stub(Operation::class, [ + $this->operation = \Google\Cloud\Core\Testing\stub(Operation::class, [ $this->connection->reveal(), false ]); diff --git a/tests/unit/Spanner/SpannerClientTest.php b/tests/unit/Spanner/SpannerClientTest.php index 1964e0511ace..086616b39e6f 100644 --- a/tests/unit/Spanner/SpannerClientTest.php +++ b/tests/unit/Spanner/SpannerClientTest.php @@ -56,7 +56,7 @@ public function setUp() $this->checkAndSkipGrpcTests(); $this->connection = $this->prophesize(ConnectionInterface::class); - $this->client = \Google\Cloud\Dev\stub(SpannerClient::class, [ + $this->client = \Google\Cloud\Core\Testing\stub(SpannerClient::class, [ ['projectId' => self::PROJECT] ]); } diff --git a/tests/unit/Spanner/TransactionTest.php b/tests/unit/Spanner/TransactionTest.php index c7c5fec7a603..e37c31037f58 100644 --- a/tests/unit/Spanner/TransactionTest.php +++ b/tests/unit/Spanner/TransactionTest.php @@ -80,10 +80,10 @@ public function setUp() 'operation', 'readTimestamp', 'state' ]; - $this->transaction = \Google\Cloud\Dev\stub(Transaction::class, $args, $props); + $this->transaction = \Google\Cloud\Core\Testing\stub(Transaction::class, $args, $props); unset($args[2]); - $this->singleUseTransaction = \Google\Cloud\Dev\stub(Transaction::class, $args, $props); + $this->singleUseTransaction = \Google\Cloud\Core\Testing\stub(Transaction::class, $args, $props); } public function testInsert() @@ -303,7 +303,7 @@ public function testIsRetryTrue() true ]; - $transaction = \Google\Cloud\Dev\stub(Transaction::class, $args); + $transaction = \Google\Cloud\Core\Testing\stub(Transaction::class, $args); $this->assertTrue($transaction->isRetry()); } diff --git a/tests/unit/Spanner/TransactionTypeTest.php b/tests/unit/Spanner/TransactionTypeTest.php index d5867e94a475..0d92aa357e11 100644 --- a/tests/unit/Spanner/TransactionTypeTest.php +++ b/tests/unit/Spanner/TransactionTypeTest.php @@ -767,7 +767,7 @@ private function database(ConnectionInterface $connection) $instance = $this->prophesize(Instance::class); $instance->name()->willReturn(InstanceAdminClient::instanceName(self::PROJECT, self::INSTANCE)); - $database = \Google\Cloud\Dev\stub(Database::class, [ + $database = \Google\Cloud\Core\Testing\stub(Database::class, [ $connection, $instance->reveal(), $this->prophesize(LongRunningConnectionInterface::class)->reveal(), diff --git a/tests/unit/Storage/RequesterPaysTest.php b/tests/unit/Storage/RequesterPaysTest.php index 9178528128fb..cb188f85cee4 100644 --- a/tests/unit/Storage/RequesterPaysTest.php +++ b/tests/unit/Storage/RequesterPaysTest.php @@ -43,7 +43,7 @@ class RequesterPaysTest extends TestCase public function setUp() { $this->connection = new Rest(['projectId' => self::PROJECT]); - $this->client = \Google\Cloud\Dev\stub(StorageClient::class); + $this->client = \Google\Cloud\Core\Testing\stub(StorageClient::class); } /** diff --git a/tests/unit/Storage/StorageClientTest.php b/tests/unit/Storage/StorageClientTest.php index fb54e2b9db5c..b5f5cca55b72 100644 --- a/tests/unit/Storage/StorageClientTest.php +++ b/tests/unit/Storage/StorageClientTest.php @@ -38,7 +38,7 @@ class StorageClientTest extends TestCase public function setUp() { $this->connection = $this->prophesize(Rest::class); - $this->client = \Google\Cloud\Dev\stub(StorageClient::class, [['projectId' => self::PROJECT]]); + $this->client = \Google\Cloud\Core\Testing\stub(StorageClient::class, [['projectId' => self::PROJECT]]); } public function testGetBucket() From f393c706dea19414ac55d8add9e3e96f524e3a96 Mon Sep 17 00:00:00 2001 From: Michael Bausor Date: Fri, 22 Dec 2017 15:16:06 -0800 Subject: [PATCH 05/36] Rename impl --- tests/unit/BigQuery/JobConfigurationTraitTest.php | 2 +- tests/unit/BigQuery/JobWaitTraitTest.php | 2 +- tests/unit/Core/ClientTraitTest.php | 10 +++++----- tests/unit/Core/ConcurrencyControlTraitTest.php | 2 +- tests/unit/Core/EmulatorTraitTest.php | 2 +- tests/unit/Core/GrpcTraitTest.php | 2 +- tests/unit/Core/JsonTraitTest.php | 2 +- tests/unit/Firestore/PathTraitTest.php | 2 +- tests/unit/Firestore/SnapshotTraitTest.php | 2 +- tests/unit/Storage/EncryptionTraitTest.php | 2 +- 10 files changed, 14 insertions(+), 14 deletions(-) diff --git a/tests/unit/BigQuery/JobConfigurationTraitTest.php b/tests/unit/BigQuery/JobConfigurationTraitTest.php index da7194f15e29..7b44af8fb1c4 100644 --- a/tests/unit/BigQuery/JobConfigurationTraitTest.php +++ b/tests/unit/BigQuery/JobConfigurationTraitTest.php @@ -33,7 +33,7 @@ class JobConfigurationTraitTest extends TestCase public function setUp() { - $this->trait = \Google\Cloud\Dev\impl(JobConfigurationTrait::class); + $this->trait = \Google\Cloud\Core\Testing\impl(JobConfigurationTrait::class); } public function testJobConfigurationProperties() diff --git a/tests/unit/BigQuery/JobWaitTraitTest.php b/tests/unit/BigQuery/JobWaitTraitTest.php index 6c29a937332e..996265cb95ac 100644 --- a/tests/unit/BigQuery/JobWaitTraitTest.php +++ b/tests/unit/BigQuery/JobWaitTraitTest.php @@ -31,7 +31,7 @@ class JobWaitTraitTest extends TestCase public function setUp() { - $this->trait = \Google\Cloud\Dev\impl(JobWaitTrait::class); + $this->trait = \Google\Cloud\Core\Testing\impl(JobWaitTrait::class); $this->job = $this->prophesize(Job::class)->reveal(); } diff --git a/tests/unit/Core/ClientTraitTest.php b/tests/unit/Core/ClientTraitTest.php index c0b13f884a89..5cdd0bffbd9d 100644 --- a/tests/unit/Core/ClientTraitTest.php +++ b/tests/unit/Core/ClientTraitTest.php @@ -33,9 +33,9 @@ class ClientTraitTest extends TestCase public function setUp() { - $this->impl = \Google\Cloud\Dev\impl(ClientTrait::class); + $this->impl = \Google\Cloud\Core\Testing\impl(ClientTrait::class); - $this->dependency = \Google\Cloud\Dev\impl(ClientTraitStubGrpcDependencyChecks::class, [ + $this->dependency = \Google\Cloud\Core\Testing\impl(ClientTraitStubGrpcDependencyChecks::class, [ 'dependencyStatus' ]); } @@ -228,7 +228,7 @@ public function testDetectProjectIdOnGce() $m = $this->prophesize(Metadata::class); $m->getProjectId()->willReturn($projectId)->shouldBeCalled(); - $trait = \Google\Cloud\Dev\impl(ClientTraitStubOnGce::class, ['metadata']); + $trait = \Google\Cloud\Core\Testing\impl(ClientTraitStubOnGce::class, ['metadata']); $trait->___setProperty('metadata', $m); $res = $trait->call('detectProjectId', [[]]); @@ -246,7 +246,7 @@ public function testDetectProjectIdOnGceButOhNoThereStillIsntAProjectId() $m = $this->prophesize(Metadata::class); $m->getProjectId()->willReturn($projectId)->shouldBeCalled(); - $trait = \Google\Cloud\Dev\impl(ClientTraitStubOnGce::class, ['metadata']); + $trait = \Google\Cloud\Core\Testing\impl(ClientTraitStubOnGce::class, ['metadata']); $trait->___setProperty('metadata', $m); $res = $trait->call('detectProjectId', [[ @@ -264,7 +264,7 @@ public function testDetectProjectIdEmulator() $m = $this->prophesize(Metadata::class); $m->getProjectId()->willReturn(false)->shouldBeCalled(); - $trait = \Google\Cloud\Dev\impl(ClientTraitStubOnGce::class, ['metadata']); + $trait = \Google\Cloud\Core\Testing\impl(ClientTraitStubOnGce::class, ['metadata']); $trait->___setProperty('metadata', $m); $res = $trait->call('detectProjectId', [[ diff --git a/tests/unit/Core/ConcurrencyControlTraitTest.php b/tests/unit/Core/ConcurrencyControlTraitTest.php index ce80a7a89054..0cf32905d5f3 100644 --- a/tests/unit/Core/ConcurrencyControlTraitTest.php +++ b/tests/unit/Core/ConcurrencyControlTraitTest.php @@ -31,7 +31,7 @@ class ConcurrencyControlTraitTest extends TestCase public function setUp() { - $this->trait = \Google\Cloud\Dev\impl(ConcurrencyControlTrait::class); + $this->trait = \Google\Cloud\Core\Testing\impl(ConcurrencyControlTrait::class); } public function testApplyEtagHeader() diff --git a/tests/unit/Core/EmulatorTraitTest.php b/tests/unit/Core/EmulatorTraitTest.php index ca6e5379fc55..0bfd0723471e 100644 --- a/tests/unit/Core/EmulatorTraitTest.php +++ b/tests/unit/Core/EmulatorTraitTest.php @@ -30,7 +30,7 @@ class EmulatorTraitTest extends TestCase public function setUp() { - $this->impl = \Google\Cloud\Dev\impl(EmulatorTrait::class); + $this->impl = \Google\Cloud\Core\Testing\impl(EmulatorTrait::class); } public function testEmulatorBaseUri() diff --git a/tests/unit/Core/GrpcTraitTest.php b/tests/unit/Core/GrpcTraitTest.php index 1ead36bbb3ed..da3988e5c811 100644 --- a/tests/unit/Core/GrpcTraitTest.php +++ b/tests/unit/Core/GrpcTraitTest.php @@ -42,7 +42,7 @@ public function setUp() { $this->checkAndSkipGrpcTests(); - $this->implementation = \Google\Cloud\Dev\impl(GrpcTrait::class); + $this->implementation = \Google\Cloud\Core\Testing\impl(GrpcTrait::class); $this->requestWrapper = $this->prophesize(GrpcRequestWrapper::class); } diff --git a/tests/unit/Core/JsonTraitTest.php b/tests/unit/Core/JsonTraitTest.php index e81eb3648d91..c78062f20cad 100644 --- a/tests/unit/Core/JsonTraitTest.php +++ b/tests/unit/Core/JsonTraitTest.php @@ -29,7 +29,7 @@ class JsonTraitTest extends TestCase public function setUp() { - $this->implementation = \Google\Cloud\Dev\impl(JsonTrait::class); + $this->implementation = \Google\Cloud\Core\Testing\impl(JsonTrait::class); } public function testJsonEncode() diff --git a/tests/unit/Firestore/PathTraitTest.php b/tests/unit/Firestore/PathTraitTest.php index da6ff276c2d9..286d720e9a7a 100644 --- a/tests/unit/Firestore/PathTraitTest.php +++ b/tests/unit/Firestore/PathTraitTest.php @@ -36,7 +36,7 @@ class PathTraitTest extends TestCase public function setUp() { - $this->impl = \Google\Cloud\Dev\impl(PathTrait::class); + $this->impl = \Google\Cloud\Core\Testing\impl(PathTrait::class); } public function testFullName() diff --git a/tests/unit/Firestore/SnapshotTraitTest.php b/tests/unit/Firestore/SnapshotTraitTest.php index e6b2426354d0..ce50379ee14c 100644 --- a/tests/unit/Firestore/SnapshotTraitTest.php +++ b/tests/unit/Firestore/SnapshotTraitTest.php @@ -43,7 +43,7 @@ class SnapshotTraitTest extends TestCase public function setUp() { $this->connection = $this->prophesize(ConnectionInterface::class); - $this->impl = \Google\Cloud\Dev\impl(SnapshotTrait::class); + $this->impl = \Google\Cloud\Core\Testing\impl(SnapshotTrait::class); $this->valueMapper = new ValueMapper($this->connection->reveal(), false); } diff --git a/tests/unit/Storage/EncryptionTraitTest.php b/tests/unit/Storage/EncryptionTraitTest.php index c88a5411b9e6..655803568994 100644 --- a/tests/unit/Storage/EncryptionTraitTest.php +++ b/tests/unit/Storage/EncryptionTraitTest.php @@ -32,7 +32,7 @@ class EncryptionTraitTest extends TestCase public function setUp() { - $this->implementation = \Google\Cloud\Dev\impl(EncryptionTrait::class); + $this->implementation = \Google\Cloud\Core\Testing\impl(EncryptionTrait::class); } public function testSignString() From da1dc8638298d4810abaf578dbd9e931f2a2acc1 Mon Sep 17 00:00:00 2001 From: Michael Bausor Date: Fri, 22 Dec 2017 15:21:33 -0800 Subject: [PATCH 06/36] Rename snippet tests --- tests/snippets/BigQuery/BigQueryClientTest.php | 2 +- tests/snippets/BigQuery/BytesTest.php | 2 +- tests/snippets/BigQuery/CopyJobConfigurationTest.php | 2 +- tests/snippets/BigQuery/DatasetTest.php | 2 +- tests/snippets/BigQuery/DateTest.php | 2 +- tests/snippets/BigQuery/ExtractJobConfigurationTest.php | 2 +- tests/snippets/BigQuery/InsertResponseTest.php | 2 +- tests/snippets/BigQuery/JobTest.php | 2 +- tests/snippets/BigQuery/LoadJobConfigurationTest.php | 2 +- tests/snippets/BigQuery/QueryJobConfigurationTest.php | 2 +- tests/snippets/BigQuery/QueryResultsTest.php | 2 +- tests/snippets/BigQuery/TableTest.php | 2 +- tests/snippets/BigQuery/TimeTest.php | 2 +- tests/snippets/BigQuery/TimestampTest.php | 2 +- tests/snippets/Core/BlobTest.php | 2 +- tests/snippets/Core/Compute/MetadataTest.php | 2 +- tests/snippets/Core/DurationTest.php | 2 +- tests/snippets/Core/GeoPointTest.php | 2 +- tests/snippets/Core/Iam/IamTest.php | 2 +- tests/snippets/Core/Iam/PolicyBuilderTest.php | 2 +- tests/snippets/Core/Int64Test.php | 2 +- tests/snippets/Core/LongRunning/LongRunningOperationTest.php | 2 +- tests/snippets/Core/ServiceBuilderTest.php | 2 +- tests/snippets/Core/TimestampTest.php | 2 +- tests/snippets/Datastore/BlobTest.php | 2 +- tests/snippets/Datastore/DatastoreClientTest.php | 2 +- tests/snippets/Datastore/EntityTest.php | 2 +- tests/snippets/Datastore/GeoPointTest.php | 2 +- tests/snippets/Datastore/KeyTest.php | 2 +- tests/snippets/Datastore/Query/GqlQueryTest.php | 2 +- tests/snippets/Datastore/Query/QueryTest.php | 2 +- tests/snippets/Datastore/TransactionTest.php | 2 +- tests/snippets/Firestore/CollectionReferenceTest.php | 2 +- tests/snippets/Firestore/DocumentReferenceTest.php | 2 +- tests/snippets/Firestore/DocumentSnapshotTest.php | 2 +- tests/snippets/Firestore/FieldPathTest.php | 2 +- tests/snippets/Firestore/FieldValueTest.php | 2 +- tests/snippets/Firestore/FirestoreClientTest.php | 2 +- tests/snippets/Firestore/QuerySnapshotTest.php | 2 +- tests/snippets/Firestore/QueryTest.php | 2 +- tests/snippets/Firestore/TransactionTest.php | 2 +- tests/snippets/Firestore/WriteBatchTest.php | 2 +- tests/snippets/Language/AnnotationTest.php | 2 +- tests/snippets/Language/LanguageClientTest.php | 2 +- tests/snippets/Logging/EntryTest.php | 2 +- tests/snippets/Logging/LoggerTest.php | 2 +- tests/snippets/Logging/LoggingClientTest.php | 2 +- tests/snippets/Logging/MetricTest.php | 2 +- tests/snippets/Logging/PsrLoggerTest.php | 2 +- tests/snippets/Logging/SinkTest.php | 2 +- tests/snippets/PubSub/BatchPublisherTest.php | 2 +- tests/snippets/PubSub/MessageTest.php | 2 +- tests/snippets/PubSub/PubSubClientTest.php | 2 +- tests/snippets/PubSub/SnapshotTest.php | 2 +- tests/snippets/PubSub/SubscriptionTest.php | 2 +- tests/snippets/PubSub/TopicTest.php | 2 +- tests/snippets/Spanner/BytesTest.php | 2 +- tests/snippets/Spanner/DatabaseTest.php | 2 +- tests/snippets/Spanner/DateTest.php | 2 +- tests/snippets/Spanner/DurationTest.php | 2 +- tests/snippets/Spanner/InstanceConfigurationTest.php | 2 +- tests/snippets/Spanner/InstanceTest.php | 2 +- tests/snippets/Spanner/KeyRangeTest.php | 2 +- tests/snippets/Spanner/KeySetTest.php | 2 +- tests/snippets/Spanner/ResultTest.php | 2 +- tests/snippets/Spanner/Session/CacheSessionPoolTest.php | 2 +- tests/snippets/Spanner/SnapshotTest.php | 2 +- tests/snippets/Spanner/SpannerClientTest.php | 2 +- tests/snippets/Spanner/TimestampTest.php | 2 +- tests/snippets/Spanner/TransactionTest.php | 2 +- tests/snippets/Speech/OperationTest.php | 2 +- tests/snippets/Speech/ResultTest.php | 2 +- tests/snippets/Speech/SpeechClientTest.php | 2 +- tests/snippets/Storage/AclTest.php | 2 +- tests/snippets/Storage/BucketTest.php | 2 +- tests/snippets/Storage/NotificationTest.php | 2 +- tests/snippets/Storage/StorageClientTest.php | 2 +- tests/snippets/Storage/StorageObjectTest.php | 2 +- tests/snippets/Trace/AnnotationTest.php | 2 +- tests/snippets/Trace/AttributesTest.php | 2 +- tests/snippets/Trace/LinkTest.php | 2 +- tests/snippets/Trace/MessageEventTest.php | 2 +- tests/snippets/Trace/SpanTest.php | 2 +- tests/snippets/Trace/StackTraceTest.php | 2 +- tests/snippets/Trace/StatusTest.php | 2 +- tests/snippets/Trace/TraceClientTest.php | 2 +- tests/snippets/Trace/TraceTest.php | 2 +- tests/snippets/Translate/TranslateClientTest.php | 2 +- tests/snippets/Vision/Annotation/AbstractFeatureTest.php | 2 +- tests/snippets/Vision/Annotation/CropHintTest.php | 2 +- tests/snippets/Vision/Annotation/DocumentTest.php | 2 +- tests/snippets/Vision/Annotation/EntityTest.php | 2 +- tests/snippets/Vision/Annotation/Face/LandmarksTest.php | 2 +- tests/snippets/Vision/Annotation/FaceTest.php | 2 +- tests/snippets/Vision/Annotation/ImagePropertiesTest.php | 2 +- tests/snippets/Vision/Annotation/SafeSearchTest.php | 2 +- tests/snippets/Vision/Annotation/Web/WebEntityTest.php | 2 +- tests/snippets/Vision/Annotation/Web/WebImageTest.php | 2 +- tests/snippets/Vision/Annotation/Web/WebPageTest.php | 2 +- tests/snippets/Vision/Annotation/WebTest.php | 2 +- tests/snippets/Vision/AnnotationTest.php | 2 +- tests/snippets/Vision/ImageTest.php | 2 +- tests/snippets/Vision/VisionClientTest.php | 2 +- 103 files changed, 103 insertions(+), 103 deletions(-) diff --git a/tests/snippets/BigQuery/BigQueryClientTest.php b/tests/snippets/BigQuery/BigQueryClientTest.php index 39f7b2fa38d0..9fcffe30bdd9 100644 --- a/tests/snippets/BigQuery/BigQueryClientTest.php +++ b/tests/snippets/BigQuery/BigQueryClientTest.php @@ -30,7 +30,7 @@ use Google\Cloud\BigQuery\ValueMapper; use Google\Cloud\Core\Int64; use Google\Cloud\Core\Iterator\ItemIterator; -use Google\Cloud\Dev\Snippet\SnippetTestCase; +use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Prophecy\Argument; /** diff --git a/tests/snippets/BigQuery/BytesTest.php b/tests/snippets/BigQuery/BytesTest.php index a73958255cca..b6b690a90bae 100644 --- a/tests/snippets/BigQuery/BytesTest.php +++ b/tests/snippets/BigQuery/BytesTest.php @@ -18,7 +18,7 @@ namespace Google\Cloud\Tests\Snippets\BigQuery; use Google\Cloud\BigQuery\Bytes; -use Google\Cloud\Dev\Snippet\SnippetTestCase; +use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Prophecy\Argument; /** diff --git a/tests/snippets/BigQuery/CopyJobConfigurationTest.php b/tests/snippets/BigQuery/CopyJobConfigurationTest.php index e8958e4b6e24..c22498ba350e 100644 --- a/tests/snippets/BigQuery/CopyJobConfigurationTest.php +++ b/tests/snippets/BigQuery/CopyJobConfigurationTest.php @@ -19,7 +19,7 @@ use Google\Cloud\BigQuery\BigQueryClient; use Google\Cloud\BigQuery\CopyJobConfiguration; -use Google\Cloud\Dev\Snippet\SnippetTestCase; +use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; /** * @group bigquery diff --git a/tests/snippets/BigQuery/DatasetTest.php b/tests/snippets/BigQuery/DatasetTest.php index c40dd01f1feb..384d54ad7a38 100644 --- a/tests/snippets/BigQuery/DatasetTest.php +++ b/tests/snippets/BigQuery/DatasetTest.php @@ -22,7 +22,7 @@ use Google\Cloud\BigQuery\Table; use Google\Cloud\BigQuery\ValueMapper; use Google\Cloud\Core\Iterator\ItemIterator; -use Google\Cloud\Dev\Snippet\SnippetTestCase; +use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Prophecy\Argument; /** diff --git a/tests/snippets/BigQuery/DateTest.php b/tests/snippets/BigQuery/DateTest.php index 75035b7a7a26..9d69431f2d1b 100644 --- a/tests/snippets/BigQuery/DateTest.php +++ b/tests/snippets/BigQuery/DateTest.php @@ -18,7 +18,7 @@ namespace Google\Cloud\Tests\Snippets\BigQuery; use Google\Cloud\BigQuery\Date; -use Google\Cloud\Dev\Snippet\SnippetTestCase; +use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Prophecy\Argument; /** diff --git a/tests/snippets/BigQuery/ExtractJobConfigurationTest.php b/tests/snippets/BigQuery/ExtractJobConfigurationTest.php index 142475b2de9e..b6f8004c04b0 100644 --- a/tests/snippets/BigQuery/ExtractJobConfigurationTest.php +++ b/tests/snippets/BigQuery/ExtractJobConfigurationTest.php @@ -20,7 +20,7 @@ use Google\Cloud\BigQuery\BigQueryClient; use Google\Cloud\BigQuery\ExtractJobConfiguration; use Google\Cloud\BigQuery\Table; -use Google\Cloud\Dev\Snippet\SnippetTestCase; +use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; /** * @group bigquery diff --git a/tests/snippets/BigQuery/InsertResponseTest.php b/tests/snippets/BigQuery/InsertResponseTest.php index 18b913ab0c2f..46e836f37079 100644 --- a/tests/snippets/BigQuery/InsertResponseTest.php +++ b/tests/snippets/BigQuery/InsertResponseTest.php @@ -18,7 +18,7 @@ namespace Google\Cloud\Tests\Snippets\BigQuery; use Google\Cloud\BigQuery\InsertResponse; -use Google\Cloud\Dev\Snippet\SnippetTestCase; +use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Prophecy\Argument; /** diff --git a/tests/snippets/BigQuery/JobTest.php b/tests/snippets/BigQuery/JobTest.php index 32c6aa58d37c..3f9e7d9ce00a 100644 --- a/tests/snippets/BigQuery/JobTest.php +++ b/tests/snippets/BigQuery/JobTest.php @@ -21,7 +21,7 @@ use Google\Cloud\BigQuery\Job; use Google\Cloud\BigQuery\QueryResults; use Google\Cloud\BigQuery\ValueMapper; -use Google\Cloud\Dev\Snippet\SnippetTestCase; +use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Prophecy\Argument; /** diff --git a/tests/snippets/BigQuery/LoadJobConfigurationTest.php b/tests/snippets/BigQuery/LoadJobConfigurationTest.php index 45c90284e9cc..1e68889a5f61 100644 --- a/tests/snippets/BigQuery/LoadJobConfigurationTest.php +++ b/tests/snippets/BigQuery/LoadJobConfigurationTest.php @@ -19,7 +19,7 @@ use Google\Cloud\BigQuery\BigQueryClient; use Google\Cloud\BigQuery\LoadJobConfiguration; -use Google\Cloud\Dev\Snippet\SnippetTestCase; +use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; /** * @group bigquery diff --git a/tests/snippets/BigQuery/QueryJobConfigurationTest.php b/tests/snippets/BigQuery/QueryJobConfigurationTest.php index ebe34be2b9cb..55fdbd6f37df 100644 --- a/tests/snippets/BigQuery/QueryJobConfigurationTest.php +++ b/tests/snippets/BigQuery/QueryJobConfigurationTest.php @@ -20,7 +20,7 @@ use Google\Cloud\BigQuery\BigQueryClient; use Google\Cloud\BigQuery\QueryJobConfiguration; use Google\Cloud\BigQuery\ValueMapper; -use Google\Cloud\Dev\Snippet\SnippetTestCase; +use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; /** * @group bigquery diff --git a/tests/snippets/BigQuery/QueryResultsTest.php b/tests/snippets/BigQuery/QueryResultsTest.php index eee3fc5f858c..d19b72874ad6 100644 --- a/tests/snippets/BigQuery/QueryResultsTest.php +++ b/tests/snippets/BigQuery/QueryResultsTest.php @@ -21,7 +21,7 @@ use Google\Cloud\BigQuery\Job; use Google\Cloud\BigQuery\QueryResults; use Google\Cloud\BigQuery\ValueMapper; -use Google\Cloud\Dev\Snippet\SnippetTestCase; +use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Prophecy\Argument; /** diff --git a/tests/snippets/BigQuery/TableTest.php b/tests/snippets/BigQuery/TableTest.php index 34cc65953036..5f82eaba0d6e 100644 --- a/tests/snippets/BigQuery/TableTest.php +++ b/tests/snippets/BigQuery/TableTest.php @@ -29,7 +29,7 @@ use Google\Cloud\BigQuery\ValueMapper; use Google\Cloud\Core\Iterator\ItemIterator; use Google\Cloud\Core\Upload\MultipartUploader; -use Google\Cloud\Dev\Snippet\SnippetTestCase; +use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Storage\Connection\Rest as StorageConnection; use Google\Cloud\Storage\StorageClient; use Prophecy\Argument; diff --git a/tests/snippets/BigQuery/TimeTest.php b/tests/snippets/BigQuery/TimeTest.php index f866c26fa361..d73d1a538ed2 100644 --- a/tests/snippets/BigQuery/TimeTest.php +++ b/tests/snippets/BigQuery/TimeTest.php @@ -19,7 +19,7 @@ use Google\Cloud\BigQuery\BigQueryClient; use Google\Cloud\BigQuery\Time; -use Google\Cloud\Dev\Snippet\SnippetTestCase; +use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; /** * @group bigquery diff --git a/tests/snippets/BigQuery/TimestampTest.php b/tests/snippets/BigQuery/TimestampTest.php index 0ef7f2368ee3..7bc3affc1b1d 100644 --- a/tests/snippets/BigQuery/TimestampTest.php +++ b/tests/snippets/BigQuery/TimestampTest.php @@ -19,7 +19,7 @@ use Google\Cloud\BigQuery\BigQueryClient; use Google\Cloud\BigQuery\Timestamp; -use Google\Cloud\Dev\Snippet\SnippetTestCase; +use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; /** * @group bigquery diff --git a/tests/snippets/Core/BlobTest.php b/tests/snippets/Core/BlobTest.php index 2f5d6a227321..3d5d1eb30bd1 100644 --- a/tests/snippets/Core/BlobTest.php +++ b/tests/snippets/Core/BlobTest.php @@ -18,7 +18,7 @@ namespace Google\Cloud\Tests\Snippets\Core; use Google\Cloud\Core\Blob; -use Google\Cloud\Dev\Snippet\SnippetTestCase; +use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Psr\Http\Message\StreamInterface; /** diff --git a/tests/snippets/Core/Compute/MetadataTest.php b/tests/snippets/Core/Compute/MetadataTest.php index 9c64eb0099d4..f2e3f610e20d 100644 --- a/tests/snippets/Core/Compute/MetadataTest.php +++ b/tests/snippets/Core/Compute/MetadataTest.php @@ -19,7 +19,7 @@ use Google\Cloud\Core\Compute\Metadata; use Google\Cloud\Core\Compute\Metadata\Readers\ReaderInterface; -use Google\Cloud\Dev\Snippet\SnippetTestCase; +use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Prophecy\Argument; /** diff --git a/tests/snippets/Core/DurationTest.php b/tests/snippets/Core/DurationTest.php index fba7d1c4e8b9..8cfc2c896392 100644 --- a/tests/snippets/Core/DurationTest.php +++ b/tests/snippets/Core/DurationTest.php @@ -18,7 +18,7 @@ namespace Google\Cloud\Tests\Snippets; use Google\Cloud\Core\Duration; -use Google\Cloud\Dev\Snippet\SnippetTestCase; +use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; /** * @group core diff --git a/tests/snippets/Core/GeoPointTest.php b/tests/snippets/Core/GeoPointTest.php index 5ae9b6de5834..b683bfe55bb2 100644 --- a/tests/snippets/Core/GeoPointTest.php +++ b/tests/snippets/Core/GeoPointTest.php @@ -18,7 +18,7 @@ namespace Google\Cloud\Tests\Snippets\Core; use Google\Cloud\Core\GeoPoint; -use Google\Cloud\Dev\Snippet\SnippetTestCase; +use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; /** * @group core diff --git a/tests/snippets/Core/Iam/IamTest.php b/tests/snippets/Core/Iam/IamTest.php index 102ef6c656e0..9e1c02cf2cb8 100644 --- a/tests/snippets/Core/Iam/IamTest.php +++ b/tests/snippets/Core/Iam/IamTest.php @@ -17,7 +17,7 @@ namespace Google\Cloud\Tests\Snippets\Core\Iam; -use Google\Cloud\Dev\Snippet\SnippetTestCase; +use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Core\Iam\Iam; use Google\Cloud\Core\Iam\IamConnectionInterface; use Prophecy\Argument; diff --git a/tests/snippets/Core/Iam/PolicyBuilderTest.php b/tests/snippets/Core/Iam/PolicyBuilderTest.php index 1928836b3efa..0595b4b406ea 100644 --- a/tests/snippets/Core/Iam/PolicyBuilderTest.php +++ b/tests/snippets/Core/Iam/PolicyBuilderTest.php @@ -17,7 +17,7 @@ namespace Google\Cloud\Tests\Snippets\Core\Iam; -use Google\Cloud\Dev\Snippet\SnippetTestCase; +use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Core\Iam\PolicyBuilder; /** diff --git a/tests/snippets/Core/Int64Test.php b/tests/snippets/Core/Int64Test.php index d9d10a22f9a6..937f05eb24ad 100644 --- a/tests/snippets/Core/Int64Test.php +++ b/tests/snippets/Core/Int64Test.php @@ -17,7 +17,7 @@ namespace Google\Cloud\Tests\Snippets; -use Google\Cloud\Dev\Snippet\SnippetTestCase; +use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Core\Int64; /** diff --git a/tests/snippets/Core/LongRunning/LongRunningOperationTest.php b/tests/snippets/Core/LongRunning/LongRunningOperationTest.php index 14fe6cab18a5..4e0a917a07c7 100644 --- a/tests/snippets/Core/LongRunning/LongRunningOperationTest.php +++ b/tests/snippets/Core/LongRunning/LongRunningOperationTest.php @@ -19,7 +19,7 @@ use Google\Cloud\Core\LongRunning\LongRunningConnectionInterface; use Google\Cloud\Core\LongRunning\LongRunningOperation; -use Google\Cloud\Dev\Snippet\SnippetTestCase; +use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Prophecy\Argument; /** diff --git a/tests/snippets/Core/ServiceBuilderTest.php b/tests/snippets/Core/ServiceBuilderTest.php index 461eb632f3ce..41bb280ebf8f 100644 --- a/tests/snippets/Core/ServiceBuilderTest.php +++ b/tests/snippets/Core/ServiceBuilderTest.php @@ -20,7 +20,7 @@ use Google\Cloud\BigQuery\BigQueryClient; use Google\Cloud\Core\ServiceBuilder; use Google\Cloud\Datastore\DatastoreClient; -use Google\Cloud\Dev\Snippet\SnippetTestCase; +use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Firestore\FirestoreClient; use Google\Cloud\Language\LanguageClient; use Google\Cloud\Logging\LoggingClient; diff --git a/tests/snippets/Core/TimestampTest.php b/tests/snippets/Core/TimestampTest.php index 46707060f708..4be79903db78 100644 --- a/tests/snippets/Core/TimestampTest.php +++ b/tests/snippets/Core/TimestampTest.php @@ -18,7 +18,7 @@ namespace Google\Cloud\Tests\Snippets\Core; use Google\Cloud\Core\Timestamp; -use Google\Cloud\Dev\Snippet\SnippetTestCase; +use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; /** * @group core diff --git a/tests/snippets/Datastore/BlobTest.php b/tests/snippets/Datastore/BlobTest.php index a7b08f071ea8..cf5b4e2d0f0b 100644 --- a/tests/snippets/Datastore/BlobTest.php +++ b/tests/snippets/Datastore/BlobTest.php @@ -18,7 +18,7 @@ namespace Google\Cloud\Tests\Snippets\Datastore; use Google\Cloud\Datastore\Blob; -use Google\Cloud\Dev\Snippet\SnippetTestCase; +use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Psr\Http\Message\StreamInterface; /** diff --git a/tests/snippets/Datastore/DatastoreClientTest.php b/tests/snippets/Datastore/DatastoreClientTest.php index a7f560aecf38..eb5ee8d03808 100644 --- a/tests/snippets/Datastore/DatastoreClientTest.php +++ b/tests/snippets/Datastore/DatastoreClientTest.php @@ -29,7 +29,7 @@ use Google\Cloud\Datastore\Query\Query; use Google\Cloud\Datastore\Query\QueryInterface; use Google\Cloud\Datastore\Transaction; -use Google\Cloud\Dev\Snippet\SnippetTestCase; +use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Core\Int64; use Prophecy\Argument; diff --git a/tests/snippets/Datastore/EntityTest.php b/tests/snippets/Datastore/EntityTest.php index ce4102310c81..45c88f3a3dba 100644 --- a/tests/snippets/Datastore/EntityTest.php +++ b/tests/snippets/Datastore/EntityTest.php @@ -19,7 +19,7 @@ use Google\Cloud\Datastore\Entity; use Google\Cloud\Datastore\Key; -use Google\Cloud\Dev\Snippet\SnippetTestCase; +use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; /** * @group datastore diff --git a/tests/snippets/Datastore/GeoPointTest.php b/tests/snippets/Datastore/GeoPointTest.php index a390226c6a25..444411b3be22 100644 --- a/tests/snippets/Datastore/GeoPointTest.php +++ b/tests/snippets/Datastore/GeoPointTest.php @@ -18,7 +18,7 @@ namespace Google\Cloud\Tests\Snippets\Datastore; use Google\Cloud\Datastore\GeoPoint; -use Google\Cloud\Dev\Snippet\SnippetTestCase; +use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; /** * @group datastore diff --git a/tests/snippets/Datastore/KeyTest.php b/tests/snippets/Datastore/KeyTest.php index 3aa9c249113b..60b8d6f05859 100644 --- a/tests/snippets/Datastore/KeyTest.php +++ b/tests/snippets/Datastore/KeyTest.php @@ -19,7 +19,7 @@ use Google\Cloud\Datastore\DatastoreClient; use Google\Cloud\Datastore\Key; -use Google\Cloud\Dev\Snippet\SnippetTestCase; +use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Prophecy\Argument; /** diff --git a/tests/snippets/Datastore/Query/GqlQueryTest.php b/tests/snippets/Datastore/Query/GqlQueryTest.php index d8158e42bff9..f0ec86b1ea57 100644 --- a/tests/snippets/Datastore/Query/GqlQueryTest.php +++ b/tests/snippets/Datastore/Query/GqlQueryTest.php @@ -23,7 +23,7 @@ use Google\Cloud\Datastore\EntityMapper; use Google\Cloud\Datastore\Operation; use Google\Cloud\Datastore\Query\GqlQuery; -use Google\Cloud\Dev\Snippet\SnippetTestCase; +use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Prophecy\Argument; /** diff --git a/tests/snippets/Datastore/Query/QueryTest.php b/tests/snippets/Datastore/Query/QueryTest.php index 533537bdcb71..99b2356f98a0 100644 --- a/tests/snippets/Datastore/Query/QueryTest.php +++ b/tests/snippets/Datastore/Query/QueryTest.php @@ -24,7 +24,7 @@ use Google\Cloud\Datastore\Key; use Google\Cloud\Datastore\Operation; use Google\Cloud\Datastore\Query\Query; -use Google\Cloud\Dev\Snippet\SnippetTestCase; +use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Prophecy\Argument; /** diff --git a/tests/snippets/Datastore/TransactionTest.php b/tests/snippets/Datastore/TransactionTest.php index edbd95983ce9..e518597362c8 100644 --- a/tests/snippets/Datastore/TransactionTest.php +++ b/tests/snippets/Datastore/TransactionTest.php @@ -24,7 +24,7 @@ use Google\Cloud\Datastore\Operation; use Google\Cloud\Datastore\Query\QueryInterface; use Google\Cloud\Datastore\Transaction; -use Google\Cloud\Dev\Snippet\SnippetTestCase; +use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Prophecy\Argument; /** diff --git a/tests/snippets/Firestore/CollectionReferenceTest.php b/tests/snippets/Firestore/CollectionReferenceTest.php index 497a74368ce9..8b0831f7bbf9 100644 --- a/tests/snippets/Firestore/CollectionReferenceTest.php +++ b/tests/snippets/Firestore/CollectionReferenceTest.php @@ -21,7 +21,7 @@ use Google\Cloud\Firestore\Query; use Google\Cloud\Core\Testing\GrpcTestTrait; use Google\Cloud\Firestore\ValueMapper; -use Google\Cloud\Dev\Snippet\SnippetTestCase; +use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Firestore\DocumentReference; use Google\Cloud\Firestore\CollectionReference; use Google\Cloud\Firestore\Connection\ConnectionInterface; diff --git a/tests/snippets/Firestore/DocumentReferenceTest.php b/tests/snippets/Firestore/DocumentReferenceTest.php index 12842ffbd339..5cff140f4590 100644 --- a/tests/snippets/Firestore/DocumentReferenceTest.php +++ b/tests/snippets/Firestore/DocumentReferenceTest.php @@ -17,7 +17,7 @@ namespace Google\Cloud\Tests\Snippets\Firestore; -use Google\Cloud\Dev\Snippet\SnippetTestCase; +use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Firestore\CollectionReference; use Google\Cloud\Firestore\Connection\ConnectionInterface; use Google\Cloud\Firestore\DocumentReference; diff --git a/tests/snippets/Firestore/DocumentSnapshotTest.php b/tests/snippets/Firestore/DocumentSnapshotTest.php index a02f7644cca3..4b2a296acb0e 100644 --- a/tests/snippets/Firestore/DocumentSnapshotTest.php +++ b/tests/snippets/Firestore/DocumentSnapshotTest.php @@ -18,7 +18,7 @@ namespace Google\Cloud\Tests\Snippets\Firestore; use Google\Cloud\Core\Timestamp; -use Google\Cloud\Dev\Snippet\SnippetTestCase; +use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Firestore\Connection\ConnectionInterface; use Google\Cloud\Firestore\DocumentReference; use Google\Cloud\Firestore\DocumentSnapshot; diff --git a/tests/snippets/Firestore/FieldPathTest.php b/tests/snippets/Firestore/FieldPathTest.php index ffef6e60d4c4..6f411b56b4c9 100644 --- a/tests/snippets/Firestore/FieldPathTest.php +++ b/tests/snippets/Firestore/FieldPathTest.php @@ -19,7 +19,7 @@ use Google\Cloud\Firestore\FieldPath; use Google\Cloud\Core\Testing\GrpcTestTrait; -use Google\Cloud\Dev\Snippet\SnippetTestCase; +use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; /** * @group firestore diff --git a/tests/snippets/Firestore/FieldValueTest.php b/tests/snippets/Firestore/FieldValueTest.php index c878134e76ee..355594cb9d75 100644 --- a/tests/snippets/Firestore/FieldValueTest.php +++ b/tests/snippets/Firestore/FieldValueTest.php @@ -21,7 +21,7 @@ use Google\Cloud\Core\Testing\GrpcTestTrait; use Google\Cloud\Firestore\FieldValue; use Google\Cloud\Firestore\FirestoreClient; -use Google\Cloud\Dev\Snippet\SnippetTestCase; +use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Firestore\Connection\ConnectionInterface; use Google\Cloud\Firestore\V1beta1\DocumentTransform_FieldTransform_ServerValue; diff --git a/tests/snippets/Firestore/FirestoreClientTest.php b/tests/snippets/Firestore/FirestoreClientTest.php index 56bab83bbda4..a0f333580f1b 100644 --- a/tests/snippets/Firestore/FirestoreClientTest.php +++ b/tests/snippets/Firestore/FirestoreClientTest.php @@ -27,7 +27,7 @@ use Google\Cloud\Firestore\FirestoreClient; use Google\Cloud\Core\Iterator\ItemIterator; use Google\Cloud\Firestore\DocumentSnapshot; -use Google\Cloud\Dev\Snippet\SnippetTestCase; +use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Firestore\DocumentReference; use Google\Cloud\Firestore\CollectionReference; use Google\Cloud\Firestore\Connection\ConnectionInterface; diff --git a/tests/snippets/Firestore/QuerySnapshotTest.php b/tests/snippets/Firestore/QuerySnapshotTest.php index 1cdf4eb3c092..f81f2c5cbea9 100644 --- a/tests/snippets/Firestore/QuerySnapshotTest.php +++ b/tests/snippets/Firestore/QuerySnapshotTest.php @@ -17,7 +17,7 @@ namespace Google\Cloud\Tests\Snippets\Firestore; -use Google\Cloud\Dev\Snippet\SnippetTestCase; +use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Firestore\Connection\ConnectionInterface; use Google\Cloud\Firestore\FirestoreClient; use Google\Cloud\Firestore\Query; diff --git a/tests/snippets/Firestore/QueryTest.php b/tests/snippets/Firestore/QueryTest.php index d534bdbe780f..b7055ca69a9b 100644 --- a/tests/snippets/Firestore/QueryTest.php +++ b/tests/snippets/Firestore/QueryTest.php @@ -23,7 +23,7 @@ use Google\Cloud\Firestore\ValueMapper; use Google\Cloud\Firestore\QuerySnapshot; use Google\Cloud\Dev\Snippet\Parser\Snippet; -use Google\Cloud\Dev\Snippet\SnippetTestCase; +use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Firestore\Connection\ConnectionInterface; use Google\Cloud\Firestore\V1beta1\StructuredQuery_CompositeFilter_Operator; diff --git a/tests/snippets/Firestore/TransactionTest.php b/tests/snippets/Firestore/TransactionTest.php index 97d4a7925f93..4fe6800b97de 100644 --- a/tests/snippets/Firestore/TransactionTest.php +++ b/tests/snippets/Firestore/TransactionTest.php @@ -17,7 +17,7 @@ namespace Google\Cloud\Tests\Snippets\Firestore; -use Google\Cloud\Dev\Snippet\SnippetTestCase; +use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Firestore\CollectionReference; use Google\Cloud\Firestore\Connection\ConnectionInterface; use Google\Cloud\Firestore\DocumentReference; diff --git a/tests/snippets/Firestore/WriteBatchTest.php b/tests/snippets/Firestore/WriteBatchTest.php index db950cf245c0..dce65c9e3d58 100644 --- a/tests/snippets/Firestore/WriteBatchTest.php +++ b/tests/snippets/Firestore/WriteBatchTest.php @@ -18,7 +18,7 @@ namespace Google\Cloud\Tests\Snippets\Firestore; use Google\Cloud\Dev\Snippet\Parser\Snippet; -use Google\Cloud\Dev\Snippet\SnippetTestCase; +use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Firestore\Connection\ConnectionInterface; use Google\Cloud\Firestore\ValueMapper; use Google\Cloud\Firestore\WriteBatch; diff --git a/tests/snippets/Language/AnnotationTest.php b/tests/snippets/Language/AnnotationTest.php index 6ae606faa525..5a871c5068a5 100644 --- a/tests/snippets/Language/AnnotationTest.php +++ b/tests/snippets/Language/AnnotationTest.php @@ -17,7 +17,7 @@ namespace Google\Cloud\Tests\Snippets\Language; -use Google\Cloud\Dev\Snippet\SnippetTestCase; +use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Language\Annotation; use Google\Cloud\Language\Connection\ConnectionInterface; use Prophecy\Argument; diff --git a/tests/snippets/Language/LanguageClientTest.php b/tests/snippets/Language/LanguageClientTest.php index ce4d78951947..58c3dc205ac0 100644 --- a/tests/snippets/Language/LanguageClientTest.php +++ b/tests/snippets/Language/LanguageClientTest.php @@ -17,7 +17,7 @@ namespace Google\Cloud\Tests\Snippets\Language; -use Google\Cloud\Dev\Snippet\SnippetTestCase; +use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Language\Connection\ConnectionInterface; use Google\Cloud\Language\LanguageClient; use Prophecy\Argument; diff --git a/tests/snippets/Logging/EntryTest.php b/tests/snippets/Logging/EntryTest.php index 5b7c860092dc..75565df32a4e 100644 --- a/tests/snippets/Logging/EntryTest.php +++ b/tests/snippets/Logging/EntryTest.php @@ -17,7 +17,7 @@ namespace Google\Cloud\Tests\Snippets\Logging; -use Google\Cloud\Dev\Snippet\SnippetTestCase; +use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Logging\Entry; /** diff --git a/tests/snippets/Logging/LoggerTest.php b/tests/snippets/Logging/LoggerTest.php index 208faa3eb353..9b8c19a4b748 100644 --- a/tests/snippets/Logging/LoggerTest.php +++ b/tests/snippets/Logging/LoggerTest.php @@ -17,7 +17,7 @@ namespace Google\Cloud\Tests\Snippets\Logging; -use Google\Cloud\Dev\Snippet\SnippetTestCase; +use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Logging\Connection\ConnectionInterface; use Google\Cloud\Logging\Entry; use Google\Cloud\Logging\Logger; diff --git a/tests/snippets/Logging/LoggingClientTest.php b/tests/snippets/Logging/LoggingClientTest.php index 20812367824f..4be877be7552 100644 --- a/tests/snippets/Logging/LoggingClientTest.php +++ b/tests/snippets/Logging/LoggingClientTest.php @@ -17,7 +17,7 @@ namespace Google\Cloud\Tests\Snippets\Logging; -use Google\Cloud\Dev\Snippet\SnippetTestCase; +use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Logging\Connection\ConnectionInterface; use Google\Cloud\Logging\Logger; use Google\Cloud\Logging\LoggingClient; diff --git a/tests/snippets/Logging/MetricTest.php b/tests/snippets/Logging/MetricTest.php index be571bf592ef..b12d8393c933 100644 --- a/tests/snippets/Logging/MetricTest.php +++ b/tests/snippets/Logging/MetricTest.php @@ -17,7 +17,7 @@ namespace Google\Cloud\Tests\Snippets\Logging; -use Google\Cloud\Dev\Snippet\SnippetTestCase; +use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Logging\Connection\ConnectionInterface; use Google\Cloud\Logging\Metric; use Prophecy\Argument; diff --git a/tests/snippets/Logging/PsrLoggerTest.php b/tests/snippets/Logging/PsrLoggerTest.php index 7d7a124d4fab..4aac6200747c 100644 --- a/tests/snippets/Logging/PsrLoggerTest.php +++ b/tests/snippets/Logging/PsrLoggerTest.php @@ -17,7 +17,7 @@ namespace Google\Cloud\Tests\Snippets\Logging; -use Google\Cloud\Dev\Snippet\SnippetTestCase; +use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Logging\Connection\ConnectionInterface; use Google\Cloud\Logging\Logger; use Google\Cloud\Logging\PsrLogger; diff --git a/tests/snippets/Logging/SinkTest.php b/tests/snippets/Logging/SinkTest.php index 2fa580d57567..49b4b3457972 100644 --- a/tests/snippets/Logging/SinkTest.php +++ b/tests/snippets/Logging/SinkTest.php @@ -17,7 +17,7 @@ namespace Google\Cloud\Tests\Snippets\Logging; -use Google\Cloud\Dev\Snippet\SnippetTestCase; +use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Logging\Connection\ConnectionInterface; use Google\Cloud\Logging\Sink; use Prophecy\Argument; diff --git a/tests/snippets/PubSub/BatchPublisherTest.php b/tests/snippets/PubSub/BatchPublisherTest.php index 8ff1429f22d7..226d136b0106 100644 --- a/tests/snippets/PubSub/BatchPublisherTest.php +++ b/tests/snippets/PubSub/BatchPublisherTest.php @@ -17,7 +17,7 @@ namespace Google\Cloud\Tests\Snippets\PubSub; -use Google\Cloud\Dev\Snippet\SnippetTestCase; +use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\PubSub\BatchPublisher; use Google\Cloud\PubSub\PubSubClient; use Google\Cloud\PubSub\Topic; diff --git a/tests/snippets/PubSub/MessageTest.php b/tests/snippets/PubSub/MessageTest.php index 0a256e5e3138..459e1d1c0b9b 100644 --- a/tests/snippets/PubSub/MessageTest.php +++ b/tests/snippets/PubSub/MessageTest.php @@ -17,7 +17,7 @@ namespace Google\Cloud\Tests\Snippets\PubSub; -use Google\Cloud\Dev\Snippet\SnippetTestCase; +use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\PubSub\Connection\ConnectionInterface; use Google\Cloud\PubSub\Message; use Google\Cloud\PubSub\Subscription; diff --git a/tests/snippets/PubSub/PubSubClientTest.php b/tests/snippets/PubSub/PubSubClientTest.php index b924288649f2..347b894e7af1 100644 --- a/tests/snippets/PubSub/PubSubClientTest.php +++ b/tests/snippets/PubSub/PubSubClientTest.php @@ -21,7 +21,7 @@ use Google\Cloud\Core\Iterator\ItemIterator; use Google\Cloud\Core\Timestamp; use Google\Cloud\Dev\SetStubConnectionTrait; -use Google\Cloud\Dev\Snippet\SnippetTestCase; +use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\PubSub\Connection\ConnectionInterface; use Google\Cloud\PubSub\Message; use Google\Cloud\PubSub\PubSubClient; diff --git a/tests/snippets/PubSub/SnapshotTest.php b/tests/snippets/PubSub/SnapshotTest.php index 4e19fc6494f1..e195d8d9a262 100644 --- a/tests/snippets/PubSub/SnapshotTest.php +++ b/tests/snippets/PubSub/SnapshotTest.php @@ -17,7 +17,7 @@ namespace Google\Cloud\Tests\Snippets\PubSub; -use Google\Cloud\Dev\Snippet\SnippetTestCase; +use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\PubSub\Connection\ConnectionInterface; use Google\Cloud\PubSub\Snapshot; use Google\Cloud\PubSub\Subscription; diff --git a/tests/snippets/PubSub/SubscriptionTest.php b/tests/snippets/PubSub/SubscriptionTest.php index 44203cc1c80e..21031c3ef18a 100644 --- a/tests/snippets/PubSub/SubscriptionTest.php +++ b/tests/snippets/PubSub/SubscriptionTest.php @@ -18,7 +18,7 @@ namespace Google\Cloud\Tests\Snippets\PubSub; use Google\Cloud\Dev\SetStubConnectionTrait; -use Google\Cloud\Dev\Snippet\SnippetTestCase; +use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Core\Iam\Iam; use Google\Cloud\PubSub\Connection\ConnectionInterface; use Google\Cloud\PubSub\Message; diff --git a/tests/snippets/PubSub/TopicTest.php b/tests/snippets/PubSub/TopicTest.php index 32e9a82a5326..e4cf788d1b5f 100644 --- a/tests/snippets/PubSub/TopicTest.php +++ b/tests/snippets/PubSub/TopicTest.php @@ -18,7 +18,7 @@ namespace Google\Cloud\Tests\Snippets\PubSub; use Google\Cloud\Core\Iam\Iam; -use Google\Cloud\Dev\Snippet\SnippetTestCase; +use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\PubSub\Connection\ConnectionInterface; use Google\Cloud\PubSub\BatchPublisher; use Google\Cloud\PubSub\PubSubClient; diff --git a/tests/snippets/Spanner/BytesTest.php b/tests/snippets/Spanner/BytesTest.php index e324b40816c6..1698e2e26e62 100644 --- a/tests/snippets/Spanner/BytesTest.php +++ b/tests/snippets/Spanner/BytesTest.php @@ -17,7 +17,7 @@ namespace Google\Cloud\Tests\Snippets\Spanner; -use Google\Cloud\Dev\Snippet\SnippetTestCase; +use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Spanner\Bytes; use Google\Cloud\Spanner\Database; use Google\Cloud\Spanner\ValueMapper; diff --git a/tests/snippets/Spanner/DatabaseTest.php b/tests/snippets/Spanner/DatabaseTest.php index 6d71f5999bb9..f510175afde6 100644 --- a/tests/snippets/Spanner/DatabaseTest.php +++ b/tests/snippets/Spanner/DatabaseTest.php @@ -21,7 +21,7 @@ use Google\Cloud\Core\Iterator\ItemIterator; use Google\Cloud\Core\LongRunning\LongRunningConnectionInterface; use Google\Cloud\Core\LongRunning\LongRunningOperation; -use Google\Cloud\Dev\Snippet\SnippetTestCase; +use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Spanner\Admin\Database\V1\DatabaseAdminClient; use Google\Cloud\Spanner\Admin\Instance\V1\InstanceAdminClient; use Google\Cloud\Spanner\Connection\ConnectionInterface; diff --git a/tests/snippets/Spanner/DateTest.php b/tests/snippets/Spanner/DateTest.php index 83993bfbca7a..3514d074c1ee 100644 --- a/tests/snippets/Spanner/DateTest.php +++ b/tests/snippets/Spanner/DateTest.php @@ -17,7 +17,7 @@ namespace Google\Cloud\Tests\Snippets\Spanner; -use Google\Cloud\Dev\Snippet\SnippetTestCase; +use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Spanner\Database; use Google\Cloud\Spanner\Date; use Google\Cloud\Spanner\ValueMapper; diff --git a/tests/snippets/Spanner/DurationTest.php b/tests/snippets/Spanner/DurationTest.php index 7add2c7933ad..84078b42dfc1 100644 --- a/tests/snippets/Spanner/DurationTest.php +++ b/tests/snippets/Spanner/DurationTest.php @@ -17,7 +17,7 @@ namespace Google\Cloud\Tests\Snippets\Spanner; -use Google\Cloud\Dev\Snippet\SnippetTestCase; +use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Spanner\Duration; use Google\Cloud\Core\Testing\GrpcTestTrait; diff --git a/tests/snippets/Spanner/InstanceConfigurationTest.php b/tests/snippets/Spanner/InstanceConfigurationTest.php index 0c4a6f961f5f..193762998879 100644 --- a/tests/snippets/Spanner/InstanceConfigurationTest.php +++ b/tests/snippets/Spanner/InstanceConfigurationTest.php @@ -17,7 +17,7 @@ namespace Google\Cloud\Tests\Snippets\Spanner; -use Google\Cloud\Dev\Snippet\SnippetTestCase; +use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Spanner\Admin\Instance\V1\InstanceAdminClient; use Google\Cloud\Spanner\Connection\ConnectionInterface; use Google\Cloud\Spanner\InstanceConfiguration; diff --git a/tests/snippets/Spanner/InstanceTest.php b/tests/snippets/Spanner/InstanceTest.php index 7077ae872b45..0d722176b01d 100644 --- a/tests/snippets/Spanner/InstanceTest.php +++ b/tests/snippets/Spanner/InstanceTest.php @@ -21,7 +21,7 @@ use Google\Cloud\Core\Iterator\ItemIterator; use Google\Cloud\Core\LongRunning\LongRunningConnectionInterface; use Google\Cloud\Core\LongRunning\LongRunningOperation; -use Google\Cloud\Dev\Snippet\SnippetTestCase; +use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Spanner\Admin\Database\V1\DatabaseAdminClient; use Google\Cloud\Spanner\Admin\Instance\V1\InstanceAdminClient; use Google\Cloud\Spanner\Connection\ConnectionInterface; diff --git a/tests/snippets/Spanner/KeyRangeTest.php b/tests/snippets/Spanner/KeyRangeTest.php index 8124f57b9677..521872ac8d73 100644 --- a/tests/snippets/Spanner/KeyRangeTest.php +++ b/tests/snippets/Spanner/KeyRangeTest.php @@ -17,7 +17,7 @@ namespace Google\Cloud\Tests\Snippets\Spanner; -use Google\Cloud\Dev\Snippet\SnippetTestCase; +use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Spanner\KeyRange; use Google\Cloud\Core\Testing\GrpcTestTrait; diff --git a/tests/snippets/Spanner/KeySetTest.php b/tests/snippets/Spanner/KeySetTest.php index 06698f78aed0..b8eb0221846d 100644 --- a/tests/snippets/Spanner/KeySetTest.php +++ b/tests/snippets/Spanner/KeySetTest.php @@ -17,7 +17,7 @@ namespace Google\Cloud\Tests\Snippets\Spanner; -use Google\Cloud\Dev\Snippet\SnippetTestCase; +use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Spanner\KeyRange; use Google\Cloud\Spanner\KeySet; use Google\Cloud\Core\Testing\GrpcTestTrait; diff --git a/tests/snippets/Spanner/ResultTest.php b/tests/snippets/Spanner/ResultTest.php index 2e7e75630fae..162cfaff943c 100644 --- a/tests/snippets/Spanner/ResultTest.php +++ b/tests/snippets/Spanner/ResultTest.php @@ -17,7 +17,7 @@ namespace Google\Cloud\Tests\Snippets\Spanner; -use Google\Cloud\Dev\Snippet\SnippetTestCase; +use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Spanner\Database; use Google\Cloud\Spanner\Operation; use Google\Cloud\Spanner\Result; diff --git a/tests/snippets/Spanner/Session/CacheSessionPoolTest.php b/tests/snippets/Spanner/Session/CacheSessionPoolTest.php index 1849221e57af..302670c59991 100644 --- a/tests/snippets/Spanner/Session/CacheSessionPoolTest.php +++ b/tests/snippets/Spanner/Session/CacheSessionPoolTest.php @@ -18,7 +18,7 @@ namespace Google\Cloud\Tests\Snippets\Spanner; use Google\Auth\Cache\MemoryCacheItemPool; -use Google\Cloud\Dev\Snippet\SnippetTestCase; +use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Spanner\Database; use Google\Cloud\Spanner\Session\CacheSessionPool; diff --git a/tests/snippets/Spanner/SnapshotTest.php b/tests/snippets/Spanner/SnapshotTest.php index 52a7460c94fb..0816b3e1614c 100644 --- a/tests/snippets/Spanner/SnapshotTest.php +++ b/tests/snippets/Spanner/SnapshotTest.php @@ -17,7 +17,7 @@ namespace Google\Cloud\Tests\Snippets\Spanner; -use Google\Cloud\Dev\Snippet\SnippetTestCase; +use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Spanner\Connection\ConnectionInterface; use Google\Cloud\Spanner\Database; use Google\Cloud\Spanner\KeySet; diff --git a/tests/snippets/Spanner/SpannerClientTest.php b/tests/snippets/Spanner/SpannerClientTest.php index 64b0d10f0da9..d584b87d501b 100644 --- a/tests/snippets/Spanner/SpannerClientTest.php +++ b/tests/snippets/Spanner/SpannerClientTest.php @@ -20,7 +20,7 @@ use Google\Cloud\Core\Int64; use Google\Cloud\Core\Iterator\ItemIterator; use Google\Cloud\Core\LongRunning\LongRunningOperation; -use Google\Cloud\Dev\Snippet\SnippetTestCase; +use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Spanner\Admin\Instance\V1\InstanceAdminClient; use Google\Cloud\Spanner\Bytes; use Google\Cloud\Spanner\Connection\ConnectionInterface; diff --git a/tests/snippets/Spanner/TimestampTest.php b/tests/snippets/Spanner/TimestampTest.php index dfdf14c2ac57..59650b7e7151 100644 --- a/tests/snippets/Spanner/TimestampTest.php +++ b/tests/snippets/Spanner/TimestampTest.php @@ -17,7 +17,7 @@ namespace Google\Cloud\Tests\Snippets\Spanner; -use Google\Cloud\Dev\Snippet\SnippetTestCase; +use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Spanner\Database; use Google\Cloud\Spanner\Timestamp; use Google\Cloud\Spanner\ValueMapper; diff --git a/tests/snippets/Spanner/TransactionTest.php b/tests/snippets/Spanner/TransactionTest.php index 745553b8c043..34d759a8e3fd 100644 --- a/tests/snippets/Spanner/TransactionTest.php +++ b/tests/snippets/Spanner/TransactionTest.php @@ -17,7 +17,7 @@ namespace Google\Cloud\Tests\Snippets\Spanner; -use Google\Cloud\Dev\Snippet\SnippetTestCase; +use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Spanner\Connection\ConnectionInterface; use Google\Cloud\Spanner\Database; use Google\Cloud\Spanner\KeySet; diff --git a/tests/snippets/Speech/OperationTest.php b/tests/snippets/Speech/OperationTest.php index d3c036ceeff0..b0d13a3dd7e7 100644 --- a/tests/snippets/Speech/OperationTest.php +++ b/tests/snippets/Speech/OperationTest.php @@ -17,7 +17,7 @@ namespace Google\Cloud\Tests\Snippets\Speech; -use Google\Cloud\Dev\Snippet\SnippetTestCase; +use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Speech\Connection\ConnectionInterface; use Google\Cloud\Speech\Operation; use Google\Cloud\Speech\Result; diff --git a/tests/snippets/Speech/ResultTest.php b/tests/snippets/Speech/ResultTest.php index a5b55fcbd727..c46c84182553 100644 --- a/tests/snippets/Speech/ResultTest.php +++ b/tests/snippets/Speech/ResultTest.php @@ -17,7 +17,7 @@ namespace Google\Cloud\Tests\Snippets\Speech; -use Google\Cloud\Dev\Snippet\SnippetTestCase; +use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Speech\Connection\ConnectionInterface; use Google\Cloud\Speech\Result; use Prophecy\Argument; diff --git a/tests/snippets/Speech/SpeechClientTest.php b/tests/snippets/Speech/SpeechClientTest.php index 31e0c9d00649..0f345a96e511 100644 --- a/tests/snippets/Speech/SpeechClientTest.php +++ b/tests/snippets/Speech/SpeechClientTest.php @@ -17,7 +17,7 @@ namespace Google\Cloud\Tests\Snippets\Speech; -use Google\Cloud\Dev\Snippet\SnippetTestCase; +use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Speech\Connection\ConnectionInterface; use Google\Cloud\Speech\Operation; use Google\Cloud\Speech\SpeechClient; diff --git a/tests/snippets/Storage/AclTest.php b/tests/snippets/Storage/AclTest.php index be9d90a782df..35972580ad5d 100644 --- a/tests/snippets/Storage/AclTest.php +++ b/tests/snippets/Storage/AclTest.php @@ -17,7 +17,7 @@ namespace Google\Cloud\Tests\Snippets\Storage; -use Google\Cloud\Dev\Snippet\SnippetTestCase; +use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Storage\Acl; use Google\Cloud\Storage\Connection\ConnectionInterface; use Prophecy\Argument; diff --git a/tests/snippets/Storage/BucketTest.php b/tests/snippets/Storage/BucketTest.php index c87161f73349..fc8ee700e805 100644 --- a/tests/snippets/Storage/BucketTest.php +++ b/tests/snippets/Storage/BucketTest.php @@ -23,7 +23,7 @@ use Google\Cloud\Core\Upload\MultipartUploader; use Google\Cloud\Core\Upload\ResumableUploader; use Google\Cloud\Core\Upload\StreamableUploader; -use Google\Cloud\Dev\Snippet\SnippetTestCase; +use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\PubSub\PubSubClient; use Google\Cloud\PubSub\Topic; use Google\Cloud\Storage\Acl; diff --git a/tests/snippets/Storage/NotificationTest.php b/tests/snippets/Storage/NotificationTest.php index 14c49f776965..f112a982ad17 100644 --- a/tests/snippets/Storage/NotificationTest.php +++ b/tests/snippets/Storage/NotificationTest.php @@ -17,7 +17,7 @@ namespace Google\Cloud\Tests\Snippets\Storage; -use Google\Cloud\Dev\Snippet\SnippetTestCase; +use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\PubSub\PubSubClient; use Google\Cloud\PubSub\Topic; use Google\Cloud\Storage\Acl; diff --git a/tests/snippets/Storage/StorageClientTest.php b/tests/snippets/Storage/StorageClientTest.php index 7cbd5674aafb..f121605ee230 100644 --- a/tests/snippets/Storage/StorageClientTest.php +++ b/tests/snippets/Storage/StorageClientTest.php @@ -21,7 +21,7 @@ use Google\Cloud\Core\RequestWrapper; use Google\Cloud\Core\Timestamp; use Google\Cloud\Core\Upload\SignedUrlUploader; -use Google\Cloud\Dev\Snippet\SnippetTestCase; +use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Storage\Bucket; use Google\Cloud\Storage\Connection\Rest; use Google\Cloud\Storage\StorageClient; diff --git a/tests/snippets/Storage/StorageObjectTest.php b/tests/snippets/Storage/StorageObjectTest.php index c4e02f3fd2a6..a98de934afd0 100644 --- a/tests/snippets/Storage/StorageObjectTest.php +++ b/tests/snippets/Storage/StorageObjectTest.php @@ -19,7 +19,7 @@ use Google\Cloud\Core\RequestWrapper; use Google\Cloud\Core\Timestamp; -use Google\Cloud\Dev\Snippet\SnippetTestCase; +use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Storage\Acl; use Google\Cloud\Storage\Bucket; use Google\Cloud\Storage\Connection\Rest; diff --git a/tests/snippets/Trace/AnnotationTest.php b/tests/snippets/Trace/AnnotationTest.php index 096a3ee53c67..6b4c17e0b383 100644 --- a/tests/snippets/Trace/AnnotationTest.php +++ b/tests/snippets/Trace/AnnotationTest.php @@ -17,7 +17,7 @@ namespace Google\Cloud\Tests\Snippets\Trace; -use Google\Cloud\Dev\Snippet\SnippetTestCase; +use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Trace\Annotation; use Google\Cloud\Trace\Span; use Prophecy\Argument; diff --git a/tests/snippets/Trace/AttributesTest.php b/tests/snippets/Trace/AttributesTest.php index 37abcdaee01c..492d57bb48ff 100644 --- a/tests/snippets/Trace/AttributesTest.php +++ b/tests/snippets/Trace/AttributesTest.php @@ -17,7 +17,7 @@ namespace Google\Cloud\Tests\Snippets\Trace; -use Google\Cloud\Dev\Snippet\SnippetTestCase; +use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Trace\Attributes; use Prophecy\Argument; diff --git a/tests/snippets/Trace/LinkTest.php b/tests/snippets/Trace/LinkTest.php index 29273219fc49..7e3eadd4bf4e 100644 --- a/tests/snippets/Trace/LinkTest.php +++ b/tests/snippets/Trace/LinkTest.php @@ -17,7 +17,7 @@ namespace Google\Cloud\Tests\Snippets\Trace; -use Google\Cloud\Dev\Snippet\SnippetTestCase; +use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Trace\Link; use Google\Cloud\Trace\Span; use Prophecy\Argument; diff --git a/tests/snippets/Trace/MessageEventTest.php b/tests/snippets/Trace/MessageEventTest.php index 4907c348be1d..da2a195e2b77 100644 --- a/tests/snippets/Trace/MessageEventTest.php +++ b/tests/snippets/Trace/MessageEventTest.php @@ -17,7 +17,7 @@ namespace Google\Cloud\Tests\Snippets\Trace; -use Google\Cloud\Dev\Snippet\SnippetTestCase; +use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Trace\MessageEvent; use Google\Cloud\Trace\Span; use Prophecy\Argument; diff --git a/tests/snippets/Trace/SpanTest.php b/tests/snippets/Trace/SpanTest.php index 6dff1e77547e..664554f6f081 100644 --- a/tests/snippets/Trace/SpanTest.php +++ b/tests/snippets/Trace/SpanTest.php @@ -17,7 +17,7 @@ namespace Google\Cloud\Tests\Snippets\Trace; -use Google\Cloud\Dev\Snippet\SnippetTestCase; +use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Trace\Annotation; use Google\Cloud\Trace\Link; use Google\Cloud\Trace\MessageEvent; diff --git a/tests/snippets/Trace/StackTraceTest.php b/tests/snippets/Trace/StackTraceTest.php index 4aa0ef6497fe..542915212cd9 100644 --- a/tests/snippets/Trace/StackTraceTest.php +++ b/tests/snippets/Trace/StackTraceTest.php @@ -17,7 +17,7 @@ namespace Google\Cloud\Tests\Snippets\Trace; -use Google\Cloud\Dev\Snippet\SnippetTestCase; +use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Trace\StackTrace; use Prophecy\Argument; diff --git a/tests/snippets/Trace/StatusTest.php b/tests/snippets/Trace/StatusTest.php index 61e1b6ee9010..096ab4cd35cc 100644 --- a/tests/snippets/Trace/StatusTest.php +++ b/tests/snippets/Trace/StatusTest.php @@ -17,7 +17,7 @@ namespace Google\Cloud\Tests\Snippets\Trace; -use Google\Cloud\Dev\Snippet\SnippetTestCase; +use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Trace\Status; use Prophecy\Argument; diff --git a/tests/snippets/Trace/TraceClientTest.php b/tests/snippets/Trace/TraceClientTest.php index df6ac2c40d11..f2d3d206b1d6 100644 --- a/tests/snippets/Trace/TraceClientTest.php +++ b/tests/snippets/Trace/TraceClientTest.php @@ -17,7 +17,7 @@ namespace Google\Cloud\Tests\Snippets\Trace; -use Google\Cloud\Dev\Snippet\SnippetTestCase; +use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Trace\Connection\ConnectionInterface; use Google\Cloud\Trace\Trace; use Google\Cloud\Trace\TraceClient; diff --git a/tests/snippets/Trace/TraceTest.php b/tests/snippets/Trace/TraceTest.php index 99279e00d911..23162c9fe025 100644 --- a/tests/snippets/Trace/TraceTest.php +++ b/tests/snippets/Trace/TraceTest.php @@ -17,7 +17,7 @@ namespace Google\Cloud\Tests\Snippets\Trace; -use Google\Cloud\Dev\Snippet\SnippetTestCase; +use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Trace\Span; use Google\Cloud\Trace\Trace; use Prophecy\Argument; diff --git a/tests/snippets/Translate/TranslateClientTest.php b/tests/snippets/Translate/TranslateClientTest.php index 90e86349f077..7b6bd53bf5d1 100644 --- a/tests/snippets/Translate/TranslateClientTest.php +++ b/tests/snippets/Translate/TranslateClientTest.php @@ -17,7 +17,7 @@ namespace Google\Cloud\Tests\Snippets\Translate; -use Google\Cloud\Dev\Snippet\SnippetTestCase; +use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Translate\Connection\ConnectionInterface; use Google\Cloud\Translate\TranslateClient; use Prophecy\Argument; diff --git a/tests/snippets/Vision/Annotation/AbstractFeatureTest.php b/tests/snippets/Vision/Annotation/AbstractFeatureTest.php index 5d4820e7e131..4198e6b81421 100644 --- a/tests/snippets/Vision/Annotation/AbstractFeatureTest.php +++ b/tests/snippets/Vision/Annotation/AbstractFeatureTest.php @@ -17,7 +17,7 @@ namespace Google\Cloud\Tests\Snippets\Vision\Annotation; -use Google\Cloud\Dev\Snippet\SnippetTestCase; +use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Vision\Annotation\AbstractFeature; /** diff --git a/tests/snippets/Vision/Annotation/CropHintTest.php b/tests/snippets/Vision/Annotation/CropHintTest.php index 7a9f60d7fae4..25bc3bc91bbd 100644 --- a/tests/snippets/Vision/Annotation/CropHintTest.php +++ b/tests/snippets/Vision/Annotation/CropHintTest.php @@ -17,7 +17,7 @@ namespace Google\Cloud\Tests\Snippets\Vision\Annotation; -use Google\Cloud\Dev\Snippet\SnippetTestCase; +use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Vision\Annotation\CropHint; use Google\Cloud\Vision\Connection\ConnectionInterface; use Prophecy\Argument; diff --git a/tests/snippets/Vision/Annotation/DocumentTest.php b/tests/snippets/Vision/Annotation/DocumentTest.php index d34f67997519..a8e951535521 100644 --- a/tests/snippets/Vision/Annotation/DocumentTest.php +++ b/tests/snippets/Vision/Annotation/DocumentTest.php @@ -17,7 +17,7 @@ namespace Google\Cloud\Tests\Snippets\Vision\Annotation; -use Google\Cloud\Dev\Snippet\SnippetTestCase; +use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Vision\Annotation\Document; use Google\Cloud\Vision\Connection\ConnectionInterface; use Prophecy\Argument; diff --git a/tests/snippets/Vision/Annotation/EntityTest.php b/tests/snippets/Vision/Annotation/EntityTest.php index d990ee8c27ce..170e0b2b2168 100644 --- a/tests/snippets/Vision/Annotation/EntityTest.php +++ b/tests/snippets/Vision/Annotation/EntityTest.php @@ -17,7 +17,7 @@ namespace Google\Cloud\Tests\Snippets\Vision\Annotation; -use Google\Cloud\Dev\Snippet\SnippetTestCase; +use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Vision\Annotation\Entity; use Google\Cloud\Vision\Connection\ConnectionInterface; use Prophecy\Argument; diff --git a/tests/snippets/Vision/Annotation/Face/LandmarksTest.php b/tests/snippets/Vision/Annotation/Face/LandmarksTest.php index 858a6a810f6e..76e4152ca698 100644 --- a/tests/snippets/Vision/Annotation/Face/LandmarksTest.php +++ b/tests/snippets/Vision/Annotation/Face/LandmarksTest.php @@ -17,7 +17,7 @@ namespace Google\Cloud\Tests\Snippets\Vision\Annotation\Face; -use Google\Cloud\Dev\Snippet\SnippetTestCase; +use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Vision\Annotation\Face\Landmarks; use Google\Cloud\Vision\Connection\ConnectionInterface; use Prophecy\Argument; diff --git a/tests/snippets/Vision/Annotation/FaceTest.php b/tests/snippets/Vision/Annotation/FaceTest.php index 81a9127a5a83..87ccd02f16e9 100644 --- a/tests/snippets/Vision/Annotation/FaceTest.php +++ b/tests/snippets/Vision/Annotation/FaceTest.php @@ -17,7 +17,7 @@ namespace Google\Cloud\Tests\Snippets\Vision\Annotation; -use Google\Cloud\Dev\Snippet\SnippetTestCase; +use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Vision\Annotation\Face; use Google\Cloud\Vision\Connection\ConnectionInterface; use Prophecy\Argument; diff --git a/tests/snippets/Vision/Annotation/ImagePropertiesTest.php b/tests/snippets/Vision/Annotation/ImagePropertiesTest.php index 62c8c8f82f64..bece88609fb9 100644 --- a/tests/snippets/Vision/Annotation/ImagePropertiesTest.php +++ b/tests/snippets/Vision/Annotation/ImagePropertiesTest.php @@ -17,7 +17,7 @@ namespace Google\Cloud\Tests\Snippets\Vision\Annotation; -use Google\Cloud\Dev\Snippet\SnippetTestCase; +use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Vision\Annotation\ImageProperties; use Google\Cloud\Vision\Connection\ConnectionInterface; use Prophecy\Argument; diff --git a/tests/snippets/Vision/Annotation/SafeSearchTest.php b/tests/snippets/Vision/Annotation/SafeSearchTest.php index b0af9e9a5c30..43f4d09939bb 100644 --- a/tests/snippets/Vision/Annotation/SafeSearchTest.php +++ b/tests/snippets/Vision/Annotation/SafeSearchTest.php @@ -17,7 +17,7 @@ namespace Google\Cloud\Tests\Snippets\Vision\Annotation; -use Google\Cloud\Dev\Snippet\SnippetTestCase; +use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Vision\Annotation\SafeSearch; use Google\Cloud\Vision\Connection\ConnectionInterface; use Prophecy\Argument; diff --git a/tests/snippets/Vision/Annotation/Web/WebEntityTest.php b/tests/snippets/Vision/Annotation/Web/WebEntityTest.php index 62009e184dcb..5058e2ff4486 100644 --- a/tests/snippets/Vision/Annotation/Web/WebEntityTest.php +++ b/tests/snippets/Vision/Annotation/Web/WebEntityTest.php @@ -17,7 +17,7 @@ namespace Google\Cloud\Tests\Snippets\Vision\Annotation\Web; -use Google\Cloud\Dev\Snippet\SnippetTestCase; +use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Vision\Annotation\Web\WebEntity; use Google\Cloud\Vision\Connection\ConnectionInterface; use Prophecy\Argument; diff --git a/tests/snippets/Vision/Annotation/Web/WebImageTest.php b/tests/snippets/Vision/Annotation/Web/WebImageTest.php index b8ced484b27c..8d58668e8025 100644 --- a/tests/snippets/Vision/Annotation/Web/WebImageTest.php +++ b/tests/snippets/Vision/Annotation/Web/WebImageTest.php @@ -17,7 +17,7 @@ namespace Google\Cloud\Tests\Snippets\Vision\Annotation\Web; -use Google\Cloud\Dev\Snippet\SnippetTestCase; +use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Vision\Annotation\Web\WebImage; use Google\Cloud\Vision\Connection\ConnectionInterface; use Prophecy\Argument; diff --git a/tests/snippets/Vision/Annotation/Web/WebPageTest.php b/tests/snippets/Vision/Annotation/Web/WebPageTest.php index 5e74eafcbe7e..3e29f19bbf33 100644 --- a/tests/snippets/Vision/Annotation/Web/WebPageTest.php +++ b/tests/snippets/Vision/Annotation/Web/WebPageTest.php @@ -17,7 +17,7 @@ namespace Google\Cloud\Tests\Snippets\Vision\Annotation\Web; -use Google\Cloud\Dev\Snippet\SnippetTestCase; +use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Vision\Annotation\Web\WebPage; use Google\Cloud\Vision\Connection\ConnectionInterface; use Prophecy\Argument; diff --git a/tests/snippets/Vision/Annotation/WebTest.php b/tests/snippets/Vision/Annotation/WebTest.php index 38f849b2a8c3..33714574866f 100644 --- a/tests/snippets/Vision/Annotation/WebTest.php +++ b/tests/snippets/Vision/Annotation/WebTest.php @@ -17,7 +17,7 @@ namespace Google\Cloud\Tests\Snippets\Vision\Annotation; -use Google\Cloud\Dev\Snippet\SnippetTestCase; +use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Vision\Annotation\Web; use Google\Cloud\Vision\Annotation\Web\WebEntity; use Google\Cloud\Vision\Annotation\Web\WebImage; diff --git a/tests/snippets/Vision/AnnotationTest.php b/tests/snippets/Vision/AnnotationTest.php index 63d4c825a504..900e48c8ed3d 100644 --- a/tests/snippets/Vision/AnnotationTest.php +++ b/tests/snippets/Vision/AnnotationTest.php @@ -17,7 +17,7 @@ namespace Google\Cloud\Tests\Snippets\Vision; -use Google\Cloud\Dev\Snippet\SnippetTestCase; +use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Vision\Annotation; use Google\Cloud\Vision\Annotation\CropHint; use Google\Cloud\Vision\Annotation\Document; diff --git a/tests/snippets/Vision/ImageTest.php b/tests/snippets/Vision/ImageTest.php index b8e6038848b2..c0be7440733d 100644 --- a/tests/snippets/Vision/ImageTest.php +++ b/tests/snippets/Vision/ImageTest.php @@ -18,7 +18,7 @@ namespace Google\Cloud\Tests\Snippets\Vision; use Google\Cloud\Core\ServiceBuilder; -use Google\Cloud\Dev\Snippet\SnippetTestCase; +use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Vision\Image; /** diff --git a/tests/snippets/Vision/VisionClientTest.php b/tests/snippets/Vision/VisionClientTest.php index dbc0ace79383..38ea352ee39f 100644 --- a/tests/snippets/Vision/VisionClientTest.php +++ b/tests/snippets/Vision/VisionClientTest.php @@ -17,7 +17,7 @@ namespace Google\Cloud\Tests\Snippets\Vision; -use Google\Cloud\Dev\Snippet\SnippetTestCase; +use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Vision\Annotation; use Google\Cloud\Vision\Connection\ConnectionInterface; use Google\Cloud\Vision\Image; From 902be471165ffa51a8477257d64feffc12d65bb7 Mon Sep 17 00:00:00 2001 From: Michael Bausor Date: Fri, 22 Dec 2017 16:07:00 -0800 Subject: [PATCH 07/36] Rename stub --- tests/snippets/BigQuery/TableTest.php | 2 +- tests/snippets/Datastore/Query/GqlQueryTest.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/snippets/BigQuery/TableTest.php b/tests/snippets/BigQuery/TableTest.php index 5f82eaba0d6e..10b8169f94af 100644 --- a/tests/snippets/BigQuery/TableTest.php +++ b/tests/snippets/BigQuery/TableTest.php @@ -73,7 +73,7 @@ public function setUp() $this->mapper = new ValueMapper(false); $this->connection = $this->prophesize(ConnectionInterface::class); - $this->table = \Google\Cloud\Dev\Stub(Table::class, [ + $this->table = \Google\Cloud\Core\Testing\stub(Table::class, [ $this->connection->reveal(), self::ID, self::DSID, diff --git a/tests/snippets/Datastore/Query/GqlQueryTest.php b/tests/snippets/Datastore/Query/GqlQueryTest.php index f0ec86b1ea57..e7272021b794 100644 --- a/tests/snippets/Datastore/Query/GqlQueryTest.php +++ b/tests/snippets/Datastore/Query/GqlQueryTest.php @@ -39,7 +39,7 @@ public function setUp() { $this->datastore = new DatastoreClient; $this->connection = $this->prophesize(ConnectionInterface::class); - $this->operation = \Google\Cloud\Dev\Stub(Operation::class, [ + $this->operation = \Google\Cloud\Core\Testing\stub(Operation::class, [ $this->connection->reveal(), 'my-awesome-project', '', From 307f0ed0a9b1de0f53f3d135afa849a7163bc1ae Mon Sep 17 00:00:00 2001 From: Michael Bausor Date: Fri, 22 Dec 2017 16:12:53 -0800 Subject: [PATCH 08/36] Rename SystemTestCase --- tests/system/BigQuery/BigQueryTestCase.php | 2 +- tests/system/Firestore/FirestoreTestCase.php | 2 +- tests/system/Logging/LoggingTestCase.php | 2 +- tests/system/PubSub/PubSubTestCase.php | 2 +- tests/system/ServiceWhitelist/WhitelistTest.php | 2 +- tests/system/Spanner/SpannerTestCase.php | 2 +- tests/system/Storage/StorageTestCase.php | 2 +- tests/system/bootstrap.php | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/system/BigQuery/BigQueryTestCase.php b/tests/system/BigQuery/BigQueryTestCase.php index 0b5874f26283..d0162cb73b65 100644 --- a/tests/system/BigQuery/BigQueryTestCase.php +++ b/tests/system/BigQuery/BigQueryTestCase.php @@ -19,7 +19,7 @@ use Google\Cloud\BigQuery\BigQueryClient; use Google\Cloud\Storage\StorageClient; -use Google\Cloud\Tests\System\SystemTestCase; +use Google\Cloud\Core\Testing\System\SystemTestCase; class BigQueryTestCase extends SystemTestCase { diff --git a/tests/system/Firestore/FirestoreTestCase.php b/tests/system/Firestore/FirestoreTestCase.php index 81a26fe084db..f7de0a36cc89 100644 --- a/tests/system/Firestore/FirestoreTestCase.php +++ b/tests/system/Firestore/FirestoreTestCase.php @@ -18,7 +18,7 @@ namespace Google\Cloud\Tests\System\Firestore; use Google\Cloud\Firestore\FirestoreClient; -use Google\Cloud\Tests\System\SystemTestCase; +use Google\Cloud\Core\Testing\System\SystemTestCase; class FirestoreTestCase extends SystemTestCase { diff --git a/tests/system/Logging/LoggingTestCase.php b/tests/system/Logging/LoggingTestCase.php index 672403001e12..3e1dddef110a 100644 --- a/tests/system/Logging/LoggingTestCase.php +++ b/tests/system/Logging/LoggingTestCase.php @@ -22,7 +22,7 @@ use Google\Cloud\Logging\LoggingClient; use Google\Cloud\PubSub\PubSubClient; use Google\Cloud\Storage\StorageClient; -use Google\Cloud\Tests\System\SystemTestCase; +use Google\Cloud\Core\Testing\System\SystemTestCase; class LoggingTestCase extends SystemTestCase { diff --git a/tests/system/PubSub/PubSubTestCase.php b/tests/system/PubSub/PubSubTestCase.php index 5385ffdf93c4..c7cfb0d67a85 100644 --- a/tests/system/PubSub/PubSubTestCase.php +++ b/tests/system/PubSub/PubSubTestCase.php @@ -18,7 +18,7 @@ namespace Google\Cloud\Tests\System\PubSub; use Google\Cloud\PubSub\PubSubClient; -use Google\Cloud\Tests\System\SystemTestCase; +use Google\Cloud\Core\Testing\System\SystemTestCase; class PubSubTestCase extends SystemTestCase { diff --git a/tests/system/ServiceWhitelist/WhitelistTest.php b/tests/system/ServiceWhitelist/WhitelistTest.php index a221f9f16d5e..bc9a400014f0 100644 --- a/tests/system/ServiceWhitelist/WhitelistTest.php +++ b/tests/system/ServiceWhitelist/WhitelistTest.php @@ -20,7 +20,7 @@ use Google\Cloud\Core\Exception\NotFoundException; use Google\Cloud\Core\Timestamp; use Google\Cloud\PubSub\PubSubClient; -use Google\Cloud\Tests\System\SystemTestCase; +use Google\Cloud\Core\Testing\System\SystemTestCase; /** * @group whitelist diff --git a/tests/system/Spanner/SpannerTestCase.php b/tests/system/Spanner/SpannerTestCase.php index 1d1b9f92aba5..ec6c030ed3a2 100644 --- a/tests/system/Spanner/SpannerTestCase.php +++ b/tests/system/Spanner/SpannerTestCase.php @@ -19,7 +19,7 @@ use Google\Cloud\Core\ExponentialBackoff; use Google\Cloud\Spanner\SpannerClient; -use Google\Cloud\Tests\System\SystemTestCase; +use Google\Cloud\Core\Testing\System\SystemTestCase; /** * @group spanner diff --git a/tests/system/Storage/StorageTestCase.php b/tests/system/Storage/StorageTestCase.php index dc8858c13b42..aada9cd5c9f4 100644 --- a/tests/system/Storage/StorageTestCase.php +++ b/tests/system/Storage/StorageTestCase.php @@ -21,7 +21,7 @@ use Google\Cloud\Core\Exception\NotFoundException; use Google\Cloud\PubSub\PubSubClient; use Google\Cloud\Storage\StorageClient; -use Google\Cloud\Tests\System\SystemTestCase; +use Google\Cloud\Core\Testing\System\SystemTestCase; /** * Refer to README.md in this directory for some important information diff --git a/tests/system/bootstrap.php b/tests/system/bootstrap.php index 3dc196324252..bcbb5d681cca 100644 --- a/tests/system/bootstrap.php +++ b/tests/system/bootstrap.php @@ -8,7 +8,7 @@ use Google\Cloud\Tests\System\PubSub\PubSubTestCase; use Google\Cloud\Tests\System\Spanner\SpannerTestCase; use Google\Cloud\Tests\System\Storage\StorageTestCase; -use Google\Cloud\Tests\System\SystemTestCase; +use Google\Cloud\Core\Testing\System\SystemTestCase; use Google\Cloud\Tests\System\Whitelist\WhitelistTest; if (!getenv('GOOGLE_CLOUD_PHP_TESTS_KEY_PATH')) { From 44a1c7e5e346b7d3d1c42477d279e78b87ed3be0 Mon Sep 17 00:00:00 2001 From: Michael Bausor Date: Fri, 22 Dec 2017 16:14:40 -0800 Subject: [PATCH 09/36] Rename DeletionQueue --- src/Core/Testing/System/SystemTestCase.php | 2 +- tests/system/Datastore/DatastoreTestCase.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Core/Testing/System/SystemTestCase.php b/src/Core/Testing/System/SystemTestCase.php index 8e1b1cc1656e..4893a9d1f399 100644 --- a/src/Core/Testing/System/SystemTestCase.php +++ b/src/Core/Testing/System/SystemTestCase.php @@ -21,7 +21,7 @@ use Google\Cloud\Core\ExponentialBackoff; use Google\Cloud\PubSub\PubSubClient; use Google\Cloud\Storage\StorageClient; -use Google\Cloud\Tests\System\DeletionQueue; +use Google\Cloud\Core\Testing\System\DeletionQueue; use PHPUnit\Framework\TestCase; class SystemTestCase extends TestCase diff --git a/tests/system/Datastore/DatastoreTestCase.php b/tests/system/Datastore/DatastoreTestCase.php index a30f7219019c..f12f47aa6b11 100644 --- a/tests/system/Datastore/DatastoreTestCase.php +++ b/tests/system/Datastore/DatastoreTestCase.php @@ -19,7 +19,7 @@ use Google\Cloud\Core\ExponentialBackoff; use Google\Cloud\Datastore\DatastoreClient; -use Google\Cloud\Tests\System\DeletionQueue; +use Google\Cloud\Core\Testing\System\DeletionQueue; use PHPUnit\Framework\TestCase; /** From 7029491043c56b211f068c1d6a64791c7b66c39d Mon Sep 17 00:00:00 2001 From: Michael Bausor Date: Wed, 27 Dec 2017 16:33:54 -0800 Subject: [PATCH 10/36] Move fixtures --- src/Core/Testing/Functions.php | 103 +++++++++++------- src/Core/Testing/Lock/Functions.php | 59 ++++++++++ src/Core/Testing/Lock/MockValues.php | 41 +++++++ tests/unit/Core/Fixtures.php | 31 ++++++ tests/unit/Core/GrpcRequestWrapperTest.php | 4 +- tests/unit/Core/Lock/CommonLockTrait.php | 6 +- tests/unit/Core/Lock/FlockLockTest.php | 4 +- tests/unit/Core/Lock/MockGlobals.php | 62 ----------- tests/unit/Core/Lock/SemaphoreLockTest.php | 6 +- tests/unit/Core/RequestWrapperTest.php | 4 +- .../fixtures/empty-json-key-fixture.json | 0 .../{ => Core}/fixtures/json-key-fixture.json | 0 .../fixtures/schema/composer.json.schema | 0 .../fixtures/schema/manifest.json.schema | 0 .../fixtures/schema/toc.json.schema | 0 .../{ => Core}/fixtures/service-fixture.json | 0 tests/unit/Datastore/DatastoreClientTest.php | 4 +- tests/unit/Datastore/Fixtures.php | 46 ++++++++ tests/unit/Datastore/OperationTest.php | 26 ++--- .../fixtures}/entity-batch-lookup.json | 0 .../fixtures}/entity-lookup-bigsort.json | 0 .../entity-result-no-properties.json | 0 .../fixtures}/entity-result.json | 0 .../fixtures}/query-results.json | 0 tests/unit/Spanner/Fixtures.php | 31 ++++++ tests/unit/Spanner/InstanceTest.php | 2 +- tests/unit/Spanner/ResultTestTrait.php | 2 +- .../Spanner/Session/CacheSessionPoolTest.php | 4 +- .../fixtures}/instance.json | 0 .../streaming-read-acceptance-test.json | 0 .../Vision/Annotation/Face/LandmarksTest.php | 3 +- tests/unit/Vision/Fixtures.php | 31 ++++++ tests/unit/Vision/ImageTest.php | 6 +- .../fixtures}/eiffel-tower.jpg | Bin .../fixtures}/face-landmarks.json | 0 35 files changed, 332 insertions(+), 143 deletions(-) create mode 100644 src/Core/Testing/Lock/Functions.php create mode 100644 src/Core/Testing/Lock/MockValues.php create mode 100644 tests/unit/Core/Fixtures.php delete mode 100644 tests/unit/Core/Lock/MockGlobals.php rename tests/unit/{ => Core}/fixtures/empty-json-key-fixture.json (100%) rename tests/unit/{ => Core}/fixtures/json-key-fixture.json (100%) rename tests/unit/{ => Core}/fixtures/schema/composer.json.schema (100%) rename tests/unit/{ => Core}/fixtures/schema/manifest.json.schema (100%) rename tests/unit/{ => Core}/fixtures/schema/toc.json.schema (100%) rename tests/unit/{ => Core}/fixtures/service-fixture.json (100%) create mode 100644 tests/unit/Datastore/Fixtures.php rename tests/unit/{fixtures/datastore => Datastore/fixtures}/entity-batch-lookup.json (100%) rename tests/unit/{fixtures/datastore => Datastore/fixtures}/entity-lookup-bigsort.json (100%) rename tests/unit/{fixtures/datastore => Datastore/fixtures}/entity-result-no-properties.json (100%) rename tests/unit/{fixtures/datastore => Datastore/fixtures}/entity-result.json (100%) rename tests/unit/{fixtures/datastore => Datastore/fixtures}/query-results.json (100%) create mode 100644 tests/unit/Spanner/Fixtures.php rename tests/unit/{fixtures/spanner => Spanner/fixtures}/instance.json (100%) rename tests/unit/{fixtures/spanner => Spanner/fixtures}/streaming-read-acceptance-test.json (100%) create mode 100644 tests/unit/Vision/Fixtures.php rename tests/unit/{fixtures/vision => Vision/fixtures}/eiffel-tower.jpg (100%) rename tests/unit/{fixtures/vision => Vision/fixtures}/face-landmarks.json (100%) diff --git a/src/Core/Testing/Functions.php b/src/Core/Testing/Functions.php index 03dabc22d823..cc1ac49661d2 100644 --- a/src/Core/Testing/Functions.php +++ b/src/Core/Testing/Functions.php @@ -1,59 +1,78 @@ newInstanceArgs($args); } - $reflection = new \ReflectionClass($name); - return $reflection->newInstanceArgs($args); -} + /** + * Get a trait implementation. + * + * @param string $trait The fully-qualified name of the trait to implement. + * @return mixed + */ + public static function impl($trait, array $props = []) + { + $properties = []; + foreach ($props as $prop) { + $properties[] = 'private $' . $prop . ';'; + } -/** - * Get a trait implementation. - * - * @param string $trait The fully-qualified name of the trait to implement. - * @return mixed - */ -function impl($trait, array $props = []) -{ - $properties = []; - foreach ($props as $prop) { - $properties[] = 'private $'. $prop .';'; - } + $tpl = 'class %s { + use %s; + use \Google\Cloud\Dev\StubTrait; + private $___props = \'%s\'; + %s + public function call($fn, array $args = []) { return call_user_func_array([$this, $fn], $args); } + }'; - $tpl = 'class %s { - use %s; - use \Google\Cloud\Dev\StubTrait; - private $___props = \'%s\'; - %s - public function call($fn, array $args = []) { return call_user_func_array([$this, $fn], $args); } - }'; + $name = 'Trait' . sha1($trait . json_encode($props)); - $name = 'Trait'. sha1($trait . json_encode($props)); + if (!class_exists($name)) { + eval(sprintf($tpl, $name, $trait, json_encode($props), implode("\n", $properties))); + } - if (!class_exists($name)) { - eval(sprintf($tpl, $name, $trait, json_encode($props), implode("\n", $properties))); + return new $name; } - - return new $name; } diff --git a/src/Core/Testing/Lock/Functions.php b/src/Core/Testing/Lock/Functions.php new file mode 100644 index 000000000000..28102cddc91c --- /dev/null +++ b/src/Core/Testing/Lock/Functions.php @@ -0,0 +1,59 @@ +prophesize(FetchAuthTokenInterface::class); @@ -168,7 +168,7 @@ public function credentialsProvider() public function keyFileCredentialsProvider() { - $keyFilePath = __DIR__ . '/../fixtures/json-key-fixture.json'; + $keyFilePath = Fixtures::JSON_KEY_FIXTURE(); return [ [['keyFile' => json_decode(file_get_contents($keyFilePath), true)]], // keyFile diff --git a/tests/unit/Core/Lock/CommonLockTrait.php b/tests/unit/Core/Lock/CommonLockTrait.php index c03fd4eee5e7..5fd88519770e 100644 --- a/tests/unit/Core/Lock/CommonLockTrait.php +++ b/tests/unit/Core/Lock/CommonLockTrait.php @@ -17,11 +17,9 @@ namespace Google\Cloud\Tests\Unit\Core\Lock; -require_once __DIR__ . '/MockGlobals.php'; - -use Google\Cloud\Core\Lock\MockValues; +use Google\Cloud\Core\Testing\Lock\MockValues; use Google\Cloud\Core\Lock\SemaphoreLock; -use Google\Cloud\Core\SysvTrait;; +use Google\Cloud\Core\SysvTrait; /** * @group core diff --git a/tests/unit/Core/Lock/FlockLockTest.php b/tests/unit/Core/Lock/FlockLockTest.php index 9153b0747c62..d5f08bf46728 100644 --- a/tests/unit/Core/Lock/FlockLockTest.php +++ b/tests/unit/Core/Lock/FlockLockTest.php @@ -17,10 +17,8 @@ namespace Google\Cloud\Tests\Unit\Core\Lock; -require_once __DIR__ . '/MockGlobals.php'; - use Google\Cloud\Core\Lock\FlockLock; -use Google\Cloud\Core\Lock\MockValues; +use Google\Cloud\Core\Testing\Lock\MockValues; use PHPUnit\Framework\TestCase; /** diff --git a/tests/unit/Core/Lock/MockGlobals.php b/tests/unit/Core/Lock/MockGlobals.php deleted file mode 100644 index 2f4982224f26..000000000000 --- a/tests/unit/Core/Lock/MockGlobals.php +++ /dev/null @@ -1,62 +0,0 @@ -prophesize(FetchAuthTokenInterface::class); @@ -173,7 +173,7 @@ public function keyFileCredentialsProvider() } ]; - $keyFilePath = __DIR__ . '/../fixtures/json-key-fixture.json'; + $keyFilePath = Fixtures::JSON_KEY_FIXTURE(); return [ [$config + ['keyFile' => json_decode(file_get_contents($keyFilePath), true)]], // keyFile diff --git a/tests/unit/fixtures/empty-json-key-fixture.json b/tests/unit/Core/fixtures/empty-json-key-fixture.json similarity index 100% rename from tests/unit/fixtures/empty-json-key-fixture.json rename to tests/unit/Core/fixtures/empty-json-key-fixture.json diff --git a/tests/unit/fixtures/json-key-fixture.json b/tests/unit/Core/fixtures/json-key-fixture.json similarity index 100% rename from tests/unit/fixtures/json-key-fixture.json rename to tests/unit/Core/fixtures/json-key-fixture.json diff --git a/tests/unit/fixtures/schema/composer.json.schema b/tests/unit/Core/fixtures/schema/composer.json.schema similarity index 100% rename from tests/unit/fixtures/schema/composer.json.schema rename to tests/unit/Core/fixtures/schema/composer.json.schema diff --git a/tests/unit/fixtures/schema/manifest.json.schema b/tests/unit/Core/fixtures/schema/manifest.json.schema similarity index 100% rename from tests/unit/fixtures/schema/manifest.json.schema rename to tests/unit/Core/fixtures/schema/manifest.json.schema diff --git a/tests/unit/fixtures/schema/toc.json.schema b/tests/unit/Core/fixtures/schema/toc.json.schema similarity index 100% rename from tests/unit/fixtures/schema/toc.json.schema rename to tests/unit/Core/fixtures/schema/toc.json.schema diff --git a/tests/unit/fixtures/service-fixture.json b/tests/unit/Core/fixtures/service-fixture.json similarity index 100% rename from tests/unit/fixtures/service-fixture.json rename to tests/unit/Core/fixtures/service-fixture.json diff --git a/tests/unit/Datastore/DatastoreClientTest.php b/tests/unit/Datastore/DatastoreClientTest.php index 76f2c5a14ab9..446b4d47915d 100644 --- a/tests/unit/Datastore/DatastoreClientTest.php +++ b/tests/unit/Datastore/DatastoreClientTest.php @@ -400,7 +400,7 @@ public function testLookup() public function testLookupBatch() { - $body = json_decode(file_get_contents(__DIR__ .'/../fixtures/datastore/entity-batch-lookup.json'), true); + $body = json_decode(file_get_contents(Fixtures::ENTITY_BATCH_LOOKUP_FIXTURE()), true); $this->operation->lookup(Argument::type('array'), Argument::type('array')) ->shouldBeCalled() ->willReturn(['foo']); @@ -429,7 +429,7 @@ public function testGqlQuery() public function testRunQuery() { - $queryResult = json_decode(file_get_contents(__DIR__ .'/../fixtures/datastore/query-results.json'), true); + $queryResult = json_decode(file_get_contents(Fixtures::QUERY_RESULTS_FIXTURE()), true); $this->operation->runQuery(Argument::type(QueryInterface::class), Argument::type('array')) ->shouldBeCalled() diff --git a/tests/unit/Datastore/Fixtures.php b/tests/unit/Datastore/Fixtures.php new file mode 100644 index 000000000000..ab8c4ce0035d --- /dev/null +++ b/tests/unit/Datastore/Fixtures.php @@ -0,0 +1,46 @@ +connection->lookup(Argument::any())->willReturn([ 'found' => $body ]); @@ -245,7 +245,7 @@ public function testLookupFound() public function testLookupMissing() { - $body = json_decode(file_get_contents(__DIR__ .'/../fixtures/datastore/entity-batch-lookup.json'), true); + $body = json_decode(file_get_contents(Fixtures::ENTITY_BATCH_LOOKUP_FIXTURE()), true); $this->connection->lookup(Argument::any())->willReturn([ 'missing' => $body ]); @@ -265,7 +265,7 @@ public function testLookupMissing() public function testLookupDeferred() { - $body = json_decode(file_get_contents(__DIR__ .'/../fixtures/datastore/entity-batch-lookup.json'), true); + $body = json_decode(file_get_contents(Fixtures::ENTITY_BATCH_LOOKUP_FIXTURE()), true); $this->connection->lookup(Argument::any())->willReturn([ 'deferred' => [ $body[0]['entity']['key'] ] ]); @@ -326,7 +326,7 @@ public function testLookupWithoutReadOptions() public function testLookupWithSort() { - $data = json_decode(file_get_contents(__DIR__ .'/../fixtures/datastore/entity-lookup-bigsort.json'), true); + $data = json_decode(file_get_contents(Fixtures::ENTITY_LOOKUP_BIGSORT_FIXTURE()), true); $keys = []; foreach ($data['keys'] as $key) { @@ -354,7 +354,7 @@ public function testLookupWithSort() public function testLookupWithoutSort() { - $data = json_decode(file_get_contents(__DIR__ .'/../fixtures/datastore/entity-lookup-bigsort.json'), true); + $data = json_decode(file_get_contents(Fixtures::ENTITY_LOOKUP_BIGSORT_FIXTURE()), true); $keys = []; foreach ($data['keys'] as $key) { @@ -381,7 +381,7 @@ public function testLookupWithoutSort() public function testLookupWithSortAndMissingKey() { - $data = json_decode(file_get_contents(__DIR__ .'/../fixtures/datastore/entity-lookup-bigsort.json'), true); + $data = json_decode(file_get_contents(Fixtures::ENTITY_LOOKUP_BIGSORT_FIXTURE()), true); // Move an entity to missing. $missing = $data['entities'][5]; @@ -431,7 +431,7 @@ public function testLookupInvalidKey() public function testRunQuery() { - $queryResult = json_decode(file_get_contents(__DIR__ .'/../fixtures/datastore/query-results.json'), true); + $queryResult = json_decode(file_get_contents(Fixtures::QUERY_RESULTS_FIXTURE()), true); $this->connection->runQuery(Argument::type('array')) ->willReturn($queryResult['notPaged']); @@ -454,7 +454,7 @@ public function testRunQuery() public function testRunQueryPaged() { - $queryResult = json_decode(file_get_contents(__DIR__ .'/../fixtures/datastore/query-results.json'), true); + $queryResult = json_decode(file_get_contents(Fixtures::QUERY_RESULTS_FIXTURE()), true); $this->connection->runQuery(Argument::type('array')) ->will(function($args, $mock) use ($queryResult) { // The 2nd call will return the 2nd page of results! @@ -482,7 +482,7 @@ public function testRunQueryPaged() public function testRunQueryNoResults() { - $queryResult = json_decode(file_get_contents(__DIR__ .'/../fixtures/datastore/query-results.json'), true); + $queryResult = json_decode(file_get_contents(Fixtures::QUERY_RESULTS_FIXTURE()), true); $this->connection->runQuery(Argument::type('array')) ->willReturn($queryResult['noResults']); @@ -743,7 +743,7 @@ public function testCheckOverwriteWithException() public function testMapEntityResult() { - $res = json_decode(file_get_contents(__DIR__ .'/../fixtures/datastore/entity-result.json'), true); + $res = json_decode(file_get_contents(Fixtures::ENTITY_RESULT_FIXTURE()), true); $this->connection->lookup(Argument::type('array')) ->willReturn([ @@ -765,7 +765,7 @@ public function testMapEntityResult() public function testMapEntityResultWithoutProperties() { - $res = json_decode(file_get_contents(__DIR__ .'/../fixtures/datastore/entity-result-no-properties.json'), true); + $res = json_decode(file_get_contents(Fixtures::ENTITY_RESULT_NO_PROPERTIES_FIXTURE()), true); $this->connection->lookup(Argument::type('array')) ->willReturn([ @@ -786,7 +786,7 @@ public function testMapEntityResultWithoutProperties() public function testMapEntityResultArrayOfClassNames() { - $res = json_decode(file_get_contents(__DIR__ .'/../fixtures/datastore/entity-result.json'), true); + $res = json_decode(file_get_contents(Fixtures::ENTITY_RESULT_FIXTURE()), true); $this->connection->lookup(Argument::type('array')) ->willReturn([ @@ -812,7 +812,7 @@ public function testMapEntityResultArrayOfClassNames() */ public function testMapEntityResultArrayOfClassNamesMissingKindMapItem() { - $res = json_decode(file_get_contents(__DIR__ .'/../fixtures/datastore/entity-result.json'), true); + $res = json_decode(file_get_contents(Fixtures::ENTITY_RESULT_FIXTURE()), true); $this->connection->lookup(Argument::type('array')) ->willReturn([ diff --git a/tests/unit/fixtures/datastore/entity-batch-lookup.json b/tests/unit/Datastore/fixtures/entity-batch-lookup.json similarity index 100% rename from tests/unit/fixtures/datastore/entity-batch-lookup.json rename to tests/unit/Datastore/fixtures/entity-batch-lookup.json diff --git a/tests/unit/fixtures/datastore/entity-lookup-bigsort.json b/tests/unit/Datastore/fixtures/entity-lookup-bigsort.json similarity index 100% rename from tests/unit/fixtures/datastore/entity-lookup-bigsort.json rename to tests/unit/Datastore/fixtures/entity-lookup-bigsort.json diff --git a/tests/unit/fixtures/datastore/entity-result-no-properties.json b/tests/unit/Datastore/fixtures/entity-result-no-properties.json similarity index 100% rename from tests/unit/fixtures/datastore/entity-result-no-properties.json rename to tests/unit/Datastore/fixtures/entity-result-no-properties.json diff --git a/tests/unit/fixtures/datastore/entity-result.json b/tests/unit/Datastore/fixtures/entity-result.json similarity index 100% rename from tests/unit/fixtures/datastore/entity-result.json rename to tests/unit/Datastore/fixtures/entity-result.json diff --git a/tests/unit/fixtures/datastore/query-results.json b/tests/unit/Datastore/fixtures/query-results.json similarity index 100% rename from tests/unit/fixtures/datastore/query-results.json rename to tests/unit/Datastore/fixtures/query-results.json diff --git a/tests/unit/Spanner/Fixtures.php b/tests/unit/Spanner/Fixtures.php new file mode 100644 index 000000000000..9cdcb23a5f2b --- /dev/null +++ b/tests/unit/Spanner/Fixtures.php @@ -0,0 +1,31 @@ +data = json_decode(file_get_contents(__DIR__ .'/../../../fixtures/vision/face-landmarks.json'), true); + $this->data = json_decode(file_get_contents(Fixtures::FACE_LANDMARKS_FIXTURE()), true); $this->landmarks = new Landmarks($this->data); } diff --git a/tests/unit/Vision/Fixtures.php b/tests/unit/Vision/Fixtures.php new file mode 100644 index 000000000000..a200eabd2844 --- /dev/null +++ b/tests/unit/Vision/Fixtures.php @@ -0,0 +1,31 @@ +requestObject(); @@ -54,8 +54,8 @@ public function testWithStorage() public function testWithResource() { - $resource = fopen(__DIR__ .'/../fixtures/vision/eiffel-tower.jpg', 'r'); - $bytes = file_get_contents(__DIR__ .'/../fixtures/vision/eiffel-tower.jpg'); + $resource = fopen(Fixtures::EIFFEL_TOWER_FIXTURE(), 'r'); + $bytes = file_get_contents(Fixtures::EIFFEL_TOWER_FIXTURE()); $image = new Image($resource, ['landmarks']); $res = $image->requestObject(); diff --git a/tests/unit/fixtures/vision/eiffel-tower.jpg b/tests/unit/Vision/fixtures/eiffel-tower.jpg similarity index 100% rename from tests/unit/fixtures/vision/eiffel-tower.jpg rename to tests/unit/Vision/fixtures/eiffel-tower.jpg diff --git a/tests/unit/fixtures/vision/face-landmarks.json b/tests/unit/Vision/fixtures/face-landmarks.json similarity index 100% rename from tests/unit/fixtures/vision/face-landmarks.json rename to tests/unit/Vision/fixtures/face-landmarks.json From d589514420391a50305816215ca8704a2082c739 Mon Sep 17 00:00:00 2001 From: Michael Bausor Date: Wed, 27 Dec 2017 16:34:04 -0800 Subject: [PATCH 11/36] Rename stub and impl --- tests/conformance/FirestoreTest.php | 2 +- tests/snippets/BigQuery/BigQueryClientTest.php | 2 +- tests/snippets/BigQuery/CopyJobConfigurationTest.php | 2 +- .../snippets/BigQuery/ExtractJobConfigurationTest.php | 2 +- tests/snippets/BigQuery/LoadJobConfigurationTest.php | 2 +- tests/snippets/BigQuery/QueryJobConfigurationTest.php | 2 +- tests/snippets/BigQuery/QueryResultsTest.php | 2 +- tests/snippets/BigQuery/TableTest.php | 8 ++++---- tests/snippets/BigQuery/TimeTest.php | 2 +- tests/snippets/BigQuery/TimestampTest.php | 2 +- tests/snippets/Core/Iam/IamTest.php | 2 +- .../Core/LongRunning/LongRunningOperationTest.php | 2 +- tests/snippets/Datastore/Query/GqlQueryTest.php | 2 +- tests/snippets/Datastore/Query/QueryTest.php | 2 +- tests/snippets/Datastore/TransactionTest.php | 2 +- tests/snippets/Firestore/CollectionReferenceTest.php | 2 +- tests/snippets/Firestore/DocumentReferenceTest.php | 2 +- tests/snippets/Firestore/DocumentSnapshotTest.php | 4 ++-- tests/snippets/Firestore/FieldValueTest.php | 2 +- tests/snippets/Firestore/FirestoreClientTest.php | 2 +- tests/snippets/Firestore/QuerySnapshotTest.php | 4 ++-- tests/snippets/Firestore/QueryTest.php | 2 +- tests/snippets/Firestore/TransactionTest.php | 4 ++-- tests/snippets/Firestore/WriteBatchTest.php | 2 +- tests/snippets/Language/LanguageClientTest.php | 2 +- tests/snippets/Logging/LoggerTest.php | 2 +- tests/snippets/Logging/LoggingClientTest.php | 2 +- tests/snippets/Logging/MetricTest.php | 2 +- tests/snippets/Logging/SinkTest.php | 2 +- tests/snippets/PubSub/PubSubClientTest.php | 2 +- tests/snippets/PubSub/SnapshotTest.php | 2 +- tests/snippets/PubSub/SubscriptionTest.php | 4 ++-- tests/snippets/PubSub/TopicTest.php | 4 ++-- tests/snippets/Spanner/DatabaseTest.php | 4 ++-- tests/snippets/Spanner/InstanceConfigurationTest.php | 2 +- tests/snippets/Spanner/InstanceTest.php | 2 +- tests/snippets/Spanner/SnapshotTest.php | 4 ++-- tests/snippets/Spanner/SpannerClientTest.php | 2 +- tests/snippets/Spanner/TransactionTest.php | 4 ++-- tests/snippets/Speech/OperationTest.php | 2 +- tests/snippets/Speech/SpeechClientTest.php | 2 +- tests/snippets/Storage/AclTest.php | 2 +- tests/snippets/Storage/BucketTest.php | 2 +- tests/snippets/Storage/NotificationTest.php | 2 +- tests/snippets/Storage/StorageClientTest.php | 2 +- tests/snippets/Storage/StorageObjectTest.php | 2 +- tests/snippets/Trace/TraceClientTest.php | 2 +- tests/snippets/Translate/TranslateClientTest.php | 2 +- tests/snippets/Vision/VisionClientTest.php | 2 +- tests/unit/BigQuery/BigQueryClientTest.php | 2 +- tests/unit/BigQuery/JobConfigurationTraitTest.php | 2 +- tests/unit/BigQuery/JobWaitTraitTest.php | 2 +- tests/unit/Core/ClientTraitTest.php | 10 +++++----- tests/unit/Core/ConcurrencyControlTraitTest.php | 2 +- tests/unit/Core/EmulatorTraitTest.php | 2 +- tests/unit/Core/GrpcTraitTest.php | 2 +- tests/unit/Core/JsonTraitTest.php | 2 +- tests/unit/Firestore/CollectionReferenceTest.php | 4 ++-- tests/unit/Firestore/DocumentReferenceTest.php | 2 +- tests/unit/Firestore/DocumentSnapshotTest.php | 2 +- tests/unit/Firestore/FirestoreClientTest.php | 2 +- tests/unit/Firestore/PathTraitTest.php | 2 +- tests/unit/Firestore/QuerySnapshotTest.php | 2 +- tests/unit/Firestore/QueryTest.php | 2 +- tests/unit/Firestore/SnapshotTraitTest.php | 2 +- tests/unit/Firestore/TransactionTest.php | 2 +- tests/unit/Firestore/ValueMapperTest.php | 2 +- tests/unit/Firestore/WriteBatchTest.php | 2 +- tests/unit/Spanner/Connection/IamDatabaseTest.php | 2 +- tests/unit/Spanner/Connection/IamInstanceTest.php | 2 +- .../Spanner/Connection/LongRunningConnectionTest.php | 2 +- tests/unit/Spanner/DatabaseTest.php | 2 +- tests/unit/Spanner/InstanceConfigurationTest.php | 4 ++-- tests/unit/Spanner/InstanceTest.php | 2 +- tests/unit/Spanner/OperationTest.php | 2 +- tests/unit/Spanner/SpannerClientTest.php | 2 +- tests/unit/Spanner/TransactionTest.php | 6 +++--- tests/unit/Spanner/TransactionTypeTest.php | 2 +- tests/unit/Storage/EncryptionTraitTest.php | 2 +- tests/unit/Storage/RequesterPaysTest.php | 2 +- tests/unit/Storage/StorageClientTest.php | 2 +- 81 files changed, 100 insertions(+), 100 deletions(-) diff --git a/tests/conformance/FirestoreTest.php b/tests/conformance/FirestoreTest.php index 3edc823bc1d9..c183d8d4eaaf 100644 --- a/tests/conformance/FirestoreTest.php +++ b/tests/conformance/FirestoreTest.php @@ -63,7 +63,7 @@ class FirestoreTest extends TestCase public function setUp() { - $this->client = \Google\Cloud\Core\Testing\stub(FirestoreClient::class, [ + $this->client = \Google\Cloud\Core\Testing\Functions::stub(FirestoreClient::class, [ [ 'projectId' => 'projectID' ] diff --git a/tests/snippets/BigQuery/BigQueryClientTest.php b/tests/snippets/BigQuery/BigQueryClientTest.php index 9fcffe30bdd9..a775749482c5 100644 --- a/tests/snippets/BigQuery/BigQueryClientTest.php +++ b/tests/snippets/BigQuery/BigQueryClientTest.php @@ -70,7 +70,7 @@ class BigQueryClientTest extends SnippetTestCase public function setUp() { $this->connection = $this->prophesize(ConnectionInterface::class); - $this->client = \Google\Cloud\Core\Testing\stub(BigQueryTestClient::class); + $this->client = \Google\Cloud\Core\Testing\Functions::stub(BigQueryTestClient::class); $this->client->___setProperty('connection', $this->connection->reveal()); } diff --git a/tests/snippets/BigQuery/CopyJobConfigurationTest.php b/tests/snippets/BigQuery/CopyJobConfigurationTest.php index c22498ba350e..ea233e4eded2 100644 --- a/tests/snippets/BigQuery/CopyJobConfigurationTest.php +++ b/tests/snippets/BigQuery/CopyJobConfigurationTest.php @@ -70,7 +70,7 @@ public function testSetters($method, $expected, $bq = null) public function setterDataProvider() { - $bq = \Google\Cloud\Core\Testing\stub(BigQueryClient::class, [ + $bq = \Google\Cloud\Core\Testing\Functions::stub(BigQueryClient::class, [ ['projectId' => self::PROJECT_ID] ]); diff --git a/tests/snippets/BigQuery/ExtractJobConfigurationTest.php b/tests/snippets/BigQuery/ExtractJobConfigurationTest.php index b6f8004c04b0..0a9b6b7202a4 100644 --- a/tests/snippets/BigQuery/ExtractJobConfigurationTest.php +++ b/tests/snippets/BigQuery/ExtractJobConfigurationTest.php @@ -71,7 +71,7 @@ public function testSetters($method, $expected, $bq = null) public function setterDataProvider() { - $bq = \Google\Cloud\Core\Testing\stub(BigQueryClient::class, [ + $bq = \Google\Cloud\Core\Testing\Functions::stub(BigQueryClient::class, [ ['projectId' => self::PROJECT_ID] ]); diff --git a/tests/snippets/BigQuery/LoadJobConfigurationTest.php b/tests/snippets/BigQuery/LoadJobConfigurationTest.php index 1e68889a5f61..04ee58fbf9e7 100644 --- a/tests/snippets/BigQuery/LoadJobConfigurationTest.php +++ b/tests/snippets/BigQuery/LoadJobConfigurationTest.php @@ -81,7 +81,7 @@ public function testSetters($method, $expected, $bq = null) public function setterDataProvider() { - $bq = \Google\Cloud\Core\Testing\stub(BigQueryClient::class, [ + $bq = \Google\Cloud\Core\Testing\Functions::stub(BigQueryClient::class, [ ['projectId' => self::PROJECT_ID] ]); diff --git a/tests/snippets/BigQuery/QueryJobConfigurationTest.php b/tests/snippets/BigQuery/QueryJobConfigurationTest.php index 55fdbd6f37df..283414c46e3f 100644 --- a/tests/snippets/BigQuery/QueryJobConfigurationTest.php +++ b/tests/snippets/BigQuery/QueryJobConfigurationTest.php @@ -72,7 +72,7 @@ public function testSetters($method, $expected, $bq = null) public function setterDataProvider() { - $bq = \Google\Cloud\Core\Testing\stub(BigQueryClient::class, [ + $bq = \Google\Cloud\Core\Testing\Functions::stub(BigQueryClient::class, [ ['projectId' => self::PROJECT_ID] ]); diff --git a/tests/snippets/BigQuery/QueryResultsTest.php b/tests/snippets/BigQuery/QueryResultsTest.php index d19b72874ad6..6622d8bde58e 100644 --- a/tests/snippets/BigQuery/QueryResultsTest.php +++ b/tests/snippets/BigQuery/QueryResultsTest.php @@ -63,7 +63,7 @@ public function setUp() ]; $this->connection = $this->prophesize(ConnectionInterface::class); - $this->qr = \Google\Cloud\Core\Testing\stub(QueryResults::class, [ + $this->qr = \Google\Cloud\Core\Testing\Functions::stub(QueryResults::class, [ $this->connection->reveal(), self::JOB_ID, self::PROJECT, diff --git a/tests/snippets/BigQuery/TableTest.php b/tests/snippets/BigQuery/TableTest.php index 10b8169f94af..723192e76507 100644 --- a/tests/snippets/BigQuery/TableTest.php +++ b/tests/snippets/BigQuery/TableTest.php @@ -73,7 +73,7 @@ public function setUp() $this->mapper = new ValueMapper(false); $this->connection = $this->prophesize(ConnectionInterface::class); - $this->table = \Google\Cloud\Core\Testing\stub(Table::class, [ + $this->table = \Google\Cloud\Core\Testing\Functions::stub(Table::class, [ $this->connection->reveal(), self::ID, self::DSID, @@ -202,7 +202,7 @@ public function testStartJob() public function testCopy() { - $bq = \Google\Cloud\Core\Testing\stub(BigQueryClient::class); + $bq = \Google\Cloud\Core\Testing\Functions::stub(BigQueryClient::class); $snippet = $this->snippetFromMethod(Table::class, 'copy'); $snippet->addLocal('bigQuery', $bq); $bq->___setProperty('connection', $this->connection->reveal()); @@ -229,7 +229,7 @@ public function testCopy() public function testExtract() { - $storage = \Google\Cloud\Core\Testing\stub(StorageClient::class); + $storage = \Google\Cloud\Core\Testing\Functions::stub(StorageClient::class); $storage->___setProperty('connection', $this->prophesize(StorageConnection::class)->reveal()); $snippet = $this->snippetFromMethod(Table::class, 'extract'); $snippet->addLocal('storage', $storage); @@ -274,7 +274,7 @@ public function testLoad() public function testLoadFromStorage() { - $storage = \Google\Cloud\Core\Testing\stub(StorageClient::class); + $storage = \Google\Cloud\Core\Testing\Functions::stub(StorageClient::class); $storage->___setProperty('connection', $this->prophesize(StorageConnection::class)->reveal()); $snippet = $this->snippetFromMethod(Table::class, 'loadFromStorage'); $snippet->addLocal('storage', $storage); diff --git a/tests/snippets/BigQuery/TimeTest.php b/tests/snippets/BigQuery/TimeTest.php index d73d1a538ed2..08631dca3d12 100644 --- a/tests/snippets/BigQuery/TimeTest.php +++ b/tests/snippets/BigQuery/TimeTest.php @@ -29,7 +29,7 @@ class TimeTest extends SnippetTestCase public function testClass() { $snippet = $this->snippetFromClass(Time::class); - $snippet->addLocal('bigQuery', \Google\Cloud\Core\Testing\stub(BigQueryClient::class)); + $snippet->addLocal('bigQuery', \Google\Cloud\Core\Testing\Functions::stub(BigQueryClient::class)); $res = $snippet->invoke('time'); $this->assertInstanceOf(Time::class, $res->returnVal()); diff --git a/tests/snippets/BigQuery/TimestampTest.php b/tests/snippets/BigQuery/TimestampTest.php index 7bc3affc1b1d..3436d2cf4d1e 100644 --- a/tests/snippets/BigQuery/TimestampTest.php +++ b/tests/snippets/BigQuery/TimestampTest.php @@ -29,7 +29,7 @@ class TimestampTest extends SnippetTestCase public function testClass() { $snippet = $this->snippetFromClass(Timestamp::class); - $snippet->addLocal('bigQuery', \Google\Cloud\Core\Testing\stub(BigQueryClient::class)); + $snippet->addLocal('bigQuery', \Google\Cloud\Core\Testing\Functions::stub(BigQueryClient::class)); $res = $snippet->invoke('timestamp'); $this->assertInstanceOf(Timestamp::class, $res->returnVal()); diff --git a/tests/snippets/Core/Iam/IamTest.php b/tests/snippets/Core/Iam/IamTest.php index 9e1c02cf2cb8..cc17abcb9739 100644 --- a/tests/snippets/Core/Iam/IamTest.php +++ b/tests/snippets/Core/Iam/IamTest.php @@ -39,7 +39,7 @@ public function setUp() $this->resource = 'testObject'; $this->connection = $this->prophesize(IamConnectionInterface::class); - $this->iam = \Google\Cloud\Core\Testing\stub(Iam::class, [$this->connection->reveal(), $this->resource]); + $this->iam = \Google\Cloud\Core\Testing\Functions::stub(Iam::class, [$this->connection->reveal(), $this->resource]); $this->iam->___setProperty('connection', $this->connection->reveal()); } diff --git a/tests/snippets/Core/LongRunning/LongRunningOperationTest.php b/tests/snippets/Core/LongRunning/LongRunningOperationTest.php index 4e0a917a07c7..4cd7b0184ef5 100644 --- a/tests/snippets/Core/LongRunning/LongRunningOperationTest.php +++ b/tests/snippets/Core/LongRunning/LongRunningOperationTest.php @@ -41,7 +41,7 @@ public function setUp() $this->callables = [ ['typeUrl' => self::TYPE, 'callable' => function($res) { return $res; }] ]; - $this->operation = \Google\Cloud\Core\Testing\stub(LongRunningOperation::class, [ + $this->operation = \Google\Cloud\Core\Testing\Functions::stub(LongRunningOperation::class, [ $this->connection->reveal(), self::NAME, $this->callables diff --git a/tests/snippets/Datastore/Query/GqlQueryTest.php b/tests/snippets/Datastore/Query/GqlQueryTest.php index e7272021b794..1d0753025a01 100644 --- a/tests/snippets/Datastore/Query/GqlQueryTest.php +++ b/tests/snippets/Datastore/Query/GqlQueryTest.php @@ -39,7 +39,7 @@ public function setUp() { $this->datastore = new DatastoreClient; $this->connection = $this->prophesize(ConnectionInterface::class); - $this->operation = \Google\Cloud\Core\Testing\stub(Operation::class, [ + $this->operation = \Google\Cloud\Core\Testing\Functions::stub(Operation::class, [ $this->connection->reveal(), 'my-awesome-project', '', diff --git a/tests/snippets/Datastore/Query/QueryTest.php b/tests/snippets/Datastore/Query/QueryTest.php index 99b2356f98a0..1d71fdb96135 100644 --- a/tests/snippets/Datastore/Query/QueryTest.php +++ b/tests/snippets/Datastore/Query/QueryTest.php @@ -43,7 +43,7 @@ public function setUp() $this->datastore = new DatastoreClient; $this->connection = $this->prophesize(ConnectionInterface::class); - $this->operation = \Google\Cloud\Core\Testing\stub(Operation::class, [ + $this->operation = \Google\Cloud\Core\Testing\Functions::stub(Operation::class, [ $this->connection->reveal(), 'my-awesome-project', '', diff --git a/tests/snippets/Datastore/TransactionTest.php b/tests/snippets/Datastore/TransactionTest.php index e518597362c8..c210a6787ec5 100644 --- a/tests/snippets/Datastore/TransactionTest.php +++ b/tests/snippets/Datastore/TransactionTest.php @@ -44,7 +44,7 @@ class TransactionTest extends SnippetTestCase public function setUp() { $this->connection = $this->prophesize(ConnectionInterface::class); - $this->operation = \Google\Cloud\Core\Testing\stub(Operation::class, [ + $this->operation = \Google\Cloud\Core\Testing\Functions::stub(Operation::class, [ $this->connection->reveal(), self::PROJECT, '', diff --git a/tests/snippets/Firestore/CollectionReferenceTest.php b/tests/snippets/Firestore/CollectionReferenceTest.php index 8b0831f7bbf9..4dd755ea4b96 100644 --- a/tests/snippets/Firestore/CollectionReferenceTest.php +++ b/tests/snippets/Firestore/CollectionReferenceTest.php @@ -44,7 +44,7 @@ class CollectionReferenceTest extends SnippetTestCase public function setUp() { $this->connection = $this->prophesize(ConnectionInterface::class); - $this->collection = \Google\Cloud\Core\Testing\stub(CollectionReference::class, [ + $this->collection = \Google\Cloud\Core\Testing\Functions::stub(CollectionReference::class, [ $this->connection->reveal(), new ValueMapper($this->connection->reveal(), false), self::NAME diff --git a/tests/snippets/Firestore/DocumentReferenceTest.php b/tests/snippets/Firestore/DocumentReferenceTest.php index 5cff140f4590..8c7664d55bcc 100644 --- a/tests/snippets/Firestore/DocumentReferenceTest.php +++ b/tests/snippets/Firestore/DocumentReferenceTest.php @@ -45,7 +45,7 @@ class DocumentReferenceTest extends SnippetTestCase public function setUp() { $this->connection = $this->prophesize(ConnectionInterface::class); - $this->document = \Google\Cloud\Core\Testing\stub(DocumentReferenceStub::class, [ + $this->document = \Google\Cloud\Core\Testing\Functions::stub(DocumentReferenceStub::class, [ $this->connection->reveal(), new ValueMapper($this->connection->reveal(), false), $this->prophesize(CollectionReference::class)->reveal(), diff --git a/tests/snippets/Firestore/DocumentSnapshotTest.php b/tests/snippets/Firestore/DocumentSnapshotTest.php index 4b2a296acb0e..b4ccb1f974bd 100644 --- a/tests/snippets/Firestore/DocumentSnapshotTest.php +++ b/tests/snippets/Firestore/DocumentSnapshotTest.php @@ -47,7 +47,7 @@ public function setUp() $ref->id()->willReturn(array_pop($parts)); $ref->path()->willReturn(explode('/documents/', self::DOCUMENT)[1]); - $this->snapshot = \Google\Cloud\Core\Testing\stub(DocumentSnapshot::class, [ + $this->snapshot = \Google\Cloud\Core\Testing\Functions::stub(DocumentSnapshot::class, [ $ref->reveal(), new ValueMapper($this->prophesize(ConnectionInterface::class)->reveal(), false), [], @@ -67,7 +67,7 @@ public function testClass() ['missing' => self::DOCUMENT] ])); - $client = \Google\Cloud\Core\Testing\stub(FirestoreClient::class); + $client = \Google\Cloud\Core\Testing\Functions::stub(FirestoreClient::class); $client->___setProperty('connection', $connection->reveal()); $snippet = $this->snippetFromClass(DocumentSnapshot::class); $snippet->setLine(2, ''); diff --git a/tests/snippets/Firestore/FieldValueTest.php b/tests/snippets/Firestore/FieldValueTest.php index 355594cb9d75..e208eb1e69b3 100644 --- a/tests/snippets/Firestore/FieldValueTest.php +++ b/tests/snippets/Firestore/FieldValueTest.php @@ -41,7 +41,7 @@ public function setUp() $this->checkAndSkipGrpcTests(); $this->connection = $this->prophesize(ConnectionInterface::class); - $this->firestore = \Google\Cloud\Core\Testing\stub(FirestoreClient::class); + $this->firestore = \Google\Cloud\Core\Testing\Functions::stub(FirestoreClient::class); } public function testDeleteField() diff --git a/tests/snippets/Firestore/FirestoreClientTest.php b/tests/snippets/Firestore/FirestoreClientTest.php index a0f333580f1b..e816b5c2b17e 100644 --- a/tests/snippets/Firestore/FirestoreClientTest.php +++ b/tests/snippets/Firestore/FirestoreClientTest.php @@ -51,7 +51,7 @@ public function setUp() $this->checkAndSkipGrpcTests(); $this->connection = $this->prophesize(ConnectionInterface::class); - $this->client = \Google\Cloud\Core\Testing\stub(FirestoreClient::class, [ + $this->client = \Google\Cloud\Core\Testing\Functions::stub(FirestoreClient::class, [ ['projectId' => self::PROJECT] ]); } diff --git a/tests/snippets/Firestore/QuerySnapshotTest.php b/tests/snippets/Firestore/QuerySnapshotTest.php index f81f2c5cbea9..41d677a15fcc 100644 --- a/tests/snippets/Firestore/QuerySnapshotTest.php +++ b/tests/snippets/Firestore/QuerySnapshotTest.php @@ -40,7 +40,7 @@ class QuerySnapshotTest extends SnippetTestCase public function setUp() { $this->connection = $this->prophesize(ConnectionInterface::class); - $this->snapshot = \Google\Cloud\Core\Testing\stub(QuerySnapshot::class, [ + $this->snapshot = \Google\Cloud\Core\Testing\Functions::stub(QuerySnapshot::class, [ $this->prophesize(Query::class)->reveal(), [] ], ['rows']); @@ -54,7 +54,7 @@ public function testClass() ->shouldBeCalled() ->willReturn(new \ArrayIterator([])); - $client = \Google\Cloud\Core\Testing\stub(FirestoreClient::class); + $client = \Google\Cloud\Core\Testing\Functions::stub(FirestoreClient::class); $client->___setProperty('connection', $this->connection->reveal()); $snippet = $this->snippetFromClass(QuerySnapshot::class); diff --git a/tests/snippets/Firestore/QueryTest.php b/tests/snippets/Firestore/QueryTest.php index b7055ca69a9b..dcf9f949f668 100644 --- a/tests/snippets/Firestore/QueryTest.php +++ b/tests/snippets/Firestore/QueryTest.php @@ -43,7 +43,7 @@ class QueryTest extends SnippetTestCase public function setUp() { $this->connection = $this->prophesize(ConnectionInterface::class); - $this->query = \Google\Cloud\Core\Testing\stub(Query::class, [ + $this->query = \Google\Cloud\Core\Testing\Functions::stub(Query::class, [ $this->connection->reveal(), new ValueMapper($this->connection->reveal(), false), self::NAME, diff --git a/tests/snippets/Firestore/TransactionTest.php b/tests/snippets/Firestore/TransactionTest.php index 4fe6800b97de..6687ac7ec33a 100644 --- a/tests/snippets/Firestore/TransactionTest.php +++ b/tests/snippets/Firestore/TransactionTest.php @@ -52,7 +52,7 @@ class TransactionTest extends SnippetTestCase public function setUp() { $this->connection = $this->prophesize(ConnectionInterface::class); - $this->transaction = \Google\Cloud\Core\Testing\stub(TransactionStub::class, [ + $this->transaction = \Google\Cloud\Core\Testing\Functions::stub(TransactionStub::class, [ $this->connection->reveal(), new ValueMapper($this->connection->reveal(), false), self::DATABASE, @@ -76,7 +76,7 @@ public function testClass() $this->connection->rollback(Argument::any()) ->shouldBeCalled(); - $client = \Google\Cloud\Core\Testing\stub(FirestoreClient::class); + $client = \Google\Cloud\Core\Testing\Functions::stub(FirestoreClient::class); $client->___setProperty('connection', $this->connection->reveal()); $snippet = $this->snippetFromClass(Transaction::class); diff --git a/tests/snippets/Firestore/WriteBatchTest.php b/tests/snippets/Firestore/WriteBatchTest.php index dce65c9e3d58..c35ef230dc74 100644 --- a/tests/snippets/Firestore/WriteBatchTest.php +++ b/tests/snippets/Firestore/WriteBatchTest.php @@ -43,7 +43,7 @@ class WriteBatchTest extends SnippetTestCase public function setUp() { $this->connection = $this->prophesize(ConnectionInterface::class); - $this->batch = \Google\Cloud\Core\Testing\stub(WriteBatch::class, [ + $this->batch = \Google\Cloud\Core\Testing\Functions::stub(WriteBatch::class, [ $this->connection->reveal(), new ValueMapper($this->connection->reveal(), false), self::DATABASE diff --git a/tests/snippets/Language/LanguageClientTest.php b/tests/snippets/Language/LanguageClientTest.php index 58c3dc205ac0..8fcc62a534eb 100644 --- a/tests/snippets/Language/LanguageClientTest.php +++ b/tests/snippets/Language/LanguageClientTest.php @@ -33,7 +33,7 @@ class LanguageClientTest extends SnippetTestCase public function setUp() { $this->connection = $this->prophesize(ConnectionInterface::class); - $this->client = \Google\Cloud\Core\Testing\stub(LanguageClient::class); + $this->client = \Google\Cloud\Core\Testing\Functions::stub(LanguageClient::class); $this->client->___setProperty('connection', $this->connection->reveal()); } diff --git a/tests/snippets/Logging/LoggerTest.php b/tests/snippets/Logging/LoggerTest.php index 9b8c19a4b748..f83de34d4c9f 100644 --- a/tests/snippets/Logging/LoggerTest.php +++ b/tests/snippets/Logging/LoggerTest.php @@ -38,7 +38,7 @@ class LoggerTest extends SnippetTestCase public function setUp() { $this->connection = $this->prophesize(ConnectionInterface::class); - $this->logger = \Google\Cloud\Core\Testing\stub(Logger::class, [ + $this->logger = \Google\Cloud\Core\Testing\Functions::stub(Logger::class, [ $this->connection->reveal(), self::NAME, self::PROJECT diff --git a/tests/snippets/Logging/LoggingClientTest.php b/tests/snippets/Logging/LoggingClientTest.php index 4be877be7552..ad786b4f890c 100644 --- a/tests/snippets/Logging/LoggingClientTest.php +++ b/tests/snippets/Logging/LoggingClientTest.php @@ -38,7 +38,7 @@ class LoggingClientTest extends SnippetTestCase public function setUp() { $this->connection = $this->prophesize(ConnectionInterface::class); - $this->client = \Google\Cloud\Core\Testing\stub(LoggingClient::class); + $this->client = \Google\Cloud\Core\Testing\Functions::stub(LoggingClient::class); $this->client->___setProperty('connection', $this->connection->reveal()); } diff --git a/tests/snippets/Logging/MetricTest.php b/tests/snippets/Logging/MetricTest.php index b12d8393c933..42dcf9799809 100644 --- a/tests/snippets/Logging/MetricTest.php +++ b/tests/snippets/Logging/MetricTest.php @@ -36,7 +36,7 @@ class MetricTest extends SnippetTestCase public function setUp() { $this->connection = $this->prophesize(ConnectionInterface::class); - $this->metric = \Google\Cloud\Core\Testing\stub(Metric::class, [ + $this->metric = \Google\Cloud\Core\Testing\Functions::stub(Metric::class, [ $this->connection->reveal(), self::METRIC, self::PROJECT diff --git a/tests/snippets/Logging/SinkTest.php b/tests/snippets/Logging/SinkTest.php index 49b4b3457972..e036e73cfcfc 100644 --- a/tests/snippets/Logging/SinkTest.php +++ b/tests/snippets/Logging/SinkTest.php @@ -36,7 +36,7 @@ class SinkTest extends SnippetTestCase public function setUp() { $this->connection = $this->prophesize(ConnectionInterface::class); - $this->sink = \Google\Cloud\Core\Testing\stub(Sink::class, [ + $this->sink = \Google\Cloud\Core\Testing\Functions::stub(Sink::class, [ $this->connection->reveal(), self::SINK, self::PROJECT diff --git a/tests/snippets/PubSub/PubSubClientTest.php b/tests/snippets/PubSub/PubSubClientTest.php index 347b894e7af1..424e073cd079 100644 --- a/tests/snippets/PubSub/PubSubClientTest.php +++ b/tests/snippets/PubSub/PubSubClientTest.php @@ -45,7 +45,7 @@ class PubSubClientTest extends SnippetTestCase public function setUp() { $this->connection = $this->prophesize(ConnectionInterface::class); - $this->client = \Google\Cloud\Core\Testing\stub(PubSubClient::class, [['transport' => 'rest']]); + $this->client = \Google\Cloud\Core\Testing\Functions::stub(PubSubClient::class, [['transport' => 'rest']]); } public function testClassExample() diff --git a/tests/snippets/PubSub/SnapshotTest.php b/tests/snippets/PubSub/SnapshotTest.php index e195d8d9a262..47a8afff34b9 100644 --- a/tests/snippets/PubSub/SnapshotTest.php +++ b/tests/snippets/PubSub/SnapshotTest.php @@ -38,7 +38,7 @@ class SnapshotTest extends SnippetTestCase public function setUp() { $this->connection = $this->prophesize(ConnectionInterface::class); - $this->snapshot = \Google\Cloud\Core\Testing\stub(Snapshot::class, [ + $this->snapshot = \Google\Cloud\Core\Testing\Functions::stub(Snapshot::class, [ $this->connection->reveal(), self::PROJECT, self::SNAPSHOT, diff --git a/tests/snippets/PubSub/SubscriptionTest.php b/tests/snippets/PubSub/SubscriptionTest.php index 21031c3ef18a..a40fc83e9e94 100644 --- a/tests/snippets/PubSub/SubscriptionTest.php +++ b/tests/snippets/PubSub/SubscriptionTest.php @@ -41,7 +41,7 @@ class SubscriptionTest extends SnippetTestCase public function setUp() { $this->connection = $this->prophesize(ConnectionInterface::class); - $this->subscription = \Google\Cloud\Core\Testing\stub(Subscription::class, [ + $this->subscription = \Google\Cloud\Core\Testing\Functions::stub(Subscription::class, [ $this->connection->reveal(), 'foo', self::SUBSCRIPTION, @@ -49,7 +49,7 @@ public function setUp() false ]); - $this->pubsub = \Google\Cloud\Core\Testing\stub(PubSubClient::class, [['transport' => 'rest']]); + $this->pubsub = \Google\Cloud\Core\Testing\Functions::stub(PubSubClient::class, [['transport' => 'rest']]); $this->pubsub->___setProperty('connection', $this->connection->reveal()); } diff --git a/tests/snippets/PubSub/TopicTest.php b/tests/snippets/PubSub/TopicTest.php index e4cf788d1b5f..8c8beb8f7f6d 100644 --- a/tests/snippets/PubSub/TopicTest.php +++ b/tests/snippets/PubSub/TopicTest.php @@ -42,8 +42,8 @@ class TopicTest extends SnippetTestCase public function setUp() { $this->connection = $this->prophesize(ConnectionInterface::class); - $this->pubsub = \Google\Cloud\Core\Testing\stub(PubSubClient::class); - $this->topic = \Google\Cloud\Core\Testing\stub(Topic::class, [ + $this->pubsub = \Google\Cloud\Core\Testing\Functions::stub(PubSubClient::class); + $this->topic = \Google\Cloud\Core\Testing\Functions::stub(Topic::class, [ $this->connection->reveal(), 'my-awesome-project', self::TOPIC, diff --git a/tests/snippets/Spanner/DatabaseTest.php b/tests/snippets/Spanner/DatabaseTest.php index f510175afde6..e6e422603985 100644 --- a/tests/snippets/Spanner/DatabaseTest.php +++ b/tests/snippets/Spanner/DatabaseTest.php @@ -70,7 +70,7 @@ public function setUp() ->willReturn(null); $this->connection = $this->prophesize(ConnectionInterface::class); - $this->database = \Google\Cloud\Core\Testing\stub(Database::class, [ + $this->database = \Google\Cloud\Core\Testing\Functions::stub(Database::class, [ $this->connection->reveal(), $instance->reveal(), $this->prophesize(LongRunningConnectionInterface::class)->reveal(), @@ -83,7 +83,7 @@ public function setUp() private function stubOperation() { - $operation = \Google\Cloud\Core\Testing\stub(Operation::class, [ + $operation = \Google\Cloud\Core\Testing\Functions::stub(Operation::class, [ $this->connection->reveal(), false ]); diff --git a/tests/snippets/Spanner/InstanceConfigurationTest.php b/tests/snippets/Spanner/InstanceConfigurationTest.php index 193762998879..dbc7f4f594c0 100644 --- a/tests/snippets/Spanner/InstanceConfigurationTest.php +++ b/tests/snippets/Spanner/InstanceConfigurationTest.php @@ -43,7 +43,7 @@ public function setUp() $this->checkAndSkipGrpcTests(); $this->connection = $this->prophesize(ConnectionInterface::class); - $this->config = \Google\Cloud\Core\Testing\stub(InstanceConfiguration::class, [ + $this->config = \Google\Cloud\Core\Testing\Functions::stub(InstanceConfiguration::class, [ $this->connection->reveal(), self::PROJECT, self::CONFIG diff --git a/tests/snippets/Spanner/InstanceTest.php b/tests/snippets/Spanner/InstanceTest.php index 0d722176b01d..8cbd9947bdcf 100644 --- a/tests/snippets/Spanner/InstanceTest.php +++ b/tests/snippets/Spanner/InstanceTest.php @@ -51,7 +51,7 @@ public function setUp() $this->checkAndSkipGrpcTests(); $this->connection = $this->prophesize(ConnectionInterface::class); - $this->instance = \Google\Cloud\Core\Testing\stub(Instance::class, [ + $this->instance = \Google\Cloud\Core\Testing\Functions::stub(Instance::class, [ $this->connection->reveal(), $this->prophesize(LongRunningConnectionInterface::class)->reveal(), [], diff --git a/tests/snippets/Spanner/SnapshotTest.php b/tests/snippets/Spanner/SnapshotTest.php index 0816b3e1614c..dc73c83c2d11 100644 --- a/tests/snippets/Spanner/SnapshotTest.php +++ b/tests/snippets/Spanner/SnapshotTest.php @@ -51,7 +51,7 @@ public function setUp() $operation = $this->prophesize(Operation::class); $session = $this->prophesize(Session::class); - $this->snapshot = \Google\Cloud\Core\Testing\stub(Snapshot::class, [ + $this->snapshot = \Google\Cloud\Core\Testing\Functions::stub(Snapshot::class, [ $operation->reveal(), $session->reveal(), [ @@ -63,7 +63,7 @@ public function setUp() private function stubOperation($stub = null) { - $operation = \Google\Cloud\Core\Testing\stub(Operation::class, [ + $operation = \Google\Cloud\Core\Testing\Functions::stub(Operation::class, [ $this->connection->reveal(), false ]); diff --git a/tests/snippets/Spanner/SpannerClientTest.php b/tests/snippets/Spanner/SpannerClientTest.php index d584b87d501b..222a424139db 100644 --- a/tests/snippets/Spanner/SpannerClientTest.php +++ b/tests/snippets/Spanner/SpannerClientTest.php @@ -55,7 +55,7 @@ public function setUp() $this->checkAndSkipGrpcTests(); $this->connection = $this->prophesize(ConnectionInterface::class); - $this->client = \Google\Cloud\Core\Testing\stub(SpannerClient::class); + $this->client = \Google\Cloud\Core\Testing\Functions::stub(SpannerClient::class); $this->client->___setProperty('connection', $this->connection->reveal()); } diff --git a/tests/snippets/Spanner/TransactionTest.php b/tests/snippets/Spanner/TransactionTest.php index 34d759a8e3fd..82ac6b4487bc 100644 --- a/tests/snippets/Spanner/TransactionTest.php +++ b/tests/snippets/Spanner/TransactionTest.php @@ -50,7 +50,7 @@ public function setUp() $operation = $this->prophesize(Operation::class); $session = $this->prophesize(Session::class); - $this->transaction = \Google\Cloud\Core\Testing\stub(Transaction::class, [ + $this->transaction = \Google\Cloud\Core\Testing\Functions::stub(Transaction::class, [ $operation->reveal(), $session->reveal(), self::TRANSACTION @@ -59,7 +59,7 @@ public function setUp() private function stubOperation($stub = null) { - $operation = \Google\Cloud\Core\Testing\stub(Operation::class, [ + $operation = \Google\Cloud\Core\Testing\Functions::stub(Operation::class, [ $this->connection->reveal(), false ]); diff --git a/tests/snippets/Speech/OperationTest.php b/tests/snippets/Speech/OperationTest.php index b0d13a3dd7e7..1659c88a49b0 100644 --- a/tests/snippets/Speech/OperationTest.php +++ b/tests/snippets/Speech/OperationTest.php @@ -48,7 +48,7 @@ public function setUp() ]; $this->connection = $this->prophesize(ConnectionInterface::class); - $this->operation = \Google\Cloud\Core\Testing\stub(Operation::class, [ + $this->operation = \Google\Cloud\Core\Testing\Functions::stub(Operation::class, [ $this->connection->reveal(), $this->opData['name'], $this->opData diff --git a/tests/snippets/Speech/SpeechClientTest.php b/tests/snippets/Speech/SpeechClientTest.php index 0f345a96e511..6191596fb6eb 100644 --- a/tests/snippets/Speech/SpeechClientTest.php +++ b/tests/snippets/Speech/SpeechClientTest.php @@ -36,7 +36,7 @@ public function setUp() { $this->testFile = "'" . __DIR__ . '/../fixtures/Speech/demo.flac' . "'"; $this->connection = $this->prophesize(ConnectionInterface::class); - $this->client = \Google\Cloud\Core\Testing\stub(SpeechClient::class, [ + $this->client = \Google\Cloud\Core\Testing\Functions::stub(SpeechClient::class, [ ['languageCode' => 'en-US'] ]); $this->client->___setProperty('connection', $this->connection->reveal()); diff --git a/tests/snippets/Storage/AclTest.php b/tests/snippets/Storage/AclTest.php index 35972580ad5d..f4964486f27e 100644 --- a/tests/snippets/Storage/AclTest.php +++ b/tests/snippets/Storage/AclTest.php @@ -33,7 +33,7 @@ class AclTest extends SnippetTestCase public function setUp() { $this->connection = $this->prophesize(ConnectionInterface::class); - $this->acl = \Google\Cloud\Core\Testing\stub(Acl::class, [ + $this->acl = \Google\Cloud\Core\Testing\Functions::stub(Acl::class, [ $this->connection->reveal(), 'bucketAccessControls', [] diff --git a/tests/snippets/Storage/BucketTest.php b/tests/snippets/Storage/BucketTest.php index fc8ee700e805..a524e24dbaf2 100644 --- a/tests/snippets/Storage/BucketTest.php +++ b/tests/snippets/Storage/BucketTest.php @@ -51,7 +51,7 @@ public function setUp() $this->connection = $this->prophesize(Rest::class); $this->connection->projectId() ->willReturn(self::PROJECT_ID); - $this->bucket = \Google\Cloud\Core\Testing\stub(Bucket::class, [ + $this->bucket = \Google\Cloud\Core\Testing\Functions::stub(Bucket::class, [ $this->connection->reveal(), self::BUCKET, [] diff --git a/tests/snippets/Storage/NotificationTest.php b/tests/snippets/Storage/NotificationTest.php index f112a982ad17..51724a577910 100644 --- a/tests/snippets/Storage/NotificationTest.php +++ b/tests/snippets/Storage/NotificationTest.php @@ -40,7 +40,7 @@ class NotificationTest extends SnippetTestCase public function setUp() { $this->connection = $this->prophesize(Rest::class); - $this->notification = \Google\Cloud\Core\Testing\stub(Notification::class, [ + $this->notification = \Google\Cloud\Core\Testing\Functions::stub(Notification::class, [ $this->connection->reveal(), self::NOTIFICATION_ID, self::BUCKET diff --git a/tests/snippets/Storage/StorageClientTest.php b/tests/snippets/Storage/StorageClientTest.php index f121605ee230..cda1abe606f5 100644 --- a/tests/snippets/Storage/StorageClientTest.php +++ b/tests/snippets/Storage/StorageClientTest.php @@ -43,7 +43,7 @@ public function setUp() $this->connection = $this->prophesize(Rest::class); $this->connection->projectId() ->willReturn(self::PROJECT_ID); - $this->client = \Google\Cloud\Core\Testing\stub(StorageClient::class); + $this->client = \Google\Cloud\Core\Testing\Functions::stub(StorageClient::class); $this->client->___setProperty('connection', $this->connection->reveal()); } diff --git a/tests/snippets/Storage/StorageObjectTest.php b/tests/snippets/Storage/StorageObjectTest.php index a98de934afd0..c61d82e0d580 100644 --- a/tests/snippets/Storage/StorageObjectTest.php +++ b/tests/snippets/Storage/StorageObjectTest.php @@ -47,7 +47,7 @@ class StorageObjectTest extends SnippetTestCase public function setUp() { $this->connection = $this->prophesize(Rest::class); - $this->object = \Google\Cloud\Core\Testing\stub(StorageObject::class, [ + $this->object = \Google\Cloud\Core\Testing\Functions::stub(StorageObject::class, [ $this->connection->reveal(), self::OBJECT, self::BUCKET diff --git a/tests/snippets/Trace/TraceClientTest.php b/tests/snippets/Trace/TraceClientTest.php index f2d3d206b1d6..29154a46be89 100644 --- a/tests/snippets/Trace/TraceClientTest.php +++ b/tests/snippets/Trace/TraceClientTest.php @@ -34,7 +34,7 @@ class TraceClientTest extends SnippetTestCase public function setUp() { $this->connection = $this->prophesize(ConnectionInterface::class); - $this->client = \Google\Cloud\Core\Testing\stub(TraceClient::class); + $this->client = \Google\Cloud\Core\Testing\Functions::stub(TraceClient::class); $this->client->___setProperty('connection', $this->connection->reveal()); } diff --git a/tests/snippets/Translate/TranslateClientTest.php b/tests/snippets/Translate/TranslateClientTest.php index 7b6bd53bf5d1..a1113c6d19ef 100644 --- a/tests/snippets/Translate/TranslateClientTest.php +++ b/tests/snippets/Translate/TranslateClientTest.php @@ -33,7 +33,7 @@ class TranslateClientTest extends SnippetTestCase public function setUp() { $this->connection = $this->prophesize(ConnectionInterface::class); - $this->client = \Google\Cloud\Core\Testing\stub(TranslateClient::class); + $this->client = \Google\Cloud\Core\Testing\Functions::stub(TranslateClient::class); $this->client->___setProperty('connection', $this->connection->reveal()); } diff --git a/tests/snippets/Vision/VisionClientTest.php b/tests/snippets/Vision/VisionClientTest.php index 38ea352ee39f..f3e310af1881 100644 --- a/tests/snippets/Vision/VisionClientTest.php +++ b/tests/snippets/Vision/VisionClientTest.php @@ -35,7 +35,7 @@ class VisionClientTest extends SnippetTestCase public function setUp() { $this->connection = $this->prophesize(ConnectionInterface::class); - $this->client = \Google\Cloud\Core\Testing\stub(VisionClient::class); + $this->client = \Google\Cloud\Core\Testing\Functions::stub(VisionClient::class); $this->client->___setProperty('connection', $this->connection->reveal()); } diff --git a/tests/unit/BigQuery/BigQueryClientTest.php b/tests/unit/BigQuery/BigQueryClientTest.php index 6bf581249f3b..be7c2e88f7f4 100644 --- a/tests/unit/BigQuery/BigQueryClientTest.php +++ b/tests/unit/BigQuery/BigQueryClientTest.php @@ -47,7 +47,7 @@ class BigQueryClientTest extends TestCase public function setUp() { $this->connection = $this->prophesize(ConnectionInterface::class); - $this->client = \Google\Cloud\Core\Testing\stub(BigQueryClient::class, ['options' => ['projectId' => self::PROJECT_ID]]); + $this->client = \Google\Cloud\Core\Testing\Functions::stub(BigQueryClient::class, ['options' => ['projectId' => self::PROJECT_ID]]); } public function testQueryConfig() diff --git a/tests/unit/BigQuery/JobConfigurationTraitTest.php b/tests/unit/BigQuery/JobConfigurationTraitTest.php index 7b44af8fb1c4..8dd15373edda 100644 --- a/tests/unit/BigQuery/JobConfigurationTraitTest.php +++ b/tests/unit/BigQuery/JobConfigurationTraitTest.php @@ -33,7 +33,7 @@ class JobConfigurationTraitTest extends TestCase public function setUp() { - $this->trait = \Google\Cloud\Core\Testing\impl(JobConfigurationTrait::class); + $this->trait = \Google\Cloud\Core\Testing\Functions::impl(JobConfigurationTrait::class); } public function testJobConfigurationProperties() diff --git a/tests/unit/BigQuery/JobWaitTraitTest.php b/tests/unit/BigQuery/JobWaitTraitTest.php index 996265cb95ac..74e62e341f58 100644 --- a/tests/unit/BigQuery/JobWaitTraitTest.php +++ b/tests/unit/BigQuery/JobWaitTraitTest.php @@ -31,7 +31,7 @@ class JobWaitTraitTest extends TestCase public function setUp() { - $this->trait = \Google\Cloud\Core\Testing\impl(JobWaitTrait::class); + $this->trait = \Google\Cloud\Core\Testing\Functions::impl(JobWaitTrait::class); $this->job = $this->prophesize(Job::class)->reveal(); } diff --git a/tests/unit/Core/ClientTraitTest.php b/tests/unit/Core/ClientTraitTest.php index 5cdd0bffbd9d..e1f83f54a021 100644 --- a/tests/unit/Core/ClientTraitTest.php +++ b/tests/unit/Core/ClientTraitTest.php @@ -33,9 +33,9 @@ class ClientTraitTest extends TestCase public function setUp() { - $this->impl = \Google\Cloud\Core\Testing\impl(ClientTrait::class); + $this->impl = \Google\Cloud\Core\Testing\Functions::impl(ClientTrait::class); - $this->dependency = \Google\Cloud\Core\Testing\impl(ClientTraitStubGrpcDependencyChecks::class, [ + $this->dependency = \Google\Cloud\Core\Testing\Functions::impl(ClientTraitStubGrpcDependencyChecks::class, [ 'dependencyStatus' ]); } @@ -228,7 +228,7 @@ public function testDetectProjectIdOnGce() $m = $this->prophesize(Metadata::class); $m->getProjectId()->willReturn($projectId)->shouldBeCalled(); - $trait = \Google\Cloud\Core\Testing\impl(ClientTraitStubOnGce::class, ['metadata']); + $trait = \Google\Cloud\Core\Testing\Functions::impl(ClientTraitStubOnGce::class, ['metadata']); $trait->___setProperty('metadata', $m); $res = $trait->call('detectProjectId', [[]]); @@ -246,7 +246,7 @@ public function testDetectProjectIdOnGceButOhNoThereStillIsntAProjectId() $m = $this->prophesize(Metadata::class); $m->getProjectId()->willReturn($projectId)->shouldBeCalled(); - $trait = \Google\Cloud\Core\Testing\impl(ClientTraitStubOnGce::class, ['metadata']); + $trait = \Google\Cloud\Core\Testing\Functions::impl(ClientTraitStubOnGce::class, ['metadata']); $trait->___setProperty('metadata', $m); $res = $trait->call('detectProjectId', [[ @@ -264,7 +264,7 @@ public function testDetectProjectIdEmulator() $m = $this->prophesize(Metadata::class); $m->getProjectId()->willReturn(false)->shouldBeCalled(); - $trait = \Google\Cloud\Core\Testing\impl(ClientTraitStubOnGce::class, ['metadata']); + $trait = \Google\Cloud\Core\Testing\Functions::impl(ClientTraitStubOnGce::class, ['metadata']); $trait->___setProperty('metadata', $m); $res = $trait->call('detectProjectId', [[ diff --git a/tests/unit/Core/ConcurrencyControlTraitTest.php b/tests/unit/Core/ConcurrencyControlTraitTest.php index 0cf32905d5f3..c568f36a3aa9 100644 --- a/tests/unit/Core/ConcurrencyControlTraitTest.php +++ b/tests/unit/Core/ConcurrencyControlTraitTest.php @@ -31,7 +31,7 @@ class ConcurrencyControlTraitTest extends TestCase public function setUp() { - $this->trait = \Google\Cloud\Core\Testing\impl(ConcurrencyControlTrait::class); + $this->trait = \Google\Cloud\Core\Testing\Functions::impl(ConcurrencyControlTrait::class); } public function testApplyEtagHeader() diff --git a/tests/unit/Core/EmulatorTraitTest.php b/tests/unit/Core/EmulatorTraitTest.php index 0bfd0723471e..6ed246a3d9c5 100644 --- a/tests/unit/Core/EmulatorTraitTest.php +++ b/tests/unit/Core/EmulatorTraitTest.php @@ -30,7 +30,7 @@ class EmulatorTraitTest extends TestCase public function setUp() { - $this->impl = \Google\Cloud\Core\Testing\impl(EmulatorTrait::class); + $this->impl = \Google\Cloud\Core\Testing\Functions::impl(EmulatorTrait::class); } public function testEmulatorBaseUri() diff --git a/tests/unit/Core/GrpcTraitTest.php b/tests/unit/Core/GrpcTraitTest.php index da3988e5c811..6e866c8ac177 100644 --- a/tests/unit/Core/GrpcTraitTest.php +++ b/tests/unit/Core/GrpcTraitTest.php @@ -42,7 +42,7 @@ public function setUp() { $this->checkAndSkipGrpcTests(); - $this->implementation = \Google\Cloud\Core\Testing\impl(GrpcTrait::class); + $this->implementation = \Google\Cloud\Core\Testing\Functions::impl(GrpcTrait::class); $this->requestWrapper = $this->prophesize(GrpcRequestWrapper::class); } diff --git a/tests/unit/Core/JsonTraitTest.php b/tests/unit/Core/JsonTraitTest.php index c78062f20cad..437ee95f9eb2 100644 --- a/tests/unit/Core/JsonTraitTest.php +++ b/tests/unit/Core/JsonTraitTest.php @@ -29,7 +29,7 @@ class JsonTraitTest extends TestCase public function setUp() { - $this->implementation = \Google\Cloud\Core\Testing\impl(JsonTrait::class); + $this->implementation = \Google\Cloud\Core\Testing\Functions::impl(JsonTrait::class); } public function testJsonEncode() diff --git a/tests/unit/Firestore/CollectionReferenceTest.php b/tests/unit/Firestore/CollectionReferenceTest.php index 7cf82e8e7fcf..570787f967b0 100644 --- a/tests/unit/Firestore/CollectionReferenceTest.php +++ b/tests/unit/Firestore/CollectionReferenceTest.php @@ -42,7 +42,7 @@ class CollectionReferenceTest extends TestCase public function setUp() { $this->connection = $this->prophesize(ConnectionInterface::class); - $this->collection = \Google\Cloud\Core\Testing\stub(CollectionReference::class, [ + $this->collection = \Google\Cloud\Core\Testing\Functions::stub(CollectionReference::class, [ $this->connection->reveal(), new ValueMapper($this->connection->reveal(), false), self::NAME @@ -131,7 +131,7 @@ public function testRandomNames(DocumentReference $doc) public function randomNames() { $connection = $this->prophesize(ConnectionInterface::class); - $collection = \Google\Cloud\Core\Testing\stub(CollectionReference::class, [ + $collection = \Google\Cloud\Core\Testing\Functions::stub(CollectionReference::class, [ $connection->reveal(), new ValueMapper($connection->reveal(), false), self::NAME diff --git a/tests/unit/Firestore/DocumentReferenceTest.php b/tests/unit/Firestore/DocumentReferenceTest.php index 2ec4d7feed62..df189390195c 100644 --- a/tests/unit/Firestore/DocumentReferenceTest.php +++ b/tests/unit/Firestore/DocumentReferenceTest.php @@ -46,7 +46,7 @@ public function setUp() $this->connection = $this->prophesize(ConnectionInterface::class); $valueMapper = new ValueMapper($this->connection->reveal(), false); - $this->document = \Google\Cloud\Core\Testing\stub(DocumentReference::class, [ + $this->document = \Google\Cloud\Core\Testing\Functions::stub(DocumentReference::class, [ $this->connection->reveal(), $valueMapper, new CollectionReference($this->connection->reveal(), $valueMapper, self::COLLECTION), diff --git a/tests/unit/Firestore/DocumentSnapshotTest.php b/tests/unit/Firestore/DocumentSnapshotTest.php index dfa3fea999cf..a8b5daed63d6 100644 --- a/tests/unit/Firestore/DocumentSnapshotTest.php +++ b/tests/unit/Firestore/DocumentSnapshotTest.php @@ -43,7 +43,7 @@ public function setUp() $ref->id()->willReturn(self::ID); $ref->path()->willReturn('a/b'); - $this->snapshot = \Google\Cloud\Core\Testing\stub(DocumentSnapshot::class, [ + $this->snapshot = \Google\Cloud\Core\Testing\Functions::stub(DocumentSnapshot::class, [ $ref->reveal(), new ValueMapper($this->prophesize(ConnectionInterface::class)->reveal(), false), [], [], true diff --git a/tests/unit/Firestore/FirestoreClientTest.php b/tests/unit/Firestore/FirestoreClientTest.php index 081c6975e75f..de448d67041f 100644 --- a/tests/unit/Firestore/FirestoreClientTest.php +++ b/tests/unit/Firestore/FirestoreClientTest.php @@ -51,7 +51,7 @@ public function setUp() $this->checkAndSkipGrpcTests(); $this->connection = $this->prophesize(ConnectionInterface::class); - $this->client = \Google\Cloud\Core\Testing\stub(FirestoreClient::class); + $this->client = \Google\Cloud\Core\Testing\Functions::stub(FirestoreClient::class); } public function testBatch() diff --git a/tests/unit/Firestore/PathTraitTest.php b/tests/unit/Firestore/PathTraitTest.php index 286d720e9a7a..a5cf0a754012 100644 --- a/tests/unit/Firestore/PathTraitTest.php +++ b/tests/unit/Firestore/PathTraitTest.php @@ -36,7 +36,7 @@ class PathTraitTest extends TestCase public function setUp() { - $this->impl = \Google\Cloud\Core\Testing\impl(PathTrait::class); + $this->impl = \Google\Cloud\Core\Testing\Functions::impl(PathTrait::class); } public function testFullName() diff --git a/tests/unit/Firestore/QuerySnapshotTest.php b/tests/unit/Firestore/QuerySnapshotTest.php index ef599bce47be..f27f551ceec5 100644 --- a/tests/unit/Firestore/QuerySnapshotTest.php +++ b/tests/unit/Firestore/QuerySnapshotTest.php @@ -37,7 +37,7 @@ class QuerySnapshotTest extends TestCase public function setUp() { $this->connection = $this->prophesize(ConnectionInterface::class); - $this->snapshot = \Google\Cloud\Core\Testing\stub(QuerySnapshot::class, [ + $this->snapshot = \Google\Cloud\Core\Testing\Functions::stub(QuerySnapshot::class, [ $this->prophesize(Query::class)->reveal(), [] ], ['rows']); diff --git a/tests/unit/Firestore/QueryTest.php b/tests/unit/Firestore/QueryTest.php index c471f471b269..0ce5b44e6557 100644 --- a/tests/unit/Firestore/QueryTest.php +++ b/tests/unit/Firestore/QueryTest.php @@ -51,7 +51,7 @@ class QueryTest extends TestCase public function setUp() { $this->connection = $this->prophesize(ConnectionInterface::class); - $this->query = \Google\Cloud\Core\Testing\stub(Query::class, [ + $this->query = \Google\Cloud\Core\Testing\Functions::stub(Query::class, [ $this->connection->reveal(), new ValueMapper($this->connection->reveal(), false), self::PARENT, diff --git a/tests/unit/Firestore/SnapshotTraitTest.php b/tests/unit/Firestore/SnapshotTraitTest.php index ce50379ee14c..9dc0311f0af4 100644 --- a/tests/unit/Firestore/SnapshotTraitTest.php +++ b/tests/unit/Firestore/SnapshotTraitTest.php @@ -43,7 +43,7 @@ class SnapshotTraitTest extends TestCase public function setUp() { $this->connection = $this->prophesize(ConnectionInterface::class); - $this->impl = \Google\Cloud\Core\Testing\impl(SnapshotTrait::class); + $this->impl = \Google\Cloud\Core\Testing\Functions::impl(SnapshotTrait::class); $this->valueMapper = new ValueMapper($this->connection->reveal(), false); } diff --git a/tests/unit/Firestore/TransactionTest.php b/tests/unit/Firestore/TransactionTest.php index 4ef657759a6d..2241fdbd9ffb 100644 --- a/tests/unit/Firestore/TransactionTest.php +++ b/tests/unit/Firestore/TransactionTest.php @@ -48,7 +48,7 @@ public function setUp() { $this->connection = $this->prophesize(ConnectionInterface::class); $this->valueMapper = new ValueMapper($this->connection->reveal(), false); - $this->transaction = \Google\Cloud\Core\Testing\stub(Transaction::class, [ + $this->transaction = \Google\Cloud\Core\Testing\Functions::stub(Transaction::class, [ $this->connection->reveal(), $this->valueMapper, sprintf('projects/%s/databases/%s', self::PROJECT, self::DATABASE), diff --git a/tests/unit/Firestore/ValueMapperTest.php b/tests/unit/Firestore/ValueMapperTest.php index 7a3939dc83c0..a0da18287bf3 100644 --- a/tests/unit/Firestore/ValueMapperTest.php +++ b/tests/unit/Firestore/ValueMapperTest.php @@ -43,7 +43,7 @@ class ValueMapperTest extends TestCase public function setUp() { $this->connection = $this->prophesize(ConnectionInterface::class); - $this->mapper = \Google\Cloud\Core\Testing\stub(ValueMapper::class, [ + $this->mapper = \Google\Cloud\Core\Testing\Functions::stub(ValueMapper::class, [ $this->connection->reveal(), false ], ['connection', 'returnInt64AsObject']); diff --git a/tests/unit/Firestore/WriteBatchTest.php b/tests/unit/Firestore/WriteBatchTest.php index 720a9718a522..0bb29470a506 100644 --- a/tests/unit/Firestore/WriteBatchTest.php +++ b/tests/unit/Firestore/WriteBatchTest.php @@ -45,7 +45,7 @@ class WriteBatchTest extends TestCase public function setUp() { $this->connection = $this->prophesize(ConnectionInterface::class); - $this->batch = \Google\Cloud\Core\Testing\stub(WriteBatch::class, [ + $this->batch = \Google\Cloud\Core\Testing\Functions::stub(WriteBatch::class, [ $this->connection->reveal(), new ValueMapper($this->connection->reveal(), false), sprintf('projects/%s/databases/%s', self::PROJECT, self::DATABASE) diff --git a/tests/unit/Spanner/Connection/IamDatabaseTest.php b/tests/unit/Spanner/Connection/IamDatabaseTest.php index 06cdf52d725a..2b572ea65648 100644 --- a/tests/unit/Spanner/Connection/IamDatabaseTest.php +++ b/tests/unit/Spanner/Connection/IamDatabaseTest.php @@ -36,7 +36,7 @@ public function setUp() { $this->connection = $this->prophesize(ConnectionInterface::class); - $this->iam = \Google\Cloud\Core\Testing\stub(IamDatabase::class, [$this->connection->reveal()]); + $this->iam = \Google\Cloud\Core\Testing\Functions::stub(IamDatabase::class, [$this->connection->reveal()]); } /** diff --git a/tests/unit/Spanner/Connection/IamInstanceTest.php b/tests/unit/Spanner/Connection/IamInstanceTest.php index 4eec57895a89..afdf0083a61a 100644 --- a/tests/unit/Spanner/Connection/IamInstanceTest.php +++ b/tests/unit/Spanner/Connection/IamInstanceTest.php @@ -36,7 +36,7 @@ public function setUp() { $this->connection = $this->prophesize(ConnectionInterface::class); - $this->iam = \Google\Cloud\Core\Testing\stub(IamInstance::class, [$this->connection->reveal()]); + $this->iam = \Google\Cloud\Core\Testing\Functions::stub(IamInstance::class, [$this->connection->reveal()]); } /** diff --git a/tests/unit/Spanner/Connection/LongRunningConnectionTest.php b/tests/unit/Spanner/Connection/LongRunningConnectionTest.php index 1b307b9fea33..f21ae632d60b 100644 --- a/tests/unit/Spanner/Connection/LongRunningConnectionTest.php +++ b/tests/unit/Spanner/Connection/LongRunningConnectionTest.php @@ -33,7 +33,7 @@ class LongRunningConnectionTest extends TestCase public function setUp() { $this->connection = $this->prophesize(ConnectionInterface::class); - $this->lro = \Google\Cloud\Core\Testing\stub(LongRunningConnection::class, [ + $this->lro = \Google\Cloud\Core\Testing\Functions::stub(LongRunningConnection::class, [ $this->connection->reveal() ]); } diff --git a/tests/unit/Spanner/DatabaseTest.php b/tests/unit/Spanner/DatabaseTest.php index 4987c6376bb3..b96f367175a5 100644 --- a/tests/unit/Spanner/DatabaseTest.php +++ b/tests/unit/Spanner/DatabaseTest.php @@ -99,7 +99,7 @@ public function setUp() 'connection', 'operation' ]; - $this->database = \Google\Cloud\Core\Testing\stub(Database::class, $args, $props); + $this->database = \Google\Cloud\Core\Testing\Functions::stub(Database::class, $args, $props); } public function testName() diff --git a/tests/unit/Spanner/InstanceConfigurationTest.php b/tests/unit/Spanner/InstanceConfigurationTest.php index 04a26e5f27fe..ab008caf6c20 100644 --- a/tests/unit/Spanner/InstanceConfigurationTest.php +++ b/tests/unit/Spanner/InstanceConfigurationTest.php @@ -44,7 +44,7 @@ public function setUp() $this->checkAndSkipGrpcTests(); $this->connection = $this->prophesize(ConnectionInterface::class); - $this->configuration = \Google\Cloud\Core\Testing\stub(InstanceConfiguration::class, [ + $this->configuration = \Google\Cloud\Core\Testing\Functions::stub(InstanceConfiguration::class, [ $this->connection->reveal(), self::PROJECT_ID, self::NAME @@ -62,7 +62,7 @@ public function testInfo() $this->configuration->___setProperty('connection', $this->connection->reveal()); $info = ['foo' => 'bar']; - $config = \Google\Cloud\Core\Testing\stub(InstanceConfiguration::class, [ + $config = \Google\Cloud\Core\Testing\Functions::stub(InstanceConfiguration::class, [ $this->connection->reveal(), self::PROJECT_ID, self::NAME, diff --git a/tests/unit/Spanner/InstanceTest.php b/tests/unit/Spanner/InstanceTest.php index d9a875f1c478..4cbfc308a45a 100644 --- a/tests/unit/Spanner/InstanceTest.php +++ b/tests/unit/Spanner/InstanceTest.php @@ -52,7 +52,7 @@ public function setUp() $this->checkAndSkipGrpcTests(); $this->connection = $this->prophesize(ConnectionInterface::class); - $this->instance = \Google\Cloud\Core\Testing\stub(Instance::class, [ + $this->instance = \Google\Cloud\Core\Testing\Functions::stub(Instance::class, [ $this->connection->reveal(), $this->prophesize(LongRunningConnectionInterface::class)->reveal(), [], diff --git a/tests/unit/Spanner/OperationTest.php b/tests/unit/Spanner/OperationTest.php index 4c3417228039..dba40960a35a 100644 --- a/tests/unit/Spanner/OperationTest.php +++ b/tests/unit/Spanner/OperationTest.php @@ -55,7 +55,7 @@ public function setUp() $this->connection = $this->prophesize(ConnectionInterface::class); - $this->operation = \Google\Cloud\Core\Testing\stub(Operation::class, [ + $this->operation = \Google\Cloud\Core\Testing\Functions::stub(Operation::class, [ $this->connection->reveal(), false ]); diff --git a/tests/unit/Spanner/SpannerClientTest.php b/tests/unit/Spanner/SpannerClientTest.php index 086616b39e6f..625c17f2e9b7 100644 --- a/tests/unit/Spanner/SpannerClientTest.php +++ b/tests/unit/Spanner/SpannerClientTest.php @@ -56,7 +56,7 @@ public function setUp() $this->checkAndSkipGrpcTests(); $this->connection = $this->prophesize(ConnectionInterface::class); - $this->client = \Google\Cloud\Core\Testing\stub(SpannerClient::class, [ + $this->client = \Google\Cloud\Core\Testing\Functions::stub(SpannerClient::class, [ ['projectId' => self::PROJECT] ]); } diff --git a/tests/unit/Spanner/TransactionTest.php b/tests/unit/Spanner/TransactionTest.php index e37c31037f58..c72912eec3f0 100644 --- a/tests/unit/Spanner/TransactionTest.php +++ b/tests/unit/Spanner/TransactionTest.php @@ -80,10 +80,10 @@ public function setUp() 'operation', 'readTimestamp', 'state' ]; - $this->transaction = \Google\Cloud\Core\Testing\stub(Transaction::class, $args, $props); + $this->transaction = \Google\Cloud\Core\Testing\Functions::stub(Transaction::class, $args, $props); unset($args[2]); - $this->singleUseTransaction = \Google\Cloud\Core\Testing\stub(Transaction::class, $args, $props); + $this->singleUseTransaction = \Google\Cloud\Core\Testing\Functions::stub(Transaction::class, $args, $props); } public function testInsert() @@ -303,7 +303,7 @@ public function testIsRetryTrue() true ]; - $transaction = \Google\Cloud\Core\Testing\stub(Transaction::class, $args); + $transaction = \Google\Cloud\Core\Testing\Functions::stub(Transaction::class, $args); $this->assertTrue($transaction->isRetry()); } diff --git a/tests/unit/Spanner/TransactionTypeTest.php b/tests/unit/Spanner/TransactionTypeTest.php index 0d92aa357e11..93db7aefac91 100644 --- a/tests/unit/Spanner/TransactionTypeTest.php +++ b/tests/unit/Spanner/TransactionTypeTest.php @@ -767,7 +767,7 @@ private function database(ConnectionInterface $connection) $instance = $this->prophesize(Instance::class); $instance->name()->willReturn(InstanceAdminClient::instanceName(self::PROJECT, self::INSTANCE)); - $database = \Google\Cloud\Core\Testing\stub(Database::class, [ + $database = \Google\Cloud\Core\Testing\Functions::stub(Database::class, [ $connection, $instance->reveal(), $this->prophesize(LongRunningConnectionInterface::class)->reveal(), diff --git a/tests/unit/Storage/EncryptionTraitTest.php b/tests/unit/Storage/EncryptionTraitTest.php index 655803568994..292a1acc3b8f 100644 --- a/tests/unit/Storage/EncryptionTraitTest.php +++ b/tests/unit/Storage/EncryptionTraitTest.php @@ -32,7 +32,7 @@ class EncryptionTraitTest extends TestCase public function setUp() { - $this->implementation = \Google\Cloud\Core\Testing\impl(EncryptionTrait::class); + $this->implementation = \Google\Cloud\Core\Testing\Functions::impl(EncryptionTrait::class); } public function testSignString() diff --git a/tests/unit/Storage/RequesterPaysTest.php b/tests/unit/Storage/RequesterPaysTest.php index cb188f85cee4..595c8947e427 100644 --- a/tests/unit/Storage/RequesterPaysTest.php +++ b/tests/unit/Storage/RequesterPaysTest.php @@ -43,7 +43,7 @@ class RequesterPaysTest extends TestCase public function setUp() { $this->connection = new Rest(['projectId' => self::PROJECT]); - $this->client = \Google\Cloud\Core\Testing\stub(StorageClient::class); + $this->client = \Google\Cloud\Core\Testing\Functions::stub(StorageClient::class); } /** diff --git a/tests/unit/Storage/StorageClientTest.php b/tests/unit/Storage/StorageClientTest.php index b5f5cca55b72..049da19f61d9 100644 --- a/tests/unit/Storage/StorageClientTest.php +++ b/tests/unit/Storage/StorageClientTest.php @@ -38,7 +38,7 @@ class StorageClientTest extends TestCase public function setUp() { $this->connection = $this->prophesize(Rest::class); - $this->client = \Google\Cloud\Core\Testing\stub(StorageClient::class, [['projectId' => self::PROJECT]]); + $this->client = \Google\Cloud\Core\Testing\Functions::stub(StorageClient::class, [['projectId' => self::PROJECT]]); } public function testGetBucket() From 6d52f272a25b09e95a5268f75ccdf29bc711c075 Mon Sep 17 00:00:00 2001 From: Michael Bausor Date: Wed, 27 Dec 2017 17:09:36 -0800 Subject: [PATCH 12/36] Fix locking and fixtures --- composer.json | 3 - src/Core/Testing/Lock/Functions.php | 40 +--------- src/Core/Testing/Lock/MockGlobals.php | 80 +++++++++++++++++++ src/Core/Testing/Lock/MockValues.php | 41 ---------- tests/unit/Core/ClientTraitTest.php | 8 +- tests/unit/Core/Lock/FlockLockTest.php | 11 +-- tests/unit/Core/Lock/SemaphoreLockTest.php | 11 +-- tests/unit/Core/RequestBuilderTest.php | 6 +- .../Spanner/Session/CacheSessionPoolTest.php | 5 +- .../fixtures/schema/composer.json.schema | 0 .../fixtures/schema/manifest.json.schema | 0 .../fixtures/schema/toc.json.schema | 0 12 files changed, 103 insertions(+), 102 deletions(-) create mode 100644 src/Core/Testing/Lock/MockGlobals.php delete mode 100644 src/Core/Testing/Lock/MockValues.php rename tests/unit/{Core => }/fixtures/schema/composer.json.schema (100%) rename tests/unit/{Core => }/fixtures/schema/manifest.json.schema (100%) rename tests/unit/{Core => }/fixtures/schema/toc.json.schema (100%) diff --git a/composer.json b/composer.json index d48ec384e4d9..940870c96cfa 100644 --- a/composer.json +++ b/composer.json @@ -103,9 +103,6 @@ "Google\\Cloud\\Tests\\System\\": "tests/system", "Google\\Cloud\\Tests\\Unit\\": "tests/unit" }, - "files": [ - "src/Core/Testing/Functions.php" - ], "classmap": [ "tests/conformance-fixtures" ] diff --git a/src/Core/Testing/Lock/Functions.php b/src/Core/Testing/Lock/Functions.php index 28102cddc91c..2268be734032 100644 --- a/src/Core/Testing/Lock/Functions.php +++ b/src/Core/Testing/Lock/Functions.php @@ -16,44 +16,6 @@ * limitations under the License. */ -namespace Google\Cloud\Core\Testing\Lock; +use Google\Cloud\Core\Testing\Lock\MockValues; -class Functions -{ - public static function flock($handle, $type) - { - return MockValues::$flockReturnValue; - } - public static function fopen($file, $mode) - { - $val = MockValues::$fopenReturnValue; - - if (is_callable($val)) { - return $val($file, $mode); - } - - return $val; - } - - public static function sem_acquire($id) - { - return MockValues::$sem_acquireReturnValue; - } - - public static function sem_release($id) - { - return MockValues::$sem_releaseReturnValue; - } - - public static function sem_get($key) - { - $val = MockValues::$sem_getReturnValue; - - if (is_callable($val)) { - return $val($key); - } - - return $val; - } -} diff --git a/src/Core/Testing/Lock/MockGlobals.php b/src/Core/Testing/Lock/MockGlobals.php new file mode 100644 index 000000000000..071ef69a3af4 --- /dev/null +++ b/src/Core/Testing/Lock/MockGlobals.php @@ -0,0 +1,80 @@ +impl->call('configureAuthentication', [[]]); @@ -134,7 +134,7 @@ public function testConfigureAuthentication() public function testConfigureAuthenticationWithKeyFile() { - $keyFilePath = __DIR__ . '/../fixtures/json-key-fixture.json'; + $keyFilePath = Fixtures::JSON_KEY_FIXTURE(); $keyFile = json_decode(file_get_contents($keyFilePath), true); $keyFile['project_id'] = 'test'; @@ -148,7 +148,7 @@ public function testConfigureAuthenticationWithKeyFile() public function testConfigureAuthenticationWithKeyFilePath() { - $keyFilePath = __DIR__ . '/../fixtures/json-key-fixture.json'; + $keyFilePath = Fixtures::JSON_KEY_FIXTURE(); $keyFile = json_decode(file_get_contents($keyFilePath), true); $conf = $this->impl->call('configureAuthentication', [[ @@ -188,7 +188,7 @@ public function testConfigureAuthenticationWithKeyFileThatCantBeDecoded() */ public function testDetectProjectIdWithNoProjectIdAvailable() { - $keyFilePath = __DIR__ . '/../fixtures/json-key-fixture.json'; + $keyFilePath = Fixtures::JSON_KEY_FIXTURE(); $keyFile = json_decode(file_get_contents($keyFilePath), true); unset($keyFile['project_id']); diff --git a/tests/unit/Core/Lock/FlockLockTest.php b/tests/unit/Core/Lock/FlockLockTest.php index d5f08bf46728..f1477662d17d 100644 --- a/tests/unit/Core/Lock/FlockLockTest.php +++ b/tests/unit/Core/Lock/FlockLockTest.php @@ -17,8 +17,9 @@ namespace Google\Cloud\Tests\Unit\Core\Lock; +require_once __DIR__ . '/../../../../src/Core/Testing/Lock/MockGlobals.php'; + use Google\Cloud\Core\Lock\FlockLock; -use Google\Cloud\Core\Testing\Lock\MockValues; use PHPUnit\Framework\TestCase; /** @@ -33,7 +34,7 @@ class FlockLockTest extends TestCase public function setUp() { - MockValues::initialize(); + \Google\Cloud\Core\Lock\MockValues::initialize(); $this->setLock(new FlockLock(self::LOCK_NAME)); } @@ -51,7 +52,7 @@ public function testThrowsExceptionWithInvalidFileName() */ public function testThrowsExceptionWhenFlockFailsOnAcquire() { - MockValues::$flockReturnValue = false; + \Google\Cloud\Core\Lock\MockValues::$flockReturnValue = false; $this->lock->acquire(); } @@ -62,7 +63,7 @@ public function testThrowsExceptionWhenFlockFailsOnAcquire() public function testThrowsExceptionWhenFlockFailsOnRelease() { $this->lock->acquire(); - MockValues::$flockReturnValue = false; + \Google\Cloud\Core\Lock\MockValues::$flockReturnValue = false; $this->lock->release(); } @@ -72,7 +73,7 @@ public function testThrowsExceptionWhenFlockFailsOnRelease() */ public function testThrowsExceptionWhenFopenFails() { - MockValues::$fopenReturnValue = false; + \Google\Cloud\Core\Lock\MockValues::$fopenReturnValue = false; $this->lock->acquire(); } } diff --git a/tests/unit/Core/Lock/SemaphoreLockTest.php b/tests/unit/Core/Lock/SemaphoreLockTest.php index 3cfd0612a3ef..ef16689fb321 100644 --- a/tests/unit/Core/Lock/SemaphoreLockTest.php +++ b/tests/unit/Core/Lock/SemaphoreLockTest.php @@ -17,7 +17,8 @@ namespace Google\Cloud\Tests\Unit\Core\Lock; -use Google\Cloud\Core\Testing\Lock\MockValues; +require_once __DIR__ . '/../../../../src/Core/Testing/Lock/MockGlobals.php'; + use Google\Cloud\Core\Lock\SemaphoreLock; use Google\Cloud\Core\SysvTrait; use PHPUnit\Framework\TestCase; @@ -42,7 +43,7 @@ public function setUp() } $this->setLock(new SemaphoreLock(1)); - MockValues::initialize(); + \Google\Cloud\Core\Lock\MockValues::initialize(); } /** @@ -59,7 +60,7 @@ public function testThrowsExceptionWithInvalidKey() */ public function testThrowsExceptionWhenSemAcquireFailsOnAcquire() { - MockValues::$sem_acquireReturnValue = false; + \Google\Cloud\Core\Lock\MockValues::$sem_acquireReturnValue = false; $this->lock->acquire(); } @@ -70,7 +71,7 @@ public function testThrowsExceptionWhenSemAcquireFailsOnAcquire() public function testThrowsExceptionWhenSemReleaseFailsOnRelease() { $this->lock->acquire(); - MockValues::$sem_releaseReturnValue = false; + \Google\Cloud\Core\Lock\MockValues::$sem_releaseReturnValue = false; $this->lock->release(); } @@ -80,7 +81,7 @@ public function testThrowsExceptionWhenSemReleaseFailsOnRelease() */ public function testThrowsExceptionWhenSemGetFails() { - MockValues::$sem_getReturnValue = false; + \Google\Cloud\Core\Lock\MockValues::$sem_getReturnValue = false; $this->lock->acquire(); } } diff --git a/tests/unit/Core/RequestBuilderTest.php b/tests/unit/Core/RequestBuilderTest.php index 75db07c2afa0..b029b4629508 100644 --- a/tests/unit/Core/RequestBuilderTest.php +++ b/tests/unit/Core/RequestBuilderTest.php @@ -29,7 +29,7 @@ class RequestBuilderTest extends TestCase public function setUp() { $this->builder = new RequestBuilder( - __DIR__ . '/../fixtures/service-fixture.json', + Fixtures::SERVICE_FIXTURE(), 'http://www.example.com/' ); } @@ -54,7 +54,7 @@ public function testBuildsRequest() public function testBuildsNestedRequest() { $builder = new RequestBuilder( - __DIR__ . '/../fixtures/service-fixture.json', + Fixtures::SERVICE_FIXTURE(), 'http://www.example.com/', ['resources', 'projects', 'otherThing'] ); @@ -76,7 +76,7 @@ public function testBuildsNestedRequest() public function testBuildsNestedRequestWithStringSplitting() { $builder = new RequestBuilder( - __DIR__ . '/../fixtures/service-fixture.json', + Fixtures::SERVICE_FIXTURE(), 'http://www.example.com/', ['resources', 'projects', 'otherThing'] ); diff --git a/tests/unit/Spanner/Session/CacheSessionPoolTest.php b/tests/unit/Spanner/Session/CacheSessionPoolTest.php index 2364657a44a1..a062c6177b15 100644 --- a/tests/unit/Spanner/Session/CacheSessionPoolTest.php +++ b/tests/unit/Spanner/Session/CacheSessionPoolTest.php @@ -17,8 +17,9 @@ namespace Google\Cloud\Tests\Unit\Spanner\Session; +require_once __DIR__ . '/../../../../src/Core/Testing/Lock/MockGlobals.php'; + use Google\Auth\Cache\MemoryCacheItemPool; -use Google\Cloud\Core\Testing\Lock\MockValues; use Google\Cloud\Spanner\Connection\Grpc; use Google\Cloud\Spanner\Database; use Google\Cloud\Spanner\Session\CacheSessionPool; @@ -50,7 +51,7 @@ public function setUp() $this->checkAndSkipGrpcTests(); putenv('GOOGLE_CLOUD_SYSV_ID=U'); $this->time = time(); - MockValues::initialize(); + \Google\Cloud\Core\Lock\MockValues::initialize(); } /** diff --git a/tests/unit/Core/fixtures/schema/composer.json.schema b/tests/unit/fixtures/schema/composer.json.schema similarity index 100% rename from tests/unit/Core/fixtures/schema/composer.json.schema rename to tests/unit/fixtures/schema/composer.json.schema diff --git a/tests/unit/Core/fixtures/schema/manifest.json.schema b/tests/unit/fixtures/schema/manifest.json.schema similarity index 100% rename from tests/unit/Core/fixtures/schema/manifest.json.schema rename to tests/unit/fixtures/schema/manifest.json.schema diff --git a/tests/unit/Core/fixtures/schema/toc.json.schema b/tests/unit/fixtures/schema/toc.json.schema similarity index 100% rename from tests/unit/Core/fixtures/schema/toc.json.schema rename to tests/unit/fixtures/schema/toc.json.schema From a1f8aec99da047bd62fa86e94f298447126cf059 Mon Sep 17 00:00:00 2001 From: Michael Bausor Date: Thu, 28 Dec 2017 10:46:52 -0800 Subject: [PATCH 13/36] Fixes --- src/Core/Testing/Lock/Functions.php | 21 --------------------- src/Core/Testing/Lock/MockGlobals.php | 6 ++---- 2 files changed, 2 insertions(+), 25 deletions(-) delete mode 100644 src/Core/Testing/Lock/Functions.php diff --git a/src/Core/Testing/Lock/Functions.php b/src/Core/Testing/Lock/Functions.php deleted file mode 100644 index 2268be734032..000000000000 --- a/src/Core/Testing/Lock/Functions.php +++ /dev/null @@ -1,21 +0,0 @@ - Date: Fri, 5 Jan 2018 10:52:56 -0800 Subject: [PATCH 14/36] Restructure MockGlobals, update fixtures --- src/Core/Testing/Lock/MockGlobals.php | 21 +-------- src/Core/Testing/Lock/MockValues.php | 43 +++++++++++++++++++ tests/unit/Core/Lock/FlockLockTest.php | 11 +++-- tests/unit/Core/Lock/SemaphoreLockTest.php | 11 +++-- tests/unit/Core/ServiceBuilderTest.php | 5 ++- .../Spanner/Session/CacheSessionPoolTest.php | 5 +-- 6 files changed, 59 insertions(+), 37 deletions(-) create mode 100644 src/Core/Testing/Lock/MockValues.php diff --git a/src/Core/Testing/Lock/MockGlobals.php b/src/Core/Testing/Lock/MockGlobals.php index 28666f7b7861..89bde6b71478 100644 --- a/src/Core/Testing/Lock/MockGlobals.php +++ b/src/Core/Testing/Lock/MockGlobals.php @@ -17,27 +17,8 @@ */ namespace Google\Cloud\Core\Lock { - class MockValues - { - public static $flockReturnValue; - public static $fopenReturnValue; - public static $sem_acquireReturnValue; - public static $sem_releaseReturnValue; - public static $sem_getReturnValue; - public static function initialize() - { - self::$flockReturnValue = true; - self::$fopenReturnValue = function($file, $mode) { - return \fopen($file, $mode); - }; - self::$sem_acquireReturnValue = true; - self::$sem_releaseReturnValue = true; - self::$sem_getReturnValue = function($key) { - return \sem_get($key); - }; - } - } + use Google\Cloud\Core\Testing\Lock\MockValues; function flock($handle, $type) { diff --git a/src/Core/Testing/Lock/MockValues.php b/src/Core/Testing/Lock/MockValues.php new file mode 100644 index 000000000000..cec6216147ab --- /dev/null +++ b/src/Core/Testing/Lock/MockValues.php @@ -0,0 +1,43 @@ +setLock(new FlockLock(self::LOCK_NAME)); } @@ -52,7 +51,7 @@ public function testThrowsExceptionWithInvalidFileName() */ public function testThrowsExceptionWhenFlockFailsOnAcquire() { - \Google\Cloud\Core\Lock\MockValues::$flockReturnValue = false; + MockValues::$flockReturnValue = false; $this->lock->acquire(); } @@ -63,7 +62,7 @@ public function testThrowsExceptionWhenFlockFailsOnAcquire() public function testThrowsExceptionWhenFlockFailsOnRelease() { $this->lock->acquire(); - \Google\Cloud\Core\Lock\MockValues::$flockReturnValue = false; + MockValues::$flockReturnValue = false; $this->lock->release(); } @@ -73,7 +72,7 @@ public function testThrowsExceptionWhenFlockFailsOnRelease() */ public function testThrowsExceptionWhenFopenFails() { - \Google\Cloud\Core\Lock\MockValues::$fopenReturnValue = false; + MockValues::$fopenReturnValue = false; $this->lock->acquire(); } } diff --git a/tests/unit/Core/Lock/SemaphoreLockTest.php b/tests/unit/Core/Lock/SemaphoreLockTest.php index ef16689fb321..4ec59e721346 100644 --- a/tests/unit/Core/Lock/SemaphoreLockTest.php +++ b/tests/unit/Core/Lock/SemaphoreLockTest.php @@ -17,10 +17,9 @@ namespace Google\Cloud\Tests\Unit\Core\Lock; -require_once __DIR__ . '/../../../../src/Core/Testing/Lock/MockGlobals.php'; - use Google\Cloud\Core\Lock\SemaphoreLock; use Google\Cloud\Core\SysvTrait; +use Google\Cloud\Core\Testing\Lock\MockValues; use PHPUnit\Framework\TestCase; /** @@ -43,7 +42,7 @@ public function setUp() } $this->setLock(new SemaphoreLock(1)); - \Google\Cloud\Core\Lock\MockValues::initialize(); + MockValues::initialize(); } /** @@ -60,7 +59,7 @@ public function testThrowsExceptionWithInvalidKey() */ public function testThrowsExceptionWhenSemAcquireFailsOnAcquire() { - \Google\Cloud\Core\Lock\MockValues::$sem_acquireReturnValue = false; + MockValues::$sem_acquireReturnValue = false; $this->lock->acquire(); } @@ -71,7 +70,7 @@ public function testThrowsExceptionWhenSemAcquireFailsOnAcquire() public function testThrowsExceptionWhenSemReleaseFailsOnRelease() { $this->lock->acquire(); - \Google\Cloud\Core\Lock\MockValues::$sem_releaseReturnValue = false; + MockValues::$sem_releaseReturnValue = false; $this->lock->release(); } @@ -81,7 +80,7 @@ public function testThrowsExceptionWhenSemReleaseFailsOnRelease() */ public function testThrowsExceptionWhenSemGetFails() { - \Google\Cloud\Core\Lock\MockValues::$sem_getReturnValue = false; + MockValues::$sem_getReturnValue = false; $this->lock->acquire(); } } diff --git a/tests/unit/Core/ServiceBuilderTest.php b/tests/unit/Core/ServiceBuilderTest.php index 3cf789c1c92c..565238dc05ea 100644 --- a/tests/unit/Core/ServiceBuilderTest.php +++ b/tests/unit/Core/ServiceBuilderTest.php @@ -27,6 +27,7 @@ use Google\Cloud\Spanner\SpannerClient; use Google\Cloud\Speech\SpeechClient; use Google\Cloud\Storage\StorageClient; +use Google\Cloud\Tests\Unit\Core\Fixtures; use Google\Cloud\Translate\TranslateClient; use Google\Cloud\Vision\VisionClient; use GuzzleHttp\Psr7\Response; @@ -86,7 +87,7 @@ public function testKeyfilePathAuthPassthrough( call_user_func($beforeCallable); } - $kfPath = __DIR__ .'/../fixtures/json-key-fixture.json'; + $kfPath = Fixtures::JSON_KEY_FIXTURE(); $kf = json_decode(file_get_contents($kfPath), true); $adc = getenv('GOOGLE_APPLICATION_CREDENTIALS'); @@ -121,7 +122,7 @@ public function testKeyfileAuthPassthrough( call_user_func($beforeCallable); } - $kfPath = __DIR__ .'/../fixtures/json-key-fixture.json'; + $kfPath = Fixtures::JSON_KEY_FIXTURE(); $kf = json_decode(file_get_contents($kfPath), true); $adc = getenv('GOOGLE_APPLICATION_CREDENTIALS'); diff --git a/tests/unit/Spanner/Session/CacheSessionPoolTest.php b/tests/unit/Spanner/Session/CacheSessionPoolTest.php index a062c6177b15..2364657a44a1 100644 --- a/tests/unit/Spanner/Session/CacheSessionPoolTest.php +++ b/tests/unit/Spanner/Session/CacheSessionPoolTest.php @@ -17,9 +17,8 @@ namespace Google\Cloud\Tests\Unit\Spanner\Session; -require_once __DIR__ . '/../../../../src/Core/Testing/Lock/MockGlobals.php'; - use Google\Auth\Cache\MemoryCacheItemPool; +use Google\Cloud\Core\Testing\Lock\MockValues; use Google\Cloud\Spanner\Connection\Grpc; use Google\Cloud\Spanner\Database; use Google\Cloud\Spanner\Session\CacheSessionPool; @@ -51,7 +50,7 @@ public function setUp() $this->checkAndSkipGrpcTests(); putenv('GOOGLE_CLOUD_SYSV_ID=U'); $this->time = time(); - \Google\Cloud\Core\Lock\MockValues::initialize(); + MockValues::initialize(); } /** From 84b2b229d815191f25c601b052e039e8cd44f622 Mon Sep 17 00:00:00 2001 From: Michael Bausor Date: Fri, 5 Jan 2018 12:47:44 -0800 Subject: [PATCH 15/36] Fix phpcs errors --- src/Core/Testing/Lock/MockValues.php | 4 ++-- src/Core/Testing/System/DeletionQueue.php | 5 +++-- src/Core/Testing/System/SystemTestCase.php | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/Core/Testing/Lock/MockValues.php b/src/Core/Testing/Lock/MockValues.php index cec6216147ab..a1a7d2c234bb 100644 --- a/src/Core/Testing/Lock/MockValues.php +++ b/src/Core/Testing/Lock/MockValues.php @@ -31,12 +31,12 @@ class MockValues public static function initialize() { self::$flockReturnValue = true; - self::$fopenReturnValue = function($file, $mode) { + self::$fopenReturnValue = function ($file, $mode) { return \fopen($file, $mode); }; self::$sem_acquireReturnValue = true; self::$sem_releaseReturnValue = true; - self::$sem_getReturnValue = function($key) { + self::$sem_getReturnValue = function ($key) { return \sem_get($key); }; } diff --git a/src/Core/Testing/System/DeletionQueue.php b/src/Core/Testing/System/DeletionQueue.php index 5dcb74ec9995..2cd1e5359ba7 100644 --- a/src/Core/Testing/System/DeletionQueue.php +++ b/src/Core/Testing/System/DeletionQueue.php @@ -62,7 +62,7 @@ public function add($toDelete) } if (!is_callable($toDelete)) { - $toDelete = function() use ($toDelete) { + $toDelete = function () use ($toDelete) { $toDelete->delete(); }; } @@ -87,7 +87,8 @@ public function process(callable $action = null) $backoff->execute(function () use ($item) { try { call_user_func($item); - } catch (NotFoundException $e) {} + } catch (NotFoundException $e) { + } }); } } diff --git a/src/Core/Testing/System/SystemTestCase.php b/src/Core/Testing/System/SystemTestCase.php index 4893a9d1f399..5ef742a75b7e 100644 --- a/src/Core/Testing/System/SystemTestCase.php +++ b/src/Core/Testing/System/SystemTestCase.php @@ -45,7 +45,7 @@ public static function processQueue() */ public static function randId() { - return rand(1,9999999); + return rand(1, 9999999); } /** From d929d42bca1cbcf02c7bc7090095bfd748c497f4 Mon Sep 17 00:00:00 2001 From: Michael Bausor Date: Fri, 5 Jan 2018 13:04:59 -0800 Subject: [PATCH 16/36] Fix snippet tests --- tests/snippets/Debugger/AgentTest.php | 2 +- tests/snippets/Debugger/AliasContextTest.php | 2 +- tests/snippets/Debugger/BreakpointTest.php | 2 +- tests/snippets/Debugger/CloudRepoSourceContextTest.php | 2 +- tests/snippets/Debugger/CloudWorkspaceIdTest.php | 2 +- tests/snippets/Debugger/CloudWorkspaceSourceContextTest.php | 2 +- tests/snippets/Debugger/DaemonTest.php | 2 +- tests/snippets/Debugger/DebuggeeTest.php | 2 +- tests/snippets/Debugger/DebuggerClientTest.php | 4 ++-- tests/snippets/Debugger/ExtendedSourceContextTest.php | 2 +- tests/snippets/Debugger/FormatMessageTest.php | 2 +- tests/snippets/Debugger/GerritSourceContextTest.php | 2 +- tests/snippets/Debugger/GitSourceContextTest.php | 2 +- tests/snippets/Debugger/ProjectRepoIdTest.php | 2 +- tests/snippets/Debugger/RepoIdTest.php | 2 +- tests/snippets/Debugger/SourceLocationTest.php | 2 +- tests/snippets/Debugger/StackFrameTest.php | 2 +- tests/snippets/Debugger/StatusMessageTest.php | 2 +- tests/snippets/Debugger/VariableTableTest.php | 2 +- tests/snippets/Debugger/VariableTest.php | 2 +- 20 files changed, 21 insertions(+), 21 deletions(-) diff --git a/tests/snippets/Debugger/AgentTest.php b/tests/snippets/Debugger/AgentTest.php index 5c0b1aeb2d70..aa6a71df1927 100644 --- a/tests/snippets/Debugger/AgentTest.php +++ b/tests/snippets/Debugger/AgentTest.php @@ -17,7 +17,7 @@ namespace Google\Cloud\Tests\Snippets\Debugger; -use Google\Cloud\Dev\Snippet\SnippetTestCase; +use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Debugger\Agent; use Google\Cloud\Debugger\BreakpointStorage\BreakpointStorageInterface; use Prophecy\Argument; diff --git a/tests/snippets/Debugger/AliasContextTest.php b/tests/snippets/Debugger/AliasContextTest.php index 54e82d3f7108..8e99f4919005 100644 --- a/tests/snippets/Debugger/AliasContextTest.php +++ b/tests/snippets/Debugger/AliasContextTest.php @@ -17,7 +17,7 @@ namespace Google\Cloud\Tests\Snippets\Debugger; -use Google\Cloud\Dev\Snippet\SnippetTestCase; +use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Debugger\AliasContext; /** diff --git a/tests/snippets/Debugger/BreakpointTest.php b/tests/snippets/Debugger/BreakpointTest.php index 7a02808c429e..b35ad681dcae 100644 --- a/tests/snippets/Debugger/BreakpointTest.php +++ b/tests/snippets/Debugger/BreakpointTest.php @@ -17,7 +17,7 @@ namespace Google\Cloud\Tests\Snippets\Debugger; -use Google\Cloud\Dev\Snippet\SnippetTestCase; +use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Debugger\Breakpoint; use Google\Cloud\Debugger\SourceLocation; use Google\Cloud\Debugger\StackFrame; diff --git a/tests/snippets/Debugger/CloudRepoSourceContextTest.php b/tests/snippets/Debugger/CloudRepoSourceContextTest.php index 247fc7cd5a39..f03f22efa639 100644 --- a/tests/snippets/Debugger/CloudRepoSourceContextTest.php +++ b/tests/snippets/Debugger/CloudRepoSourceContextTest.php @@ -17,7 +17,7 @@ namespace Google\Cloud\Tests\Snippets\Debugger; -use Google\Cloud\Dev\Snippet\SnippetTestCase; +use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Debugger\CloudRepoSourceContext; /** diff --git a/tests/snippets/Debugger/CloudWorkspaceIdTest.php b/tests/snippets/Debugger/CloudWorkspaceIdTest.php index 424650e8c6a3..482d5c843e4c 100644 --- a/tests/snippets/Debugger/CloudWorkspaceIdTest.php +++ b/tests/snippets/Debugger/CloudWorkspaceIdTest.php @@ -17,7 +17,7 @@ namespace Google\Cloud\Tests\Snippets\Debugger; -use Google\Cloud\Dev\Snippet\SnippetTestCase; +use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Debugger\CloudWorkspaceId; /** diff --git a/tests/snippets/Debugger/CloudWorkspaceSourceContextTest.php b/tests/snippets/Debugger/CloudWorkspaceSourceContextTest.php index 48f46c5a01da..05a68098da0f 100644 --- a/tests/snippets/Debugger/CloudWorkspaceSourceContextTest.php +++ b/tests/snippets/Debugger/CloudWorkspaceSourceContextTest.php @@ -17,7 +17,7 @@ namespace Google\Cloud\Tests\Snippets\Debugger; -use Google\Cloud\Dev\Snippet\SnippetTestCase; +use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Debugger\CloudWorkspaceSourceContext; /** diff --git a/tests/snippets/Debugger/DaemonTest.php b/tests/snippets/Debugger/DaemonTest.php index b2a90fdcd2f4..8835184019a1 100644 --- a/tests/snippets/Debugger/DaemonTest.php +++ b/tests/snippets/Debugger/DaemonTest.php @@ -17,7 +17,7 @@ namespace Google\Cloud\Tests\Snippets\Debugger; -use Google\Cloud\Dev\Snippet\SnippetTestCase; +use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Debugger\Daemon; use Google\Cloud\Debugger\Debuggee; use Google\Cloud\Debugger\DebuggerClient; diff --git a/tests/snippets/Debugger/DebuggeeTest.php b/tests/snippets/Debugger/DebuggeeTest.php index ef5ac2346aac..7be1e25f53b6 100644 --- a/tests/snippets/Debugger/DebuggeeTest.php +++ b/tests/snippets/Debugger/DebuggeeTest.php @@ -17,7 +17,7 @@ namespace Google\Cloud\Tests\Snippets\Debugger; -use Google\Cloud\Dev\Snippet\SnippetTestCase; +use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Debugger\Breakpoint; use Google\Cloud\Debugger\Debuggee; use Google\Cloud\Debugger\Connection\ConnectionInterface; diff --git a/tests/snippets/Debugger/DebuggerClientTest.php b/tests/snippets/Debugger/DebuggerClientTest.php index 667c356362be..f73dc63ac91c 100644 --- a/tests/snippets/Debugger/DebuggerClientTest.php +++ b/tests/snippets/Debugger/DebuggerClientTest.php @@ -17,7 +17,7 @@ namespace Google\Cloud\Debugger\Snippets\Trace; -use Google\Cloud\Dev\Snippet\SnippetTestCase; +use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Debugger\Connection\ConnectionInterface; use Google\Cloud\Debugger\DebuggerClient; use Google\Cloud\Debugger\Debuggee; @@ -34,7 +34,7 @@ class DebuggerClientTest extends SnippetTestCase public function setUp() { $this->connection = $this->prophesize(ConnectionInterface::class); - $this->client = \Google\Cloud\Dev\stub(DebuggerClient::class); + $this->client = \Google\Cloud\Core\Testing\Functions::stub(DebuggerClient::class); $this->client->___setProperty('connection', $this->connection->reveal()); } diff --git a/tests/snippets/Debugger/ExtendedSourceContextTest.php b/tests/snippets/Debugger/ExtendedSourceContextTest.php index 18a4a4c7a8ce..db48558ea6af 100644 --- a/tests/snippets/Debugger/ExtendedSourceContextTest.php +++ b/tests/snippets/Debugger/ExtendedSourceContextTest.php @@ -17,7 +17,7 @@ namespace Google\Cloud\Tests\Snippets\Debugger; -use Google\Cloud\Dev\Snippet\SnippetTestCase; +use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Debugger\ExtendedSourceContext; use Google\Cloud\Debugger\SourceContext; diff --git a/tests/snippets/Debugger/FormatMessageTest.php b/tests/snippets/Debugger/FormatMessageTest.php index bc4949997bd9..f06a5d570f93 100644 --- a/tests/snippets/Debugger/FormatMessageTest.php +++ b/tests/snippets/Debugger/FormatMessageTest.php @@ -17,7 +17,7 @@ namespace Google\Cloud\Tests\Snippets\Debugger; -use Google\Cloud\Dev\Snippet\SnippetTestCase; +use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Debugger\FormatMessage; /** diff --git a/tests/snippets/Debugger/GerritSourceContextTest.php b/tests/snippets/Debugger/GerritSourceContextTest.php index 7e3b4050f192..8d3a6e97b6df 100644 --- a/tests/snippets/Debugger/GerritSourceContextTest.php +++ b/tests/snippets/Debugger/GerritSourceContextTest.php @@ -17,7 +17,7 @@ namespace Google\Cloud\Tests\Snippets\Debugger; -use Google\Cloud\Dev\Snippet\SnippetTestCase; +use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Debugger\GerritSourceContext; /** diff --git a/tests/snippets/Debugger/GitSourceContextTest.php b/tests/snippets/Debugger/GitSourceContextTest.php index 0f387e7e58ab..378acd32b256 100644 --- a/tests/snippets/Debugger/GitSourceContextTest.php +++ b/tests/snippets/Debugger/GitSourceContextTest.php @@ -17,7 +17,7 @@ namespace Google\Cloud\Tests\Snippets\Debugger; -use Google\Cloud\Dev\Snippet\SnippetTestCase; +use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Debugger\GitSourceContext; /** diff --git a/tests/snippets/Debugger/ProjectRepoIdTest.php b/tests/snippets/Debugger/ProjectRepoIdTest.php index 03e2c201c1c4..d5e47da17db8 100644 --- a/tests/snippets/Debugger/ProjectRepoIdTest.php +++ b/tests/snippets/Debugger/ProjectRepoIdTest.php @@ -17,7 +17,7 @@ namespace Google\Cloud\Tests\Snippets\Debugger; -use Google\Cloud\Dev\Snippet\SnippetTestCase; +use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Debugger\ProjectRepoId; /** diff --git a/tests/snippets/Debugger/RepoIdTest.php b/tests/snippets/Debugger/RepoIdTest.php index 654778e1bb7b..bdaa87f4a3c9 100644 --- a/tests/snippets/Debugger/RepoIdTest.php +++ b/tests/snippets/Debugger/RepoIdTest.php @@ -17,7 +17,7 @@ namespace Google\Cloud\Tests\Snippets\Debugger; -use Google\Cloud\Dev\Snippet\SnippetTestCase; +use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Debugger\RepoId; /** diff --git a/tests/snippets/Debugger/SourceLocationTest.php b/tests/snippets/Debugger/SourceLocationTest.php index 6155892d012e..a43a0ab1d21e 100644 --- a/tests/snippets/Debugger/SourceLocationTest.php +++ b/tests/snippets/Debugger/SourceLocationTest.php @@ -17,7 +17,7 @@ namespace Google\Cloud\Tests\Snippets\Debugger; -use Google\Cloud\Dev\Snippet\SnippetTestCase; +use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Debugger\SourceLocation; /** diff --git a/tests/snippets/Debugger/StackFrameTest.php b/tests/snippets/Debugger/StackFrameTest.php index f4ce068cd2dd..b0f27396c176 100644 --- a/tests/snippets/Debugger/StackFrameTest.php +++ b/tests/snippets/Debugger/StackFrameTest.php @@ -17,7 +17,7 @@ namespace Google\Cloud\Tests\Snippets\Debugger; -use Google\Cloud\Dev\Snippet\SnippetTestCase; +use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Debugger\StackFrame; use Google\Cloud\Debugger\Variable; diff --git a/tests/snippets/Debugger/StatusMessageTest.php b/tests/snippets/Debugger/StatusMessageTest.php index eb72cd25049f..570150857c8f 100644 --- a/tests/snippets/Debugger/StatusMessageTest.php +++ b/tests/snippets/Debugger/StatusMessageTest.php @@ -17,7 +17,7 @@ namespace Google\Cloud\Tests\Snippets\Debugger; -use Google\Cloud\Dev\Snippet\SnippetTestCase; +use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Debugger\StatusMessage; /** diff --git a/tests/snippets/Debugger/VariableTableTest.php b/tests/snippets/Debugger/VariableTableTest.php index dc3d30213795..e4726dec903b 100644 --- a/tests/snippets/Debugger/VariableTableTest.php +++ b/tests/snippets/Debugger/VariableTableTest.php @@ -17,7 +17,7 @@ namespace Google\Cloud\Tests\Snippets\Debugger; -use Google\Cloud\Dev\Snippet\SnippetTestCase; +use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Debugger\Variable; use Google\Cloud\Debugger\VariableTable; diff --git a/tests/snippets/Debugger/VariableTest.php b/tests/snippets/Debugger/VariableTest.php index 88579429398b..42e63b43a0c0 100644 --- a/tests/snippets/Debugger/VariableTest.php +++ b/tests/snippets/Debugger/VariableTest.php @@ -17,7 +17,7 @@ namespace Google\Cloud\Tests\Snippets\Debugger; -use Google\Cloud\Dev\Snippet\SnippetTestCase; +use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Debugger\Variable; /** From 668295ad105badd4825b841c8c1f23a55c5eaa7a Mon Sep 17 00:00:00 2001 From: Michael Bausor Date: Fri, 5 Jan 2018 13:29:29 -0800 Subject: [PATCH 17/36] Add comments to support doc building --- src/Core/Testing/ArrayHasSameValuesToken.php | 18 ++++++++++++++++++ src/Core/Testing/Functions.php | 3 +++ src/Core/Testing/GrpcTestTrait.php | 6 ++++++ src/Core/Testing/KeyPairGenerateTrait.php | 3 +++ src/Core/Testing/Lock/MockValues.php | 9 +++++++++ src/Core/Testing/Snippet/SnippetTestCase.php | 3 +++ src/Core/Testing/System/SystemTestCase.php | 9 +++++++++ 7 files changed, 51 insertions(+) diff --git a/src/Core/Testing/ArrayHasSameValuesToken.php b/src/Core/Testing/ArrayHasSameValuesToken.php index 5472aafebf04..aa399116d64a 100644 --- a/src/Core/Testing/ArrayHasSameValuesToken.php +++ b/src/Core/Testing/ArrayHasSameValuesToken.php @@ -5,18 +5,30 @@ use Prophecy\Argument\Token\TokenInterface; use Prophecy\Util\StringUtil; +/** + * ArrayHasSameValuesToken implements TokenInterface and is used for testing + */ class ArrayHasSameValuesToken implements TokenInterface { private $value; private $string; private $util; + /** + * ArrayHasSameValuesToken constructor. + * @param $value + * @param StringUtil|null $util + */ public function __construct($value, StringUtil $util = null) { $this->value = $value; $this->util = $util ?: new StringUtil(); } + /** + * @param $argument + * @return bool|int + */ public function scoreArgument($argument) { return $this->compare($this->value, $argument) ? 11 : false; @@ -30,11 +42,17 @@ private function compare(array $value, array $argument) return $value == $argument; } + /** + * @return bool + */ public function isLast() { return false; } + /** + * @return string + */ public function __toString() { if ($this->string) { diff --git a/src/Core/Testing/Functions.php b/src/Core/Testing/Functions.php index cc1ac49661d2..52bdeb6bdccc 100644 --- a/src/Core/Testing/Functions.php +++ b/src/Core/Testing/Functions.php @@ -18,6 +18,9 @@ namespace Google\Cloud\Core\Testing; +/** + * Class Functions is used to hold static functions required for testing + */ class Functions { /** diff --git a/src/Core/Testing/GrpcTestTrait.php b/src/Core/Testing/GrpcTestTrait.php index fc15c769d25d..e207042af85b 100644 --- a/src/Core/Testing/GrpcTestTrait.php +++ b/src/Core/Testing/GrpcTestTrait.php @@ -22,6 +22,9 @@ */ trait GrpcTestTrait { + /** + * Checks for the grpc extension, and if it is missing, marked the test as skipped + */ public function checkAndSkipGrpcTests() { if (!extension_loaded('grpc')) { @@ -32,6 +35,9 @@ public function checkAndSkipGrpcTests() } } + /** + * @return bool True if grpc tests should be skipped, otherwise false + */ public function shouldSkipGrpcTests() { return !extension_loaded('grpc') || defined('HHVM_VERSION'); diff --git a/src/Core/Testing/KeyPairGenerateTrait.php b/src/Core/Testing/KeyPairGenerateTrait.php index ed25b3ff6f8e..fa233f9ed9c0 100644 --- a/src/Core/Testing/KeyPairGenerateTrait.php +++ b/src/Core/Testing/KeyPairGenerateTrait.php @@ -20,6 +20,9 @@ use Google\Cloud\Storage\EncryptionTrait; use phpseclib\Crypt\RSA; +/** + * Trait KeyPairGenerateTrait implements key pair generation functions used for testing + */ trait KeyPairGenerateTrait { use EncryptionTrait; diff --git a/src/Core/Testing/Lock/MockValues.php b/src/Core/Testing/Lock/MockValues.php index a1a7d2c234bb..98d9f8b52f0c 100644 --- a/src/Core/Testing/Lock/MockValues.php +++ b/src/Core/Testing/Lock/MockValues.php @@ -20,6 +20,12 @@ require_once __DIR__ . '/MockGlobals.php'; +/** + * MockValues holds mock values used for testing the locking implementation. + * + * WARNING: this class requires MockGlobals.php, which replaces some existing functions with test + * implementations. + */ class MockValues { public static $flockReturnValue; @@ -28,6 +34,9 @@ class MockValues public static $sem_releaseReturnValue; public static $sem_getReturnValue; + /** + * Initialize MockValues + */ public static function initialize() { self::$flockReturnValue = true; diff --git a/src/Core/Testing/Snippet/SnippetTestCase.php b/src/Core/Testing/Snippet/SnippetTestCase.php index 0968b2539b0c..7f5b35fff1d9 100644 --- a/src/Core/Testing/Snippet/SnippetTestCase.php +++ b/src/Core/Testing/Snippet/SnippetTestCase.php @@ -30,6 +30,9 @@ class SnippetTestCase extends TestCase private static $coverage; private static $parser; + /** + * Run to set up class before testing + */ public static function setUpBeforeClass() { self::$coverage = Container::$coverage; diff --git a/src/Core/Testing/System/SystemTestCase.php b/src/Core/Testing/System/SystemTestCase.php index 5ef742a75b7e..d7d5b376cf6b 100644 --- a/src/Core/Testing/System/SystemTestCase.php +++ b/src/Core/Testing/System/SystemTestCase.php @@ -24,15 +24,24 @@ use Google\Cloud\Core\Testing\System\DeletionQueue; use PHPUnit\Framework\TestCase; +/** + * SystemTestCase can be extended to implement system tests + */ class SystemTestCase extends TestCase { protected static $deletionQueue; + /** + * Set up the deletion queue + */ public static function setupQueue() { self::$deletionQueue = new DeletionQueue; } + /** + * Process the deletion queue + */ public static function processQueue() { self::$deletionQueue->process(); From 75722a22242eb92c0ad9350691370934d879cece Mon Sep 17 00:00:00 2001 From: Michael Bausor Date: Fri, 5 Jan 2018 14:01:23 -0800 Subject: [PATCH 18/36] Exclude MockValues from side effects phpcs rule --- phpcs-ruleset.xml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/phpcs-ruleset.xml b/phpcs-ruleset.xml index d08453666091..1f7d13c8f1a4 100644 --- a/phpcs-ruleset.xml +++ b/phpcs-ruleset.xml @@ -7,5 +7,8 @@ src/Storage/StreamWrapper.php + + src/Core/Testing/Lock/MockValues.php + src From 7134422d74cc07a8fd9bca9b484d75c025894b14 Mon Sep 17 00:00:00 2001 From: Michael Bausor Date: Tue, 9 Jan 2018 16:14:49 -0800 Subject: [PATCH 19/36] Update StubTrait --- src/Core/Testing/Functions.php | 4 ++-- {dev/src => src/Core/Testing}/StubTrait.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) rename {dev/src => src/Core/Testing}/StubTrait.php (98%) diff --git a/src/Core/Testing/Functions.php b/src/Core/Testing/Functions.php index 52bdeb6bdccc..26e5b8c184ab 100644 --- a/src/Core/Testing/Functions.php +++ b/src/Core/Testing/Functions.php @@ -37,7 +37,7 @@ public static function stub($extends, array $args = [], array $props = []) $props = ['connection']; } - $tpl = 'class %s extends %s {private $___props = \'%s\'; use \Google\Cloud\Dev\StubTrait; }'; + $tpl = 'class %s extends %s {private $___props = \'%s\'; use \Google\Cloud\Core\Testing\StubTrait; }'; $name = 'Stub' . sha1($extends); @@ -64,7 +64,7 @@ public static function impl($trait, array $props = []) $tpl = 'class %s { use %s; - use \Google\Cloud\Dev\StubTrait; + use \Google\Cloud\Core\Testing\StubTrait; private $___props = \'%s\'; %s public function call($fn, array $args = []) { return call_user_func_array([$this, $fn], $args); } diff --git a/dev/src/StubTrait.php b/src/Core/Testing/StubTrait.php similarity index 98% rename from dev/src/StubTrait.php rename to src/Core/Testing/StubTrait.php index f8ae75b44b64..fd1fbe09da13 100644 --- a/dev/src/StubTrait.php +++ b/src/Core/Testing/StubTrait.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Dev; +namespace Google\Cloud\Core\Testing; trait StubTrait { From e7b1fc7af4bc1fc42dd993e6026404f44f265e6a Mon Sep 17 00:00:00 2001 From: Michael Bausor Date: Tue, 9 Jan 2018 16:17:46 -0800 Subject: [PATCH 20/36] Remove Storage dependency from StreamableUploaderTest --- tests/unit/Core/Upload/StreamableUploaderTest.php | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/tests/unit/Core/Upload/StreamableUploaderTest.php b/tests/unit/Core/Upload/StreamableUploaderTest.php index 6a767e75af80..f180e4474cff 100644 --- a/tests/unit/Core/Upload/StreamableUploaderTest.php +++ b/tests/unit/Core/Upload/StreamableUploaderTest.php @@ -20,9 +20,7 @@ use Google\Cloud\Core\Exception\GoogleException; use Google\Cloud\Core\RequestWrapper; use Google\Cloud\Core\Upload\StreamableUploader; -use Google\Cloud\Storage\WriteStream; -use GuzzleHttp\Psr7; -use GuzzleHttp\Psr7\Request; +use GuzzleHttp\Psr7\BufferStream; use GuzzleHttp\Psr7\Response; use Prophecy\Argument; use Psr\Http\Message\RequestInterface; @@ -41,7 +39,7 @@ class StreamableUploaderTest extends TestCase public function setUp() { $this->requestWrapper = $this->prophesize(RequestWrapper::class); - $this->stream = new WriteStream(null, ['chunkSize' => 16]); + $this->stream = new BufferStream(16); $this->successBody = '{"canI":"kickIt"}'; } @@ -69,14 +67,14 @@ public function testStreamingWrites() 'http://www.example.com', ['chunkSize' => 16] ); - $this->stream->setUploader($uploader); // write some data smaller than the chunk size $this->stream->write("0123456789"); - $upload->shouldHaveBeenCalledTimes(0); // write some more data that will put us over the chunk size. $this->stream->write("more text"); + + $uploader->upload(16); $upload->shouldHaveBeenCalledTimes(1); // finish the upload @@ -98,7 +96,6 @@ public function testUploadsData() $this->stream, 'http://www.example.com' ); - $this->stream->setUploader($uploader); $this->assertEquals(json_decode($this->successBody, true), $uploader->upload()); } @@ -118,7 +115,6 @@ public function testGetResumeUri() $this->stream, 'http://www.example.com' ); - $this->stream->setUploader($uploader); $this->assertEquals($resumeUri, $uploader->getResumeUri()); } @@ -171,7 +167,6 @@ public function testLastChunkSendsCorrectHeaders() $this->stream, 'http://www.example.com' ); - $this->stream->setUploader($uploader); $this->stream->write('0123456789'); $uploader->upload(); } From 71cb2b0fdf9a3c395be541ada1c131d088c43800 Mon Sep 17 00:00:00 2001 From: Michael Bausor Date: Wed, 10 Jan 2018 09:10:20 -0800 Subject: [PATCH 21/36] Move code out of dev --- .../Core/Testing}/DocBlockStripSpaces.php | 2 +- .../Core/Testing}/Snippet/Container.php | 2 +- .../Testing}/Snippet/Coverage/Coverage.php | 8 +-- .../Testing}/Snippet/Coverage/Scanner.php | 4 +- .../Snippet/Coverage/ScannerInterface.php | 4 +- .../Testing}/Snippet/Parser/InvokeResult.php | 2 +- .../Core/Testing}/Snippet/Parser/Parser.php | 4 +- .../Core/Testing}/Snippet/Parser/Snippet.php | 2 +- src/Core/Testing/Snippet/SnippetTestCase.php | 2 +- .../Testing/Snippet/Parser/ParserTest.php | 68 +++++++++++++++++++ tests/snippets/Firestore/QueryTest.php | 2 +- tests/snippets/Firestore/WriteBatchTest.php | 2 +- tests/snippets/PubSub/PubSubClientTest.php | 1 - tests/snippets/PubSub/SubscriptionTest.php | 1 - tests/snippets/bootstrap.php | 8 +-- 15 files changed, 89 insertions(+), 23 deletions(-) rename {dev/src => src/Core/Testing}/DocBlockStripSpaces.php (96%) rename {dev/src => src/Core/Testing}/Snippet/Container.php (93%) rename {dev/src => src/Core/Testing}/Snippet/Coverage/Coverage.php (89%) rename {dev/src => src/Core/Testing}/Snippet/Coverage/Scanner.php (96%) rename {dev/src => src/Core/Testing}/Snippet/Coverage/ScannerInterface.php (89%) rename {dev/src => src/Core/Testing}/Snippet/Parser/InvokeResult.php (94%) rename {dev/src => src/Core/Testing}/Snippet/Parser/Parser.php (98%) rename {dev/src => src/Core/Testing}/Snippet/Parser/Snippet.php (99%) create mode 100644 tests/snippets/Core/Testing/Snippet/Parser/ParserTest.php diff --git a/dev/src/DocBlockStripSpaces.php b/src/Core/Testing/DocBlockStripSpaces.php similarity index 96% rename from dev/src/DocBlockStripSpaces.php rename to src/Core/Testing/DocBlockStripSpaces.php index 2f6dfba0940e..8f851edd3f28 100644 --- a/dev/src/DocBlockStripSpaces.php +++ b/src/Core/Testing/DocBlockStripSpaces.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Dev; +namespace Google\Cloud\Core\Testing; use phpDocumentor\Reflection\DocBlock; diff --git a/dev/src/Snippet/Container.php b/src/Core/Testing/Snippet/Container.php similarity index 93% rename from dev/src/Snippet/Container.php rename to src/Core/Testing/Snippet/Container.php index 47af53936fbe..d9c3b8cc2f8a 100644 --- a/dev/src/Snippet/Container.php +++ b/src/Core/Testing/Snippet/Container.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Dev\Snippet; +namespace Google\Cloud\Core\Testing\Snippet; class Container { diff --git a/dev/src/Snippet/Coverage/Coverage.php b/src/Core/Testing/Snippet/Coverage/Coverage.php similarity index 89% rename from dev/src/Snippet/Coverage/Coverage.php rename to src/Core/Testing/Snippet/Coverage/Coverage.php index 983f43bc0704..ce5e81a95b40 100644 --- a/dev/src/Snippet/Coverage/Coverage.php +++ b/src/Core/Testing/Snippet/Coverage/Coverage.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Dev\Snippet\Coverage; +namespace Google\Cloud\Core\Testing\Snippet\Coverage; class Coverage { @@ -29,7 +29,7 @@ class Coverage protected $scanner; /** - * @var \Google\Cloud\Dev\Snippet\Parser\Snippet[] + * @var \Google\Cloud\Core\Testing\Snippet\Parser\Snippet[] */ private $snippets = []; @@ -54,7 +54,7 @@ private function getSnippetExcludeList() /** * Creates a list of all snippets which should be covered. * - * @return \Google\Cloud\Dev\Snippet\Parser\Snippet[] + * @return \Google\Cloud\Core\Testing\Snippet\Parser\Snippet[] */ public function buildListToCover() { @@ -80,7 +80,7 @@ public function cover($identifier) /** * Return a list of all snippets not marked a covered. * - * @return \Google\Cloud\Dev\Snippet\Parser\Snippet[] + * @return \Google\Cloud\Core\Testing\Snippet\Parser\Snippet[] */ public function uncovered() { diff --git a/dev/src/Snippet/Coverage/Scanner.php b/src/Core/Testing/Snippet/Coverage/Scanner.php similarity index 96% rename from dev/src/Snippet/Coverage/Scanner.php rename to src/Core/Testing/Snippet/Coverage/Scanner.php index 88688a037dec..f775deafbcfc 100644 --- a/dev/src/Snippet/Coverage/Scanner.php +++ b/src/Core/Testing/Snippet/Coverage/Scanner.php @@ -15,9 +15,9 @@ * limitations under the License. */ -namespace Google\Cloud\Dev\Snippet\Coverage; +namespace Google\Cloud\Core\Testing\Snippet\Coverage; -use Google\Cloud\Dev\Snippet\Parser\Parser; +use Google\Cloud\Core\Testing\Snippet\Parser\Parser; use phpDocumentor\Reflection\FileReflector; /** diff --git a/dev/src/Snippet/Coverage/ScannerInterface.php b/src/Core/Testing/Snippet/Coverage/ScannerInterface.php similarity index 89% rename from dev/src/Snippet/Coverage/ScannerInterface.php rename to src/Core/Testing/Snippet/Coverage/ScannerInterface.php index fddd847423de..916cc2e1eb94 100644 --- a/dev/src/Snippet/Coverage/ScannerInterface.php +++ b/src/Core/Testing/Snippet/Coverage/ScannerInterface.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Dev\Snippet\Coverage; +namespace Google\Cloud\Core\Testing\Snippet\Coverage; interface ScannerInterface { @@ -36,7 +36,7 @@ public function classes(array $files); /** * Get a list of all snippets from the given classes. * - * @return \Google\Cloud\Dev\Snippet\Parser\Snippet[] + * @return \Google\Cloud\Core\Testing\Snippet\Parser\Snippet[] */ public function snippets(array $classes); } diff --git a/dev/src/Snippet/Parser/InvokeResult.php b/src/Core/Testing/Snippet/Parser/InvokeResult.php similarity index 94% rename from dev/src/Snippet/Parser/InvokeResult.php rename to src/Core/Testing/Snippet/Parser/InvokeResult.php index e2a61cf74956..3399cbf02b89 100644 --- a/dev/src/Snippet/Parser/InvokeResult.php +++ b/src/Core/Testing/Snippet/Parser/InvokeResult.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Dev\Snippet\Parser; +namespace Google\Cloud\Core\Testing\Snippet\Parser; class InvokeResult { diff --git a/dev/src/Snippet/Parser/Parser.php b/src/Core/Testing/Snippet/Parser/Parser.php similarity index 98% rename from dev/src/Snippet/Parser/Parser.php rename to src/Core/Testing/Snippet/Parser/Parser.php index 6bcd49673970..ec76e680e46b 100644 --- a/dev/src/Snippet/Parser/Parser.php +++ b/src/Core/Testing/Snippet/Parser/Parser.php @@ -15,10 +15,10 @@ * limitations under the License. */ -namespace Google\Cloud\Dev\Snippet\Parser; +namespace Google\Cloud\Core\Testing\Snippet\Parser; use DomDocument; -use Google\Cloud\Dev\DocBlockStripSpaces; +use Google\Cloud\Core\Testing\DocBlockStripSpaces; use Parsedown; use ReflectionClass; use ReflectionMethod; diff --git a/dev/src/Snippet/Parser/Snippet.php b/src/Core/Testing/Snippet/Parser/Snippet.php similarity index 99% rename from dev/src/Snippet/Parser/Snippet.php rename to src/Core/Testing/Snippet/Parser/Snippet.php index d1ace59affdf..91b4c6fc148b 100644 --- a/dev/src/Snippet/Parser/Snippet.php +++ b/src/Core/Testing/Snippet/Parser/Snippet.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Dev\Snippet\Parser; +namespace Google\Cloud\Core\Testing\Snippet\Parser; /** * Represents a single code snippet diff --git a/src/Core/Testing/Snippet/SnippetTestCase.php b/src/Core/Testing/Snippet/SnippetTestCase.php index 7f5b35fff1d9..29a4532c7cc6 100644 --- a/src/Core/Testing/Snippet/SnippetTestCase.php +++ b/src/Core/Testing/Snippet/SnippetTestCase.php @@ -17,7 +17,7 @@ namespace Google\Cloud\Core\Testing\Snippet; -use Google\Cloud\Dev\Snippet\Container; +use Google\Cloud\Core\Testing\Snippet\Container; use PHPUnit\Framework\TestCase; /** diff --git a/tests/snippets/Core/Testing/Snippet/Parser/ParserTest.php b/tests/snippets/Core/Testing/Snippet/Parser/ParserTest.php new file mode 100644 index 000000000000..a448d6b41cdd --- /dev/null +++ b/tests/snippets/Core/Testing/Snippet/Parser/ParserTest.php @@ -0,0 +1,68 @@ +parser = new Parser(); + } + + public function testClass() + { + $snippet = $this->snippetFromClass(Parser::class); + $res = $snippet->invoke('parser'); + $this->assertInstanceOf(Parser::class, $res->returnVal()); + } + + public function testClassCast() + { + $snippet = $this->snippetFromClass(Timestamp::class, 1); + $snippet->addLocal('timestamp', $this->timestamp); + + $res = $snippet->invoke(); + $this->assertEquals((string)$this->timestamp, $res->output()); + } + + public function testGet() + { + $snippet = $this->snippetFromMethod(Timestamp::class, 'get'); + $snippet->addLocal('timestamp', $this->timestamp); + + $res = $snippet->invoke('dateTime'); + $this->assertEquals($this->dt, $res->returnVal()); + } + + public function testFormatAsString() + { + $snippet = $this->snippetFromMethod(Timestamp::class, 'formatAsString'); + $snippet->addLocal('timestamp', $this->timestamp); + + $res = $snippet->invoke('value'); + $this->assertEquals($this->timestamp->formatAsString(), $res->returnVal()); + } +} diff --git a/tests/snippets/Firestore/QueryTest.php b/tests/snippets/Firestore/QueryTest.php index dcf9f949f668..0c45082cba58 100644 --- a/tests/snippets/Firestore/QueryTest.php +++ b/tests/snippets/Firestore/QueryTest.php @@ -22,7 +22,7 @@ use Google\Cloud\Core\Testing\GrpcTestTrait; use Google\Cloud\Firestore\ValueMapper; use Google\Cloud\Firestore\QuerySnapshot; -use Google\Cloud\Dev\Snippet\Parser\Snippet; +use Google\Cloud\Core\Testing\Snippet\Parser\Snippet; use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Firestore\Connection\ConnectionInterface; use Google\Cloud\Firestore\V1beta1\StructuredQuery_CompositeFilter_Operator; diff --git a/tests/snippets/Firestore/WriteBatchTest.php b/tests/snippets/Firestore/WriteBatchTest.php index c35ef230dc74..bc03290845b4 100644 --- a/tests/snippets/Firestore/WriteBatchTest.php +++ b/tests/snippets/Firestore/WriteBatchTest.php @@ -17,7 +17,7 @@ namespace Google\Cloud\Tests\Snippets\Firestore; -use Google\Cloud\Dev\Snippet\Parser\Snippet; +use Google\Cloud\Core\Testing\Snippet\Parser\Snippet; use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Firestore\Connection\ConnectionInterface; use Google\Cloud\Firestore\ValueMapper; diff --git a/tests/snippets/PubSub/PubSubClientTest.php b/tests/snippets/PubSub/PubSubClientTest.php index 424e073cd079..0ef48631acae 100644 --- a/tests/snippets/PubSub/PubSubClientTest.php +++ b/tests/snippets/PubSub/PubSubClientTest.php @@ -20,7 +20,6 @@ use Google\Cloud\Core\Duration; use Google\Cloud\Core\Iterator\ItemIterator; use Google\Cloud\Core\Timestamp; -use Google\Cloud\Dev\SetStubConnectionTrait; use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\PubSub\Connection\ConnectionInterface; use Google\Cloud\PubSub\Message; diff --git a/tests/snippets/PubSub/SubscriptionTest.php b/tests/snippets/PubSub/SubscriptionTest.php index a40fc83e9e94..df1f106502e0 100644 --- a/tests/snippets/PubSub/SubscriptionTest.php +++ b/tests/snippets/PubSub/SubscriptionTest.php @@ -17,7 +17,6 @@ namespace Google\Cloud\Tests\Snippets\PubSub; -use Google\Cloud\Dev\SetStubConnectionTrait; use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Core\Iam\Iam; use Google\Cloud\PubSub\Connection\ConnectionInterface; diff --git a/tests/snippets/bootstrap.php b/tests/snippets/bootstrap.php index 3cabe2e11455..9112a77d1727 100644 --- a/tests/snippets/bootstrap.php +++ b/tests/snippets/bootstrap.php @@ -4,10 +4,10 @@ // start now) you don't need anything else. putenv('GOOGLE_APPLICATION_CREDENTIALS='. __DIR__ . '/keyfile-stub.json'); -use Google\Cloud\Dev\Snippet\Container; -use Google\Cloud\Dev\Snippet\Coverage\Coverage; -use Google\Cloud\Dev\Snippet\Coverage\Scanner; -use Google\Cloud\Dev\Snippet\Parser\Parser; +use Google\Cloud\Core\Testing\Snippet\Container; +use Google\Cloud\Core\Testing\Snippet\Coverage\Coverage; +use Google\Cloud\Core\Testing\Snippet\Coverage\Scanner; +use Google\Cloud\Core\Testing\Snippet\Parser\Parser; require __DIR__ . '/../../vendor/autoload.php'; From 4f87b7447a1e7c98360c954153dcb700221a7d43 Mon Sep 17 00:00:00 2001 From: Michael Bausor Date: Wed, 10 Jan 2018 10:05:52 -0800 Subject: [PATCH 22/36] Add snippet testing of parser --- src/Core/Testing/Snippet/Parser/Parser.php | 14 ++-- .../Testing/Snippet/Parser/ParserTest.php | 73 +++++++++++++++---- 2 files changed, 66 insertions(+), 21 deletions(-) diff --git a/src/Core/Testing/Snippet/Parser/Parser.php b/src/Core/Testing/Snippet/Parser/Parser.php index ec76e680e46b..894e063dccaa 100644 --- a/src/Core/Testing/Snippet/Parser/Parser.php +++ b/src/Core/Testing/Snippet/Parser/Parser.php @@ -29,6 +29,8 @@ * * Example: * ``` + * use Google\Cloud\Core\Testing\Snippet\Parser\Parser; + * * $parser = new Parser; * ``` */ @@ -41,6 +43,8 @@ class Parser * * Example: * ``` + * use Google\Cloud\Core\Testing\Snippet\Parser\Parser; + * * $snippet = $parser->classExample(Parser::class); * ``` * @@ -74,10 +78,14 @@ public function classExample($class, $index = 0) * * Example: * ``` + * use Google\Cloud\Core\Testing\Snippet\Parser\Parser; + * * $snippet = $parser->methodExample(Parser::class, 'methodExample'); * ``` * * ``` + * use Google\Cloud\Core\Testing\Snippet\Parser\Parser; + * * // Get the 2nd example (index=1) * $snippet = $parser->methodExample(Parser::class, 'methodExample', 1); * ``` @@ -226,12 +234,6 @@ public function allExamples($class) /** * Parse examples from a DocBlock object. * - * Example: - * ``` - * // Yeah, this example is pretty useless. - * $examples = $parser->examples($docBlock); - * ``` - * * @param DocBlock $docBlock The DocBlock to parse * @param string $file The filename the docblock is in * @param int $line The line where the tested method or class is declared. diff --git a/tests/snippets/Core/Testing/Snippet/Parser/ParserTest.php b/tests/snippets/Core/Testing/Snippet/Parser/ParserTest.php index a448d6b41cdd..6547a061dbb1 100644 --- a/tests/snippets/Core/Testing/Snippet/Parser/ParserTest.php +++ b/tests/snippets/Core/Testing/Snippet/Parser/ParserTest.php @@ -19,6 +19,7 @@ use Google\Cloud\Core\Testing\Snippet\Parser\Parser; use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; +use phpDocumentor\Reflection\DocBlock; /** * @group core @@ -26,10 +27,25 @@ class ParserTest extends SnippetTestCase { private $parser; + private $docBlock; + private $classSnippet; + private $methodSnippet; + private $secondMethodSnippet; + private $classExamples; + private $methodExamples; + private $allExamples; public function setUp() { $this->parser = new Parser(); + $this->docBlock = new DocBlock(null); + $this->classSnippet = $this->parser->classExample(Parser::class); + $this->methodSnippet = $this->parser->methodExample(Parser::class, 'methodExample'); + $this->secondMethodSnippet = $this->parser->methodExample( + Parser::class, 'methodExample', 1); + $this->classExamples = $this->parser->examplesFromClass($this->parser); + $this->methodExamples = $this->parser->examplesFromMethod($this->parser, 'examplesFromMethod'); + $this->allExamples = $this->parser->allExamples($this->parser); } public function testClass() @@ -39,30 +55,57 @@ public function testClass() $this->assertInstanceOf(Parser::class, $res->returnVal()); } - public function testClassCast() + public function testClassExample() { - $snippet = $this->snippetFromClass(Timestamp::class, 1); - $snippet->addLocal('timestamp', $this->timestamp); + $snippet = $this->snippetFromMethod(Parser::class, 'classExample'); + $snippet->addLocal('parser', $this->parser); - $res = $snippet->invoke(); - $this->assertEquals((string)$this->timestamp, $res->output()); + $res = $snippet->invoke('snippet'); + $this->assertEquals($this->classSnippet, $res->returnVal()); } - public function testGet() + public function testMethodExample() { - $snippet = $this->snippetFromMethod(Timestamp::class, 'get'); - $snippet->addLocal('timestamp', $this->timestamp); + $snippet = $this->snippetFromMethod(Parser::class, 'methodExample'); + $snippet->addLocal('parser', $this->parser); - $res = $snippet->invoke('dateTime'); - $this->assertEquals($this->dt, $res->returnVal()); + $res = $snippet->invoke('snippet'); + $this->assertEquals($this->methodSnippet, $res->returnVal()); } - public function testFormatAsString() + public function testSecondMethodExample() { - $snippet = $this->snippetFromMethod(Timestamp::class, 'formatAsString'); - $snippet->addLocal('timestamp', $this->timestamp); + $snippet = $this->snippetFromMethod(Parser::class, 'methodExample', 1); + $snippet->addLocal('parser', $this->parser); - $res = $snippet->invoke('value'); - $this->assertEquals($this->timestamp->formatAsString(), $res->returnVal()); + $res = $snippet->invoke('snippet'); + $this->assertEquals($this->secondMethodSnippet, $res->returnVal()); + } + + public function testExamplesFromClass() + { + $snippet = $this->snippetFromMethod(Parser::class, 'examplesFromClass'); + $snippet->addLocal('parser', $this->parser); + + $res = $snippet->invoke('examples'); + $this->assertEquals($this->classExamples, $res->returnVal()); + } + + public function testExamplesFromMethod() + { + $snippet = $this->snippetFromMethod(Parser::class, 'examplesFromMethod'); + $snippet->addLocal('parser', $this->parser); + + $res = $snippet->invoke('examples'); + $this->assertEquals($this->methodExamples, $res->returnVal()); + } + + public function testAllExamples() + { + $snippet = $this->snippetFromMethod(Parser::class, 'allExamples'); + $snippet->addLocal('parser', $this->parser); + + $res = $snippet->invoke('examples'); + $this->assertEquals($this->allExamples, $res->returnVal()); } } From e8751c3b451a1512583a64094fe514bb547bd30a Mon Sep 17 00:00:00 2001 From: Michael Bausor Date: Thu, 11 Jan 2018 09:03:43 -0800 Subject: [PATCH 23/36] Update Iam --- src/Core/Iam/Iam.php | 2 +- src/Core/Testing/Snippet/SnippetTestCase.php | 15 +++++++++++++++ tests/snippets/Core/Iam/IamTest.php | 4 +++- 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/Core/Iam/Iam.php b/src/Core/Iam/Iam.php index fbb06823c7a9..05086ad635e6 100644 --- a/src/Core/Iam/Iam.php +++ b/src/Core/Iam/Iam.php @@ -30,7 +30,7 @@ * ``` * // IAM policies are obtained via resources which implement IAM. * // In this example, we'll use PubSub topics to demonstrate - * // how IAM politices are managed. + * // how IAM policies are managed. * * use Google\Cloud\PubSub\PubSubClient; * diff --git a/src/Core/Testing/Snippet/SnippetTestCase.php b/src/Core/Testing/Snippet/SnippetTestCase.php index 29a4532c7cc6..685fa3deb683 100644 --- a/src/Core/Testing/Snippet/SnippetTestCase.php +++ b/src/Core/Testing/Snippet/SnippetTestCase.php @@ -106,4 +106,19 @@ public function snippetFromMethod($class, $method, $indexOrName = 0) return clone $snippet; } + + /** + * Check whether all required classes are available, otherwise skip the tests. + * + * @param array $requiredClasses List of classes that must be available. + */ + protected function checkAndSkipTest(array $requiredClasses) + { + foreach ($requiredClasses as $class) { + if (!class_exists($class)) { + $this->markTestSkipped("Missing required class: $class"); + return; + } + } + } } diff --git a/tests/snippets/Core/Iam/IamTest.php b/tests/snippets/Core/Iam/IamTest.php index cc17abcb9739..91254f250b11 100644 --- a/tests/snippets/Core/Iam/IamTest.php +++ b/tests/snippets/Core/Iam/IamTest.php @@ -31,7 +31,6 @@ class IamTest extends SnippetTestCase private $resource; private $connection; - private $policy; public function setUp() { @@ -46,6 +45,9 @@ public function setUp() public function testClass() { $snippet = $this->snippetFromClass(Iam::class); + $this->checkAndSkipTest([ + '\Google\Cloud\PubSub\PubSubClient', + ]); $res = $snippet->invoke('iam'); $this->assertInstanceOf(Iam::class, $res->returnVal()); From 520cf291f448128b111f162a631c962429e91459 Mon Sep 17 00:00:00 2001 From: Michael Bausor Date: Thu, 11 Jan 2018 09:53:16 -0800 Subject: [PATCH 24/36] Handle servicebuilder tests --- src/Core/Testing/CheckForClassTrait.php | 36 ++++++++++++++++++++ src/Core/Testing/Snippet/SnippetTestCase.php | 18 ++-------- tests/snippets/Core/ServiceBuilderTest.php | 1 + tests/unit/Core/ServiceBuilderTest.php | 10 ++++++ 4 files changed, 50 insertions(+), 15 deletions(-) create mode 100644 src/Core/Testing/CheckForClassTrait.php diff --git a/src/Core/Testing/CheckForClassTrait.php b/src/Core/Testing/CheckForClassTrait.php new file mode 100644 index 000000000000..4c6e9dbf5a98 --- /dev/null +++ b/src/Core/Testing/CheckForClassTrait.php @@ -0,0 +1,36 @@ +markTestSkipped("Missing required class: $class"); + return; + } + } + } +} diff --git a/src/Core/Testing/Snippet/SnippetTestCase.php b/src/Core/Testing/Snippet/SnippetTestCase.php index 685fa3deb683..b9c3056f2ae5 100644 --- a/src/Core/Testing/Snippet/SnippetTestCase.php +++ b/src/Core/Testing/Snippet/SnippetTestCase.php @@ -17,6 +17,7 @@ namespace Google\Cloud\Core\Testing\Snippet; +use Google\Cloud\Core\Testing\CheckForClassTrait; use Google\Cloud\Core\Testing\Snippet\Container; use PHPUnit\Framework\TestCase; @@ -27,6 +28,8 @@ */ class SnippetTestCase extends TestCase { + use CheckForClassTrait; + private static $coverage; private static $parser; @@ -106,19 +109,4 @@ public function snippetFromMethod($class, $method, $indexOrName = 0) return clone $snippet; } - - /** - * Check whether all required classes are available, otherwise skip the tests. - * - * @param array $requiredClasses List of classes that must be available. - */ - protected function checkAndSkipTest(array $requiredClasses) - { - foreach ($requiredClasses as $class) { - if (!class_exists($class)) { - $this->markTestSkipped("Missing required class: $class"); - return; - } - } - } } diff --git a/tests/snippets/Core/ServiceBuilderTest.php b/tests/snippets/Core/ServiceBuilderTest.php index 41bb280ebf8f..56e28eba66e7 100644 --- a/tests/snippets/Core/ServiceBuilderTest.php +++ b/tests/snippets/Core/ServiceBuilderTest.php @@ -80,6 +80,7 @@ public function testServices($method, $returnType, $returnName, $skipIfMissingGr } $snippet = $this->snippetFromMethod(ServiceBuilder::class, $method); + $this->checkAndSkipTest([$returnType]); $snippet->addLocal('cloud', $this->cloud); $res = $snippet->invoke($returnName); diff --git a/tests/unit/Core/ServiceBuilderTest.php b/tests/unit/Core/ServiceBuilderTest.php index 565238dc05ea..28313418448d 100644 --- a/tests/unit/Core/ServiceBuilderTest.php +++ b/tests/unit/Core/ServiceBuilderTest.php @@ -18,6 +18,7 @@ use Google\Cloud\BigQuery\BigQueryClient; use Google\Cloud\Core\ServiceBuilder; +use Google\Cloud\Core\Testing\CheckForClassTrait; use Google\Cloud\Core\Testing\GrpcTestTrait; use Google\Cloud\Datastore\DatastoreClient; use Google\Cloud\Firestore\FirestoreClient; @@ -41,12 +42,15 @@ class ServiceBuilderTest extends TestCase { use GrpcTestTrait; + use CheckForClassTrait; /** * @dataProvider serviceProvider */ public function testBuildsClients($serviceName, $expectedClient, array $args = [], callable $beforeCallable = null) { + $this->checkAndSkipTest([$expectedClient]); + if ($beforeCallable) { call_user_func($beforeCallable); } @@ -67,6 +71,8 @@ public function testBuildsClients($serviceName, $expectedClient, array $args = [ public function testTranslateClientWithApiKey() { + $this->checkAndSkipTest([TranslateClient::class]); + $config = ['key' => 'test_key']; $serviceBuilder = new ServiceBuilder($config); @@ -83,6 +89,8 @@ public function testKeyfilePathAuthPassthrough( array $args = [], callable $beforeCallable = null ) { + $this->checkAndSkipTest([$expectedClient]); + if ($beforeCallable) { call_user_func($beforeCallable); } @@ -118,6 +126,8 @@ public function testKeyfileAuthPassthrough( array $args = [], callable $beforeCallable = null ) { + $this->checkAndSkipTest([$expectedClient]); + if ($beforeCallable) { call_user_func($beforeCallable); } From e76b08f97491feac6fa355024e4f119923fc5d7c Mon Sep 17 00:00:00 2001 From: Michael Bausor Date: Thu, 11 Jan 2018 10:38:29 -0800 Subject: [PATCH 25/36] Add internal and experimental annotations --- src/Core/Testing/ArrayHasSameValuesToken.php | 15 +++++++++++ src/Core/Testing/CheckForClassTrait.php | 9 +++++++ src/Core/Testing/DocBlockStripSpaces.php | 9 +++++++ src/Core/Testing/Functions.php | 9 +++++++ src/Core/Testing/GrpcTestTrait.php | 9 +++++++ src/Core/Testing/KeyPairGenerateTrait.php | 3 +++ src/Core/Testing/Lock/MockGlobals.php | 5 ++++ src/Core/Testing/Lock/MockValues.php | 6 +++++ src/Core/Testing/Snippet/Container.php | 6 +++++ .../Testing/Snippet/Coverage/Coverage.php | 25 +++++++++++++++++++ src/Core/Testing/Snippet/Coverage/Scanner.php | 6 +++++ .../Snippet/Coverage/ScannerInterface.php | 15 +++++++++++ src/Core/Testing/Snippet/SnippetTestCase.php | 15 +++++++++++ src/Core/Testing/StubTrait.php | 20 +++++++++++++++ src/Core/Testing/System/DeletionQueue.php | 12 +++++++++ src/Core/Testing/System/SystemTestCase.php | 21 ++++++++++++++++ 16 files changed, 185 insertions(+) diff --git a/src/Core/Testing/ArrayHasSameValuesToken.php b/src/Core/Testing/ArrayHasSameValuesToken.php index aa399116d64a..c12641ca5316 100644 --- a/src/Core/Testing/ArrayHasSameValuesToken.php +++ b/src/Core/Testing/ArrayHasSameValuesToken.php @@ -7,6 +7,9 @@ /** * ArrayHasSameValuesToken implements TokenInterface and is used for testing + * + * @experimental + * @internal */ class ArrayHasSameValuesToken implements TokenInterface { @@ -18,6 +21,9 @@ class ArrayHasSameValuesToken implements TokenInterface * ArrayHasSameValuesToken constructor. * @param $value * @param StringUtil|null $util + * + * @experimental + * @internal */ public function __construct($value, StringUtil $util = null) { @@ -28,6 +34,9 @@ public function __construct($value, StringUtil $util = null) /** * @param $argument * @return bool|int + * + * @experimental + * @internal */ public function scoreArgument($argument) { @@ -44,6 +53,9 @@ private function compare(array $value, array $argument) /** * @return bool + * + * @experimental + * @internal */ public function isLast() { @@ -52,6 +64,9 @@ public function isLast() /** * @return string + * + * @experimental + * @internal */ public function __toString() { diff --git a/src/Core/Testing/CheckForClassTrait.php b/src/Core/Testing/CheckForClassTrait.php index 4c6e9dbf5a98..8b732690a883 100644 --- a/src/Core/Testing/CheckForClassTrait.php +++ b/src/Core/Testing/CheckForClassTrait.php @@ -17,12 +17,21 @@ namespace Google\Cloud\Core\Testing; +/** + * Trait CheckForClassTrait + * + * @experimental + * @internal + */ trait CheckForClassTrait { /** * Check whether all required classes are available, otherwise skip the tests. * * @param array $requiredClasses List of classes that must be available. + * + * @experimental + * @internal */ protected function checkAndSkipTest(array $requiredClasses) { diff --git a/src/Core/Testing/DocBlockStripSpaces.php b/src/Core/Testing/DocBlockStripSpaces.php index 8f851edd3f28..a8f0a4e84036 100644 --- a/src/Core/Testing/DocBlockStripSpaces.php +++ b/src/Core/Testing/DocBlockStripSpaces.php @@ -19,6 +19,12 @@ use phpDocumentor\Reflection\DocBlock; +/** + * Class DocBlockStripSpaces + * + * @experimental + * @internal + */ class DocBlockStripSpaces extends DocBlock { /** @@ -28,6 +34,9 @@ class DocBlockStripSpaces extends DocBlock * @param int $spaces The number of spaces to strip. * * @return string + * + * @experimental + * @internal */ public function cleanInput($comment, $spaces = 4) { diff --git a/src/Core/Testing/Functions.php b/src/Core/Testing/Functions.php index 26e5b8c184ab..70f38eb07fc4 100644 --- a/src/Core/Testing/Functions.php +++ b/src/Core/Testing/Functions.php @@ -20,6 +20,9 @@ /** * Class Functions is used to hold static functions required for testing + * + * @experimental + * @internal */ class Functions { @@ -30,6 +33,9 @@ class Functions * @param array $args An array of constructor arguments to use when creating the stub. * @param array $props A list of private properties on which to enable overrriding. * @return mixed + * + * @experimental + * @internal */ public static function stub($extends, array $args = [], array $props = []) { @@ -54,6 +60,9 @@ public static function stub($extends, array $args = [], array $props = []) * * @param string $trait The fully-qualified name of the trait to implement. * @return mixed + * + * @experimental + * @internal */ public static function impl($trait, array $props = []) { diff --git a/src/Core/Testing/GrpcTestTrait.php b/src/Core/Testing/GrpcTestTrait.php index e207042af85b..603e1cd7d684 100644 --- a/src/Core/Testing/GrpcTestTrait.php +++ b/src/Core/Testing/GrpcTestTrait.php @@ -19,11 +19,17 @@ /** * Provides checks for whether to run gRPC tests + * + * @experimental + * @internal */ trait GrpcTestTrait { /** * Checks for the grpc extension, and if it is missing, marked the test as skipped + * + * @experimental + * @internal */ public function checkAndSkipGrpcTests() { @@ -37,6 +43,9 @@ public function checkAndSkipGrpcTests() /** * @return bool True if grpc tests should be skipped, otherwise false + * + * @experimental + * @internal */ public function shouldSkipGrpcTests() { diff --git a/src/Core/Testing/KeyPairGenerateTrait.php b/src/Core/Testing/KeyPairGenerateTrait.php index fa233f9ed9c0..eb7a046a2627 100644 --- a/src/Core/Testing/KeyPairGenerateTrait.php +++ b/src/Core/Testing/KeyPairGenerateTrait.php @@ -22,6 +22,9 @@ /** * Trait KeyPairGenerateTrait implements key pair generation functions used for testing + * + * @experimental + * @internal */ trait KeyPairGenerateTrait { diff --git a/src/Core/Testing/Lock/MockGlobals.php b/src/Core/Testing/Lock/MockGlobals.php index 89bde6b71478..882e35d38792 100644 --- a/src/Core/Testing/Lock/MockGlobals.php +++ b/src/Core/Testing/Lock/MockGlobals.php @@ -16,6 +16,11 @@ * limitations under the License. */ +/** + * @experimental + * @internal + */ + namespace Google\Cloud\Core\Lock { use Google\Cloud\Core\Testing\Lock\MockValues; diff --git a/src/Core/Testing/Lock/MockValues.php b/src/Core/Testing/Lock/MockValues.php index 98d9f8b52f0c..b9edf1fded06 100644 --- a/src/Core/Testing/Lock/MockValues.php +++ b/src/Core/Testing/Lock/MockValues.php @@ -25,6 +25,9 @@ * * WARNING: this class requires MockGlobals.php, which replaces some existing functions with test * implementations. + * + * @experimental + * @internal */ class MockValues { @@ -36,6 +39,9 @@ class MockValues /** * Initialize MockValues + * + * @experimental + * @internal */ public static function initialize() { diff --git a/src/Core/Testing/Snippet/Container.php b/src/Core/Testing/Snippet/Container.php index d9c3b8cc2f8a..541da952f7c3 100644 --- a/src/Core/Testing/Snippet/Container.php +++ b/src/Core/Testing/Snippet/Container.php @@ -17,6 +17,12 @@ namespace Google\Cloud\Core\Testing\Snippet; +/** + * Class Container + * + * @experimental + * @internal + */ class Container { public static $coverage; diff --git a/src/Core/Testing/Snippet/Coverage/Coverage.php b/src/Core/Testing/Snippet/Coverage/Coverage.php index ce5e81a95b40..9e7e757a05a4 100644 --- a/src/Core/Testing/Snippet/Coverage/Coverage.php +++ b/src/Core/Testing/Snippet/Coverage/Coverage.php @@ -17,6 +17,12 @@ namespace Google\Cloud\Core\Testing\Snippet\Coverage; +/** + * Class Coverage + * + * @experimental + * @internal + */ class Coverage { private static $snippetExcludeList = [ @@ -40,6 +46,9 @@ class Coverage /** * @param ScannerInterface $scanner The scanner to use + * + * @experimental + * @internal */ public function __construct(ScannerInterface $scanner) { @@ -55,6 +64,9 @@ private function getSnippetExcludeList() * Creates a list of all snippets which should be covered. * * @return \Google\Cloud\Core\Testing\Snippet\Parser\Snippet[] + * + * @experimental + * @internal */ public function buildListToCover() { @@ -71,6 +83,9 @@ public function buildListToCover() * * @param string $identifier The identifier of the snippet being covered. * @return void + * + * @experimental + * @internal */ public function cover($identifier) { @@ -81,12 +96,22 @@ public function cover($identifier) * Return a list of all snippets not marked a covered. * * @return \Google\Cloud\Core\Testing\Snippet\Parser\Snippet[] + * + * @experimental + * @internal */ public function uncovered() { return array_diff_key($this->snippets, array_flip($this->covered)); } + /** + * @param $identifier + * @return \Google\Cloud\Core\Testing\Snippet\Parser\Snippet|null + * + * @experimental + * @internal + */ public function cache($identifier) { return (array_key_exists($identifier, $this->snippets)) diff --git a/src/Core/Testing/Snippet/Coverage/Scanner.php b/src/Core/Testing/Snippet/Coverage/Scanner.php index f775deafbcfc..99a4622d1123 100644 --- a/src/Core/Testing/Snippet/Coverage/Scanner.php +++ b/src/Core/Testing/Snippet/Coverage/Scanner.php @@ -23,6 +23,9 @@ /** * Scan a directory for files, a set of files for classes, and a set of classes * for code snippets. + * + * @experimental + * @internal */ class Scanner implements ScannerInterface { @@ -39,6 +42,9 @@ class Scanner implements ScannerInterface /** * @param Parser $parser An instance of the Snippet Parser. * @param string $basepath The path to scan for PHP files. + * + * @experimental + * @internal */ public function __construct(Parser $parser, $basePath) { diff --git a/src/Core/Testing/Snippet/Coverage/ScannerInterface.php b/src/Core/Testing/Snippet/Coverage/ScannerInterface.php index 916cc2e1eb94..f7d562e47b34 100644 --- a/src/Core/Testing/Snippet/Coverage/ScannerInterface.php +++ b/src/Core/Testing/Snippet/Coverage/ScannerInterface.php @@ -17,12 +17,21 @@ namespace Google\Cloud\Core\Testing\Snippet\Coverage; +/** + * Interface ScannerInterface + * + * @experimental + * @internal + */ interface ScannerInterface { /** * Retrieve a list of PHP files to scan. * * @return string[] + * + * @experimental + * @internal */ public function files(); @@ -30,6 +39,9 @@ public function files(); * Retrieve a list of classes in the given PHP files. * * @return string[] + * + * @experimental + * @internal */ public function classes(array $files); @@ -37,6 +49,9 @@ public function classes(array $files); * Get a list of all snippets from the given classes. * * @return \Google\Cloud\Core\Testing\Snippet\Parser\Snippet[] + * + * @experimental + * @internal */ public function snippets(array $classes); } diff --git a/src/Core/Testing/Snippet/SnippetTestCase.php b/src/Core/Testing/Snippet/SnippetTestCase.php index b9c3056f2ae5..0b1c003b0c06 100644 --- a/src/Core/Testing/Snippet/SnippetTestCase.php +++ b/src/Core/Testing/Snippet/SnippetTestCase.php @@ -25,6 +25,9 @@ * Provide helpers for Snippet tests. * * Snippet test cases should extend this class. + * + * @experimental + * @internal */ class SnippetTestCase extends TestCase { @@ -35,6 +38,9 @@ class SnippetTestCase extends TestCase /** * Run to set up class before testing + * + * @experimental + * @internal */ public static function setUpBeforeClass() { @@ -48,6 +54,9 @@ public static function setUpBeforeClass() * @param string $class The class name. * @param string|int $indexOrName The index of the snippet, or its name. * @return Snippet + * + * @experimental + * @internal */ public function snippetFromClass($class, $indexOrName = 0) { @@ -71,6 +80,9 @@ public function snippetFromClass($class, $indexOrName = 0) * @param string $method The method name * @param string|int $indexOrName The index of the snippet, or its name. * @return Snippet + * + * @experimental + * @internal */ public function snippetFromMagicMethod($class, $method, $indexOrName = 0) { @@ -94,6 +106,9 @@ public function snippetFromMagicMethod($class, $method, $indexOrName = 0) * @param string $method The method name * @param string|int $indexOrName The index of the snippet, or its name. * @return Snippet + * + * @experimental + * @internal */ public function snippetFromMethod($class, $method, $indexOrName = 0) { diff --git a/src/Core/Testing/StubTrait.php b/src/Core/Testing/StubTrait.php index fd1fbe09da13..866ce3a1dc1b 100644 --- a/src/Core/Testing/StubTrait.php +++ b/src/Core/Testing/StubTrait.php @@ -17,8 +17,21 @@ namespace Google\Cloud\Core\Testing; +/** + * Trait StubTrait + * + * @experimental + * @internal + */ trait StubTrait { + /** + * @param $prop + * @return mixed + * + * @experimental + * @internal + */ public function ___getProperty($prop) { $property = $this->___getPropertyReflector($prop); @@ -27,6 +40,13 @@ public function ___getProperty($prop) return $property->getValue($this); } + /** + * @param $prop + * @param $value + * + * @experimental + * @internal + */ public function ___setProperty($prop, $value) { if (!in_array($prop, json_decode($this->___props))) { diff --git a/src/Core/Testing/System/DeletionQueue.php b/src/Core/Testing/System/DeletionQueue.php index 2cd1e5359ba7..d7fea09513ec 100644 --- a/src/Core/Testing/System/DeletionQueue.php +++ b/src/Core/Testing/System/DeletionQueue.php @@ -22,6 +22,9 @@ /** * Manage a queue of items to be cleaned up at the end of the test run. + * + * @experimental + * @internal */ class DeletionQueue { @@ -38,6 +41,9 @@ class DeletionQueue /** * @param bool $acceptAllInputs If false, only callables or objects with * `delete` methods are allowed. **Defaults to** `false`. + * + * @experimental + * @internal */ public function __construct($acceptAllInputs = false) { @@ -51,6 +57,9 @@ public function __construct($acceptAllInputs = false) * `$acceptAllInputs = true`, either a callable with no arguments, or * an object with a `delete` method. * @return void + * + * @experimental + * @internal */ public function add($toDelete) { @@ -75,6 +84,9 @@ public function add($toDelete) * Process all items in the deletion queue. * * @return void + * + * @experimental + * @internal */ public function process(callable $action = null) { diff --git a/src/Core/Testing/System/SystemTestCase.php b/src/Core/Testing/System/SystemTestCase.php index d7d5b376cf6b..1cb6fe677b89 100644 --- a/src/Core/Testing/System/SystemTestCase.php +++ b/src/Core/Testing/System/SystemTestCase.php @@ -26,6 +26,9 @@ /** * SystemTestCase can be extended to implement system tests + * + * @experimental + * @internal */ class SystemTestCase extends TestCase { @@ -33,6 +36,9 @@ class SystemTestCase extends TestCase /** * Set up the deletion queue + * + * @experimental + * @internal */ public static function setupQueue() { @@ -41,6 +47,9 @@ public static function setupQueue() /** * Process the deletion queue + * + * @experimental + * @internal */ public static function processQueue() { @@ -51,6 +60,9 @@ public static function processQueue() * Create a random integer ID for test entities. * * @return int + * + * @experimental + * @internal */ public static function randId() { @@ -71,6 +83,9 @@ public static function randId() * @param string $bucketName * @param array $options * @return Google\Cloud\Storage\Bucket + * + * @experimental + * @internal */ public static function createBucket(StorageClient $client, $bucketName, array $options = []) { @@ -107,6 +122,9 @@ public static function createBucket(StorageClient $client, $bucketName, array $o * @param string $datasetName * @param array $options * @return Google\Cloud\BigQuery\Dataset + * + * @experimental + * @internal */ public static function createDataset(BigQueryClient $client, $datasetName, array $options = []) { @@ -133,6 +151,9 @@ public static function createDataset(BigQueryClient $client, $datasetName, array * @param string $topicName * @param array $options * @return Google\Cloud\PubSub\Topic + * + * @experimental + * @internal */ public static function createTopic(PubSubClient $client, $topicName, array $options = []) { From c6e4837fbdebed4110a66323d29f351e4a1aca0a Mon Sep 17 00:00:00 2001 From: Michael Bausor Date: Thu, 11 Jan 2018 10:42:55 -0800 Subject: [PATCH 26/36] Add README to testing directory --- src/Core/Testing/README.md | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 src/Core/Testing/README.md diff --git a/src/Core/Testing/README.md b/src/Core/Testing/README.md new file mode 100644 index 000000000000..79b968181540 --- /dev/null +++ b/src/Core/Testing/README.md @@ -0,0 +1,6 @@ +# Google Cloud Core Testing directory + +This directory contains shared testing code that is used to implement unit, +snippet and system tests for both the Core library and other APIs. The code in +this directory is marked @experimental, and is **NOT** subject to the G.A. (1.0) +stability guarantee of the rest of the Google Cloud Core package. From a60255b37da105b9cb057114b6dec3bcf648e637 Mon Sep 17 00:00:00 2001 From: Michael Bausor Date: Thu, 11 Jan 2018 16:15:41 -0800 Subject: [PATCH 27/36] Fix phpcs errors --- src/Core/Testing/Snippet/Parser/Snippet.php | 2 +- src/Core/Testing/StubTrait.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Core/Testing/Snippet/Parser/Snippet.php b/src/Core/Testing/Snippet/Parser/Snippet.php index 91b4c6fc148b..acad96c04585 100644 --- a/src/Core/Testing/Snippet/Parser/Snippet.php +++ b/src/Core/Testing/Snippet/Parser/Snippet.php @@ -149,7 +149,7 @@ public function invoke($returnVar = null) $content = implode("\n", $use) . $content; } - $cb = function($return) use ($content) { + $cb = function ($return) use ($content) { extract($this->locals); try { diff --git a/src/Core/Testing/StubTrait.php b/src/Core/Testing/StubTrait.php index 866ce3a1dc1b..f1a7c9ea05c2 100644 --- a/src/Core/Testing/StubTrait.php +++ b/src/Core/Testing/StubTrait.php @@ -78,7 +78,7 @@ private function ___getPropertyReflector($property) throw new \BadMethodCallException($e->getMessage()); } } - } while($keepTrying); + } while ($keepTrying); return $property; } From c2d88c331e9cf2392302d69eeab212868e370ab5 Mon Sep 17 00:00:00 2001 From: Michael Bausor Date: Thu, 11 Jan 2018 16:56:31 -0800 Subject: [PATCH 28/36] Fix import for doc gen --- dev/src/DocGenerator/Parser/CodeParser.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/src/DocGenerator/Parser/CodeParser.php b/dev/src/DocGenerator/Parser/CodeParser.php index 0808383842be..3191adb83479 100644 --- a/dev/src/DocGenerator/Parser/CodeParser.php +++ b/dev/src/DocGenerator/Parser/CodeParser.php @@ -17,7 +17,7 @@ namespace Google\Cloud\Dev\DocGenerator\Parser; -use Google\Cloud\Dev\DocBlockStripSpaces; +use Google\Cloud\Core\Testing\DocBlockStripSpaces; use Google\Cloud\Dev\DocGenerator\ReflectorRegister; use Google\Cloud\Dev\GetComponentsTrait; use phpDocumentor\Reflection\ClassReflector; From 5a9d83575d709c3a6182ea6264acbef9621b66c2 Mon Sep 17 00:00:00 2001 From: Michael Bausor Date: Fri, 12 Jan 2018 09:06:46 -0800 Subject: [PATCH 29/36] Add comments to new code in Core/Testing --- src/Core/Testing/Snippet/Coverage/Scanner.php | 21 ++++++++++++++++--- .../Testing/Snippet/Parser/InvokeResult.php | 15 +++++++++++++ src/Core/Testing/Snippet/Parser/Parser.php | 10 +++++++-- src/Core/Testing/Snippet/Parser/Snippet.php | 5 +++++ 4 files changed, 46 insertions(+), 5 deletions(-) diff --git a/src/Core/Testing/Snippet/Coverage/Scanner.php b/src/Core/Testing/Snippet/Coverage/Scanner.php index 99a4622d1123..285e15162487 100644 --- a/src/Core/Testing/Snippet/Coverage/Scanner.php +++ b/src/Core/Testing/Snippet/Coverage/Scanner.php @@ -53,7 +53,12 @@ public function __construct(Parser $parser, $basePath) } /** - * {@inheritDoc} + * Retrieve a list of PHP files to scan. + * + * @return string[] + * + * @experimental + * @internal */ public function files() { @@ -84,7 +89,12 @@ private function checkExclude($className, array $exclude) } /** - * {@inheritDoc} + * Retrieve a list of classes in the given PHP files. + * + * @return string[] + * + * @experimental + * @internal */ public function classes(array $files, array $exclude = []) { @@ -103,7 +113,12 @@ public function classes(array $files, array $exclude = []) } /** - * {@inheritDoc} + * Get a list of all snippets from the given classes. + * + * @return \Google\Cloud\Core\Testing\Snippet\Parser\Snippet[] + * + * @experimental + * @internal */ public function snippets(array $classes) { diff --git a/src/Core/Testing/Snippet/Parser/InvokeResult.php b/src/Core/Testing/Snippet/Parser/InvokeResult.php index 3399cbf02b89..083d52d815d4 100644 --- a/src/Core/Testing/Snippet/Parser/InvokeResult.php +++ b/src/Core/Testing/Snippet/Parser/InvokeResult.php @@ -17,22 +17,37 @@ namespace Google\Cloud\Core\Testing\Snippet\Parser; +/** + * Class InvokeResult + */ class InvokeResult { private $returnVal; private $output; + /** + * InvokeResult constructor. + * + * @param $returnVal + * @param $output + */ public function __construct($returnVal, $output) { $this->returnVal = $returnVal; $this->output = $output; } + /** + * @return mixed + */ public function returnVal() { return $this->returnVal; } + /** + * @return mixed + */ public function output() { return $this->output; diff --git a/src/Core/Testing/Snippet/Parser/Parser.php b/src/Core/Testing/Snippet/Parser/Parser.php index 894e063dccaa..78527fc20730 100644 --- a/src/Core/Testing/Snippet/Parser/Parser.php +++ b/src/Core/Testing/Snippet/Parser/Parser.php @@ -211,8 +211,7 @@ public function examplesFromMethod($class, $method) * $examples = $parser->allExamples($parser); * ``` * - * @param object|ReflectionClass An instance or reflector of the class to - * parse. + * @param object|ReflectionClass $class An instance or reflector of the class to parse. * @return array */ public function allExamples($class) @@ -290,6 +289,13 @@ public function examples(DocBlock $docBlock, $fullyQualifiedName, $file, $line, return $res; } + /** + * Create identifier + * + * @param $fqn + * @param $indexOrName + * @return string + */ public function createIdentifier($fqn, $indexOrName) { return sha1($fqn . $indexOrName); diff --git a/src/Core/Testing/Snippet/Parser/Snippet.php b/src/Core/Testing/Snippet/Parser/Snippet.php index acad96c04585..ddf3398863f4 100644 --- a/src/Core/Testing/Snippet/Parser/Snippet.php +++ b/src/Core/Testing/Snippet/Parser/Snippet.php @@ -276,6 +276,11 @@ public function regexReplace($pattern, $new) $this->config['content'] = preg_replace($pattern, $new, $this->config['content']); } + /** + * Serialize to json + * + * @return array + */ public function jsonSerialize() { return $this->config; From da17de0d934383d5426f818edccfe1bc576262af Mon Sep 17 00:00:00 2001 From: Michael Bausor Date: Tue, 23 Jan 2018 11:29:22 -0800 Subject: [PATCH 30/36] Update after merge --- tests/snippets/Debugger/MatchingFileIteratorTest.php | 2 +- tests/snippets/Debugger/SourceLocationResolverTest.php | 2 +- tests/unit/Spanner/Connection/GrpcTest.php | 3 --- 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/tests/snippets/Debugger/MatchingFileIteratorTest.php b/tests/snippets/Debugger/MatchingFileIteratorTest.php index f57065a13ef4..16d3e4af0937 100644 --- a/tests/snippets/Debugger/MatchingFileIteratorTest.php +++ b/tests/snippets/Debugger/MatchingFileIteratorTest.php @@ -17,7 +17,7 @@ namespace Google\Cloud\Tests\Snippets\Debugger; -use Google\Cloud\Dev\Snippet\SnippetTestCase; +use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Debugger\MatchingFileIterator; /** diff --git a/tests/snippets/Debugger/SourceLocationResolverTest.php b/tests/snippets/Debugger/SourceLocationResolverTest.php index 83f5932bb660..3d1a167e970e 100644 --- a/tests/snippets/Debugger/SourceLocationResolverTest.php +++ b/tests/snippets/Debugger/SourceLocationResolverTest.php @@ -17,7 +17,7 @@ namespace Google\Cloud\Tests\Snippets\Debugger; -use Google\Cloud\Dev\Snippet\SnippetTestCase; +use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Debugger\SourceLocation; use Google\Cloud\Debugger\SourceLocationResolver; diff --git a/tests/unit/Spanner/Connection/GrpcTest.php b/tests/unit/Spanner/Connection/GrpcTest.php index 78ad44335fe2..c0aba1729852 100644 --- a/tests/unit/Spanner/Connection/GrpcTest.php +++ b/tests/unit/Spanner/Connection/GrpcTest.php @@ -27,9 +27,6 @@ use Google\Cloud\Spanner\V1\SpannerClient; use Google\Cloud\Spanner\ValueMapper; use Google\Cloud\Core\Testing\GrpcTestTrait; -use Google\ApiCore\GrpcCredentialsHelper; -use Google\ApiCore\OperationResponse; -use Google\ApiCore\Serializer; use Google\Protobuf\FieldMask; use Google\Protobuf\Struct; use Google\Cloud\Spanner\Admin\Instance\V1\Instance; From 19b68678100a45128679f719ed5149274ecb8210 Mon Sep 17 00:00:00 2001 From: Michael Bausor Date: Tue, 30 Jan 2018 14:40:32 -0800 Subject: [PATCH 31/36] Address PR comments --- tests/snippets/Core/Iam/IamTest.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/snippets/Core/Iam/IamTest.php b/tests/snippets/Core/Iam/IamTest.php index 91254f250b11..09d4726fd14d 100644 --- a/tests/snippets/Core/Iam/IamTest.php +++ b/tests/snippets/Core/Iam/IamTest.php @@ -17,9 +17,11 @@ namespace Google\Cloud\Tests\Snippets\Core\Iam; +use Google\Cloud\Core\Testing\Functions; use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Core\Iam\Iam; use Google\Cloud\Core\Iam\IamConnectionInterface; +use Google\Cloud\PubSub\PubSubClient; use Prophecy\Argument; /** @@ -38,7 +40,7 @@ public function setUp() $this->resource = 'testObject'; $this->connection = $this->prophesize(IamConnectionInterface::class); - $this->iam = \Google\Cloud\Core\Testing\Functions::stub(Iam::class, [$this->connection->reveal(), $this->resource]); + $this->iam = Functions::stub(Iam::class, [$this->connection->reveal(), $this->resource]); $this->iam->___setProperty('connection', $this->connection->reveal()); } @@ -46,7 +48,7 @@ public function testClass() { $snippet = $this->snippetFromClass(Iam::class); $this->checkAndSkipTest([ - '\Google\Cloud\PubSub\PubSubClient', + PubSubClient::class, ]); $res = $snippet->invoke('iam'); From 5f6d92aca3fc08b045da7d50d587e67c42f1a772 Mon Sep 17 00:00:00 2001 From: Michael Bausor Date: Wed, 31 Jan 2018 11:31:28 -0800 Subject: [PATCH 32/36] Fix reference to impl --- tests/unit/Core/ClientTraitTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unit/Core/ClientTraitTest.php b/tests/unit/Core/ClientTraitTest.php index 1508bbf64ae6..964a6247f182 100644 --- a/tests/unit/Core/ClientTraitTest.php +++ b/tests/unit/Core/ClientTraitTest.php @@ -281,7 +281,7 @@ public function testDetectNumericProjectIdOnGce() $m = $this->prophesize(Metadata::class); $m->getNumericProjectId()->willReturn($projectId)->shouldBeCalled(); - $trait = \Google\Cloud\Dev\impl(ClientTraitStubOnGce::class, ['metadata']); + $trait = \Google\Cloud\Core\Testing\Functions::impl(ClientTraitStubOnGce::class, ['metadata']); $trait->___setProperty('metadata', $m); $res = $trait->call('detectProjectId', [['preferNumericProjectId' => true]]); From ec12d5326f7d227e99994497a3af9c63f69d8fb0 Mon Sep 17 00:00:00 2001 From: Michael Bausor Date: Wed, 31 Jan 2018 12:53:24 -0800 Subject: [PATCH 33/36] Address PR feedback --- src/Core/Testing/{Functions.php => TestHelpers.php} | 4 ++-- tests/conformance/FirestoreTest.php | 2 +- tests/snippets/BigQuery/BigQueryClientTest.php | 2 +- tests/snippets/BigQuery/CopyJobConfigurationTest.php | 2 +- .../BigQuery/ExtractJobConfigurationTest.php | 2 +- tests/snippets/BigQuery/LoadJobConfigurationTest.php | 2 +- .../snippets/BigQuery/QueryJobConfigurationTest.php | 2 +- tests/snippets/BigQuery/QueryResultsTest.php | 2 +- tests/snippets/BigQuery/TableTest.php | 8 ++++---- tests/snippets/BigQuery/TimeTest.php | 2 +- tests/snippets/BigQuery/TimestampTest.php | 2 +- tests/snippets/Core/Iam/IamTest.php | 2 +- .../Core/LongRunning/LongRunningOperationTest.php | 2 +- tests/snippets/Datastore/Query/GqlQueryTest.php | 2 +- tests/snippets/Datastore/Query/QueryTest.php | 2 +- tests/snippets/Datastore/TransactionTest.php | 2 +- tests/snippets/Debugger/DebuggerClientTest.php | 2 +- tests/snippets/Firestore/CollectionReferenceTest.php | 2 +- tests/snippets/Firestore/DocumentReferenceTest.php | 2 +- tests/snippets/Firestore/DocumentSnapshotTest.php | 4 ++-- tests/snippets/Firestore/FieldValueTest.php | 2 +- tests/snippets/Firestore/FirestoreClientTest.php | 2 +- tests/snippets/Firestore/QuerySnapshotTest.php | 4 ++-- tests/snippets/Firestore/QueryTest.php | 2 +- tests/snippets/Firestore/TransactionTest.php | 4 ++-- tests/snippets/Firestore/WriteBatchTest.php | 2 +- tests/snippets/Language/LanguageClientTest.php | 2 +- tests/snippets/Logging/LoggerTest.php | 2 +- tests/snippets/Logging/LoggingClientTest.php | 2 +- tests/snippets/Logging/MetricTest.php | 2 +- tests/snippets/Logging/SinkTest.php | 2 +- tests/snippets/PubSub/PubSubClientTest.php | 2 +- tests/snippets/PubSub/SnapshotTest.php | 2 +- tests/snippets/PubSub/SubscriptionTest.php | 4 ++-- tests/snippets/PubSub/TopicTest.php | 4 ++-- tests/snippets/Spanner/DatabaseTest.php | 4 ++-- tests/snippets/Spanner/InstanceConfigurationTest.php | 2 +- tests/snippets/Spanner/InstanceTest.php | 2 +- tests/snippets/Spanner/SnapshotTest.php | 4 ++-- tests/snippets/Spanner/SpannerClientTest.php | 2 +- tests/snippets/Spanner/TransactionTest.php | 4 ++-- tests/snippets/Speech/OperationTest.php | 2 +- tests/snippets/Speech/SpeechClientTest.php | 2 +- tests/snippets/Storage/AclTest.php | 2 +- tests/snippets/Storage/BucketTest.php | 2 +- tests/snippets/Storage/NotificationTest.php | 2 +- tests/snippets/Storage/StorageClientTest.php | 2 +- tests/snippets/Storage/StorageObjectTest.php | 2 +- tests/snippets/Trace/TraceClientTest.php | 2 +- tests/snippets/Translate/TranslateClientTest.php | 2 +- tests/snippets/Vision/VisionClientTest.php | 2 +- tests/unit/BigQuery/BigQueryClientTest.php | 2 +- tests/unit/BigQuery/JobConfigurationTraitTest.php | 2 +- tests/unit/BigQuery/JobWaitTraitTest.php | 2 +- tests/unit/Core/ClientTraitTest.php | 12 ++++++------ tests/unit/Core/ConcurrencyControlTraitTest.php | 2 +- tests/unit/Core/EmulatorTraitTest.php | 2 +- tests/unit/Core/Fixtures.php | 2 +- tests/unit/Core/GrpcTraitTest.php | 2 +- tests/unit/Core/JsonTraitTest.php | 2 +- tests/unit/Datastore/Fixtures.php | 2 +- tests/unit/Firestore/CollectionReferenceTest.php | 4 ++-- tests/unit/Firestore/DocumentReferenceTest.php | 2 +- tests/unit/Firestore/DocumentSnapshotTest.php | 2 +- tests/unit/Firestore/FirestoreClientTest.php | 2 +- tests/unit/Firestore/PathTraitTest.php | 2 +- tests/unit/Firestore/QuerySnapshotTest.php | 2 +- tests/unit/Firestore/QueryTest.php | 2 +- tests/unit/Firestore/SnapshotTraitTest.php | 2 +- tests/unit/Firestore/TransactionTest.php | 2 +- tests/unit/Firestore/ValueMapperTest.php | 2 +- tests/unit/Firestore/WriteBatchTest.php | 2 +- tests/unit/Spanner/Connection/IamDatabaseTest.php | 2 +- tests/unit/Spanner/Connection/IamInstanceTest.php | 2 +- .../Spanner/Connection/LongRunningConnectionTest.php | 2 +- tests/unit/Spanner/DatabaseTest.php | 2 +- tests/unit/Spanner/Fixtures.php | 2 +- tests/unit/Spanner/InstanceConfigurationTest.php | 4 ++-- tests/unit/Spanner/InstanceTest.php | 2 +- tests/unit/Spanner/OperationTest.php | 2 +- tests/unit/Spanner/SpannerClientTest.php | 2 +- tests/unit/Spanner/TransactionTest.php | 6 +++--- tests/unit/Spanner/TransactionTypeTest.php | 2 +- tests/unit/Storage/EncryptionTraitTest.php | 2 +- tests/unit/Storage/RequesterPaysTest.php | 2 +- tests/unit/Storage/StorageClientTest.php | 2 +- tests/unit/Vision/Fixtures.php | 2 +- 87 files changed, 108 insertions(+), 108 deletions(-) rename src/Core/Testing/{Functions.php => TestHelpers.php} (96%) diff --git a/src/Core/Testing/Functions.php b/src/Core/Testing/TestHelpers.php similarity index 96% rename from src/Core/Testing/Functions.php rename to src/Core/Testing/TestHelpers.php index 70f38eb07fc4..57a8918f22ac 100644 --- a/src/Core/Testing/Functions.php +++ b/src/Core/Testing/TestHelpers.php @@ -19,12 +19,12 @@ namespace Google\Cloud\Core\Testing; /** - * Class Functions is used to hold static functions required for testing + * Class TestHelpers is used to hold static functions required for testing * * @experimental * @internal */ -class Functions +class TestHelpers { /** * Create a test stub which extends a real class and allows overriding of private properties. diff --git a/tests/conformance/FirestoreTest.php b/tests/conformance/FirestoreTest.php index c183d8d4eaaf..cd73bdc8b042 100644 --- a/tests/conformance/FirestoreTest.php +++ b/tests/conformance/FirestoreTest.php @@ -63,7 +63,7 @@ class FirestoreTest extends TestCase public function setUp() { - $this->client = \Google\Cloud\Core\Testing\Functions::stub(FirestoreClient::class, [ + $this->client = \Google\Cloud\Core\Testing\TestHelpers::stub(FirestoreClient::class, [ [ 'projectId' => 'projectID' ] diff --git a/tests/snippets/BigQuery/BigQueryClientTest.php b/tests/snippets/BigQuery/BigQueryClientTest.php index a775749482c5..79b65e797431 100644 --- a/tests/snippets/BigQuery/BigQueryClientTest.php +++ b/tests/snippets/BigQuery/BigQueryClientTest.php @@ -70,7 +70,7 @@ class BigQueryClientTest extends SnippetTestCase public function setUp() { $this->connection = $this->prophesize(ConnectionInterface::class); - $this->client = \Google\Cloud\Core\Testing\Functions::stub(BigQueryTestClient::class); + $this->client = \Google\Cloud\Core\Testing\TestHelpers::stub(BigQueryTestClient::class); $this->client->___setProperty('connection', $this->connection->reveal()); } diff --git a/tests/snippets/BigQuery/CopyJobConfigurationTest.php b/tests/snippets/BigQuery/CopyJobConfigurationTest.php index ea233e4eded2..ce3cac3496e5 100644 --- a/tests/snippets/BigQuery/CopyJobConfigurationTest.php +++ b/tests/snippets/BigQuery/CopyJobConfigurationTest.php @@ -70,7 +70,7 @@ public function testSetters($method, $expected, $bq = null) public function setterDataProvider() { - $bq = \Google\Cloud\Core\Testing\Functions::stub(BigQueryClient::class, [ + $bq = \Google\Cloud\Core\Testing\TestHelpers::stub(BigQueryClient::class, [ ['projectId' => self::PROJECT_ID] ]); diff --git a/tests/snippets/BigQuery/ExtractJobConfigurationTest.php b/tests/snippets/BigQuery/ExtractJobConfigurationTest.php index 0a9b6b7202a4..217ed68b765b 100644 --- a/tests/snippets/BigQuery/ExtractJobConfigurationTest.php +++ b/tests/snippets/BigQuery/ExtractJobConfigurationTest.php @@ -71,7 +71,7 @@ public function testSetters($method, $expected, $bq = null) public function setterDataProvider() { - $bq = \Google\Cloud\Core\Testing\Functions::stub(BigQueryClient::class, [ + $bq = \Google\Cloud\Core\Testing\TestHelpers::stub(BigQueryClient::class, [ ['projectId' => self::PROJECT_ID] ]); diff --git a/tests/snippets/BigQuery/LoadJobConfigurationTest.php b/tests/snippets/BigQuery/LoadJobConfigurationTest.php index 04ee58fbf9e7..67dc8768aa09 100644 --- a/tests/snippets/BigQuery/LoadJobConfigurationTest.php +++ b/tests/snippets/BigQuery/LoadJobConfigurationTest.php @@ -81,7 +81,7 @@ public function testSetters($method, $expected, $bq = null) public function setterDataProvider() { - $bq = \Google\Cloud\Core\Testing\Functions::stub(BigQueryClient::class, [ + $bq = \Google\Cloud\Core\Testing\TestHelpers::stub(BigQueryClient::class, [ ['projectId' => self::PROJECT_ID] ]); diff --git a/tests/snippets/BigQuery/QueryJobConfigurationTest.php b/tests/snippets/BigQuery/QueryJobConfigurationTest.php index 283414c46e3f..aebffaa7d1a5 100644 --- a/tests/snippets/BigQuery/QueryJobConfigurationTest.php +++ b/tests/snippets/BigQuery/QueryJobConfigurationTest.php @@ -72,7 +72,7 @@ public function testSetters($method, $expected, $bq = null) public function setterDataProvider() { - $bq = \Google\Cloud\Core\Testing\Functions::stub(BigQueryClient::class, [ + $bq = \Google\Cloud\Core\Testing\TestHelpers::stub(BigQueryClient::class, [ ['projectId' => self::PROJECT_ID] ]); diff --git a/tests/snippets/BigQuery/QueryResultsTest.php b/tests/snippets/BigQuery/QueryResultsTest.php index 6622d8bde58e..068289bb1ee9 100644 --- a/tests/snippets/BigQuery/QueryResultsTest.php +++ b/tests/snippets/BigQuery/QueryResultsTest.php @@ -63,7 +63,7 @@ public function setUp() ]; $this->connection = $this->prophesize(ConnectionInterface::class); - $this->qr = \Google\Cloud\Core\Testing\Functions::stub(QueryResults::class, [ + $this->qr = \Google\Cloud\Core\Testing\TestHelpers::stub(QueryResults::class, [ $this->connection->reveal(), self::JOB_ID, self::PROJECT, diff --git a/tests/snippets/BigQuery/TableTest.php b/tests/snippets/BigQuery/TableTest.php index 723192e76507..e2320ffcda8b 100644 --- a/tests/snippets/BigQuery/TableTest.php +++ b/tests/snippets/BigQuery/TableTest.php @@ -73,7 +73,7 @@ public function setUp() $this->mapper = new ValueMapper(false); $this->connection = $this->prophesize(ConnectionInterface::class); - $this->table = \Google\Cloud\Core\Testing\Functions::stub(Table::class, [ + $this->table = \Google\Cloud\Core\Testing\TestHelpers::stub(Table::class, [ $this->connection->reveal(), self::ID, self::DSID, @@ -202,7 +202,7 @@ public function testStartJob() public function testCopy() { - $bq = \Google\Cloud\Core\Testing\Functions::stub(BigQueryClient::class); + $bq = \Google\Cloud\Core\Testing\TestHelpers::stub(BigQueryClient::class); $snippet = $this->snippetFromMethod(Table::class, 'copy'); $snippet->addLocal('bigQuery', $bq); $bq->___setProperty('connection', $this->connection->reveal()); @@ -229,7 +229,7 @@ public function testCopy() public function testExtract() { - $storage = \Google\Cloud\Core\Testing\Functions::stub(StorageClient::class); + $storage = \Google\Cloud\Core\Testing\TestHelpers::stub(StorageClient::class); $storage->___setProperty('connection', $this->prophesize(StorageConnection::class)->reveal()); $snippet = $this->snippetFromMethod(Table::class, 'extract'); $snippet->addLocal('storage', $storage); @@ -274,7 +274,7 @@ public function testLoad() public function testLoadFromStorage() { - $storage = \Google\Cloud\Core\Testing\Functions::stub(StorageClient::class); + $storage = \Google\Cloud\Core\Testing\TestHelpers::stub(StorageClient::class); $storage->___setProperty('connection', $this->prophesize(StorageConnection::class)->reveal()); $snippet = $this->snippetFromMethod(Table::class, 'loadFromStorage'); $snippet->addLocal('storage', $storage); diff --git a/tests/snippets/BigQuery/TimeTest.php b/tests/snippets/BigQuery/TimeTest.php index 08631dca3d12..f0d997d4eda1 100644 --- a/tests/snippets/BigQuery/TimeTest.php +++ b/tests/snippets/BigQuery/TimeTest.php @@ -29,7 +29,7 @@ class TimeTest extends SnippetTestCase public function testClass() { $snippet = $this->snippetFromClass(Time::class); - $snippet->addLocal('bigQuery', \Google\Cloud\Core\Testing\Functions::stub(BigQueryClient::class)); + $snippet->addLocal('bigQuery', \Google\Cloud\Core\Testing\TestHelpers::stub(BigQueryClient::class)); $res = $snippet->invoke('time'); $this->assertInstanceOf(Time::class, $res->returnVal()); diff --git a/tests/snippets/BigQuery/TimestampTest.php b/tests/snippets/BigQuery/TimestampTest.php index 3436d2cf4d1e..3459be03e4d8 100644 --- a/tests/snippets/BigQuery/TimestampTest.php +++ b/tests/snippets/BigQuery/TimestampTest.php @@ -29,7 +29,7 @@ class TimestampTest extends SnippetTestCase public function testClass() { $snippet = $this->snippetFromClass(Timestamp::class); - $snippet->addLocal('bigQuery', \Google\Cloud\Core\Testing\Functions::stub(BigQueryClient::class)); + $snippet->addLocal('bigQuery', \Google\Cloud\Core\Testing\TestHelpers::stub(BigQueryClient::class)); $res = $snippet->invoke('timestamp'); $this->assertInstanceOf(Timestamp::class, $res->returnVal()); diff --git a/tests/snippets/Core/Iam/IamTest.php b/tests/snippets/Core/Iam/IamTest.php index 09d4726fd14d..151c028f7f0a 100644 --- a/tests/snippets/Core/Iam/IamTest.php +++ b/tests/snippets/Core/Iam/IamTest.php @@ -17,7 +17,7 @@ namespace Google\Cloud\Tests\Snippets\Core\Iam; -use Google\Cloud\Core\Testing\Functions; +use Google\Cloud\Core\Testing\TestHelpers; use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Core\Iam\Iam; use Google\Cloud\Core\Iam\IamConnectionInterface; diff --git a/tests/snippets/Core/LongRunning/LongRunningOperationTest.php b/tests/snippets/Core/LongRunning/LongRunningOperationTest.php index 4cd7b0184ef5..79570d77713d 100644 --- a/tests/snippets/Core/LongRunning/LongRunningOperationTest.php +++ b/tests/snippets/Core/LongRunning/LongRunningOperationTest.php @@ -41,7 +41,7 @@ public function setUp() $this->callables = [ ['typeUrl' => self::TYPE, 'callable' => function($res) { return $res; }] ]; - $this->operation = \Google\Cloud\Core\Testing\Functions::stub(LongRunningOperation::class, [ + $this->operation = \Google\Cloud\Core\Testing\TestHelpers::stub(LongRunningOperation::class, [ $this->connection->reveal(), self::NAME, $this->callables diff --git a/tests/snippets/Datastore/Query/GqlQueryTest.php b/tests/snippets/Datastore/Query/GqlQueryTest.php index 5aafde85f926..9535e74ea4ba 100644 --- a/tests/snippets/Datastore/Query/GqlQueryTest.php +++ b/tests/snippets/Datastore/Query/GqlQueryTest.php @@ -39,7 +39,7 @@ public function setUp() { $this->datastore = new DatastoreClient; $this->connection = $this->prophesize(ConnectionInterface::class); - $this->operation = \Google\Cloud\Core\Testing\Functions::stub(Operation::class, [ + $this->operation = \Google\Cloud\Core\Testing\TestHelpers::stub(Operation::class, [ $this->connection->reveal(), 'my-awesome-project', '', diff --git a/tests/snippets/Datastore/Query/QueryTest.php b/tests/snippets/Datastore/Query/QueryTest.php index 1115a2f67015..5dd8e5859241 100644 --- a/tests/snippets/Datastore/Query/QueryTest.php +++ b/tests/snippets/Datastore/Query/QueryTest.php @@ -43,7 +43,7 @@ public function setUp() $this->datastore = new DatastoreClient; $this->connection = $this->prophesize(ConnectionInterface::class); - $this->operation = \Google\Cloud\Core\Testing\Functions::stub(Operation::class, [ + $this->operation = \Google\Cloud\Core\Testing\TestHelpers::stub(Operation::class, [ $this->connection->reveal(), 'my-awesome-project', '', diff --git a/tests/snippets/Datastore/TransactionTest.php b/tests/snippets/Datastore/TransactionTest.php index 1806376ecf1b..040a4aa5e205 100644 --- a/tests/snippets/Datastore/TransactionTest.php +++ b/tests/snippets/Datastore/TransactionTest.php @@ -44,7 +44,7 @@ class TransactionTest extends SnippetTestCase public function setUp() { $this->connection = $this->prophesize(ConnectionInterface::class); - $this->operation = \Google\Cloud\Core\Testing\Functions::stub(Operation::class, [ + $this->operation = \Google\Cloud\Core\Testing\TestHelpers::stub(Operation::class, [ $this->connection->reveal(), self::PROJECT, '', diff --git a/tests/snippets/Debugger/DebuggerClientTest.php b/tests/snippets/Debugger/DebuggerClientTest.php index f73dc63ac91c..becaebb91199 100644 --- a/tests/snippets/Debugger/DebuggerClientTest.php +++ b/tests/snippets/Debugger/DebuggerClientTest.php @@ -34,7 +34,7 @@ class DebuggerClientTest extends SnippetTestCase public function setUp() { $this->connection = $this->prophesize(ConnectionInterface::class); - $this->client = \Google\Cloud\Core\Testing\Functions::stub(DebuggerClient::class); + $this->client = \Google\Cloud\Core\Testing\TestHelpers::stub(DebuggerClient::class); $this->client->___setProperty('connection', $this->connection->reveal()); } diff --git a/tests/snippets/Firestore/CollectionReferenceTest.php b/tests/snippets/Firestore/CollectionReferenceTest.php index 4dd755ea4b96..30c6dae08f14 100644 --- a/tests/snippets/Firestore/CollectionReferenceTest.php +++ b/tests/snippets/Firestore/CollectionReferenceTest.php @@ -44,7 +44,7 @@ class CollectionReferenceTest extends SnippetTestCase public function setUp() { $this->connection = $this->prophesize(ConnectionInterface::class); - $this->collection = \Google\Cloud\Core\Testing\Functions::stub(CollectionReference::class, [ + $this->collection = \Google\Cloud\Core\Testing\TestHelpers::stub(CollectionReference::class, [ $this->connection->reveal(), new ValueMapper($this->connection->reveal(), false), self::NAME diff --git a/tests/snippets/Firestore/DocumentReferenceTest.php b/tests/snippets/Firestore/DocumentReferenceTest.php index 8c7664d55bcc..435557439208 100644 --- a/tests/snippets/Firestore/DocumentReferenceTest.php +++ b/tests/snippets/Firestore/DocumentReferenceTest.php @@ -45,7 +45,7 @@ class DocumentReferenceTest extends SnippetTestCase public function setUp() { $this->connection = $this->prophesize(ConnectionInterface::class); - $this->document = \Google\Cloud\Core\Testing\Functions::stub(DocumentReferenceStub::class, [ + $this->document = \Google\Cloud\Core\Testing\TestHelpers::stub(DocumentReferenceStub::class, [ $this->connection->reveal(), new ValueMapper($this->connection->reveal(), false), $this->prophesize(CollectionReference::class)->reveal(), diff --git a/tests/snippets/Firestore/DocumentSnapshotTest.php b/tests/snippets/Firestore/DocumentSnapshotTest.php index b4ccb1f974bd..1b706607c426 100644 --- a/tests/snippets/Firestore/DocumentSnapshotTest.php +++ b/tests/snippets/Firestore/DocumentSnapshotTest.php @@ -47,7 +47,7 @@ public function setUp() $ref->id()->willReturn(array_pop($parts)); $ref->path()->willReturn(explode('/documents/', self::DOCUMENT)[1]); - $this->snapshot = \Google\Cloud\Core\Testing\Functions::stub(DocumentSnapshot::class, [ + $this->snapshot = \Google\Cloud\Core\Testing\TestHelpers::stub(DocumentSnapshot::class, [ $ref->reveal(), new ValueMapper($this->prophesize(ConnectionInterface::class)->reveal(), false), [], @@ -67,7 +67,7 @@ public function testClass() ['missing' => self::DOCUMENT] ])); - $client = \Google\Cloud\Core\Testing\Functions::stub(FirestoreClient::class); + $client = \Google\Cloud\Core\Testing\TestHelpers::stub(FirestoreClient::class); $client->___setProperty('connection', $connection->reveal()); $snippet = $this->snippetFromClass(DocumentSnapshot::class); $snippet->setLine(2, ''); diff --git a/tests/snippets/Firestore/FieldValueTest.php b/tests/snippets/Firestore/FieldValueTest.php index e208eb1e69b3..0b66884aff79 100644 --- a/tests/snippets/Firestore/FieldValueTest.php +++ b/tests/snippets/Firestore/FieldValueTest.php @@ -41,7 +41,7 @@ public function setUp() $this->checkAndSkipGrpcTests(); $this->connection = $this->prophesize(ConnectionInterface::class); - $this->firestore = \Google\Cloud\Core\Testing\Functions::stub(FirestoreClient::class); + $this->firestore = \Google\Cloud\Core\Testing\TestHelpers::stub(FirestoreClient::class); } public function testDeleteField() diff --git a/tests/snippets/Firestore/FirestoreClientTest.php b/tests/snippets/Firestore/FirestoreClientTest.php index e816b5c2b17e..697b3ad4d2fd 100644 --- a/tests/snippets/Firestore/FirestoreClientTest.php +++ b/tests/snippets/Firestore/FirestoreClientTest.php @@ -51,7 +51,7 @@ public function setUp() $this->checkAndSkipGrpcTests(); $this->connection = $this->prophesize(ConnectionInterface::class); - $this->client = \Google\Cloud\Core\Testing\Functions::stub(FirestoreClient::class, [ + $this->client = \Google\Cloud\Core\Testing\TestHelpers::stub(FirestoreClient::class, [ ['projectId' => self::PROJECT] ]); } diff --git a/tests/snippets/Firestore/QuerySnapshotTest.php b/tests/snippets/Firestore/QuerySnapshotTest.php index 41d677a15fcc..84a758c7c262 100644 --- a/tests/snippets/Firestore/QuerySnapshotTest.php +++ b/tests/snippets/Firestore/QuerySnapshotTest.php @@ -40,7 +40,7 @@ class QuerySnapshotTest extends SnippetTestCase public function setUp() { $this->connection = $this->prophesize(ConnectionInterface::class); - $this->snapshot = \Google\Cloud\Core\Testing\Functions::stub(QuerySnapshot::class, [ + $this->snapshot = \Google\Cloud\Core\Testing\TestHelpers::stub(QuerySnapshot::class, [ $this->prophesize(Query::class)->reveal(), [] ], ['rows']); @@ -54,7 +54,7 @@ public function testClass() ->shouldBeCalled() ->willReturn(new \ArrayIterator([])); - $client = \Google\Cloud\Core\Testing\Functions::stub(FirestoreClient::class); + $client = \Google\Cloud\Core\Testing\TestHelpers::stub(FirestoreClient::class); $client->___setProperty('connection', $this->connection->reveal()); $snippet = $this->snippetFromClass(QuerySnapshot::class); diff --git a/tests/snippets/Firestore/QueryTest.php b/tests/snippets/Firestore/QueryTest.php index 0c45082cba58..df16e766dfff 100644 --- a/tests/snippets/Firestore/QueryTest.php +++ b/tests/snippets/Firestore/QueryTest.php @@ -43,7 +43,7 @@ class QueryTest extends SnippetTestCase public function setUp() { $this->connection = $this->prophesize(ConnectionInterface::class); - $this->query = \Google\Cloud\Core\Testing\Functions::stub(Query::class, [ + $this->query = \Google\Cloud\Core\Testing\TestHelpers::stub(Query::class, [ $this->connection->reveal(), new ValueMapper($this->connection->reveal(), false), self::NAME, diff --git a/tests/snippets/Firestore/TransactionTest.php b/tests/snippets/Firestore/TransactionTest.php index 6687ac7ec33a..8a81465e3ea9 100644 --- a/tests/snippets/Firestore/TransactionTest.php +++ b/tests/snippets/Firestore/TransactionTest.php @@ -52,7 +52,7 @@ class TransactionTest extends SnippetTestCase public function setUp() { $this->connection = $this->prophesize(ConnectionInterface::class); - $this->transaction = \Google\Cloud\Core\Testing\Functions::stub(TransactionStub::class, [ + $this->transaction = \Google\Cloud\Core\Testing\TestHelpers::stub(TransactionStub::class, [ $this->connection->reveal(), new ValueMapper($this->connection->reveal(), false), self::DATABASE, @@ -76,7 +76,7 @@ public function testClass() $this->connection->rollback(Argument::any()) ->shouldBeCalled(); - $client = \Google\Cloud\Core\Testing\Functions::stub(FirestoreClient::class); + $client = \Google\Cloud\Core\Testing\TestHelpers::stub(FirestoreClient::class); $client->___setProperty('connection', $this->connection->reveal()); $snippet = $this->snippetFromClass(Transaction::class); diff --git a/tests/snippets/Firestore/WriteBatchTest.php b/tests/snippets/Firestore/WriteBatchTest.php index bc03290845b4..ccfa5f3797b2 100644 --- a/tests/snippets/Firestore/WriteBatchTest.php +++ b/tests/snippets/Firestore/WriteBatchTest.php @@ -43,7 +43,7 @@ class WriteBatchTest extends SnippetTestCase public function setUp() { $this->connection = $this->prophesize(ConnectionInterface::class); - $this->batch = \Google\Cloud\Core\Testing\Functions::stub(WriteBatch::class, [ + $this->batch = \Google\Cloud\Core\Testing\TestHelpers::stub(WriteBatch::class, [ $this->connection->reveal(), new ValueMapper($this->connection->reveal(), false), self::DATABASE diff --git a/tests/snippets/Language/LanguageClientTest.php b/tests/snippets/Language/LanguageClientTest.php index 8fcc62a534eb..7bdfc8c8ca12 100644 --- a/tests/snippets/Language/LanguageClientTest.php +++ b/tests/snippets/Language/LanguageClientTest.php @@ -33,7 +33,7 @@ class LanguageClientTest extends SnippetTestCase public function setUp() { $this->connection = $this->prophesize(ConnectionInterface::class); - $this->client = \Google\Cloud\Core\Testing\Functions::stub(LanguageClient::class); + $this->client = \Google\Cloud\Core\Testing\TestHelpers::stub(LanguageClient::class); $this->client->___setProperty('connection', $this->connection->reveal()); } diff --git a/tests/snippets/Logging/LoggerTest.php b/tests/snippets/Logging/LoggerTest.php index f83de34d4c9f..6ff51e7fd7e2 100644 --- a/tests/snippets/Logging/LoggerTest.php +++ b/tests/snippets/Logging/LoggerTest.php @@ -38,7 +38,7 @@ class LoggerTest extends SnippetTestCase public function setUp() { $this->connection = $this->prophesize(ConnectionInterface::class); - $this->logger = \Google\Cloud\Core\Testing\Functions::stub(Logger::class, [ + $this->logger = \Google\Cloud\Core\Testing\TestHelpers::stub(Logger::class, [ $this->connection->reveal(), self::NAME, self::PROJECT diff --git a/tests/snippets/Logging/LoggingClientTest.php b/tests/snippets/Logging/LoggingClientTest.php index 2b3a44238ba1..2b10878b0c14 100644 --- a/tests/snippets/Logging/LoggingClientTest.php +++ b/tests/snippets/Logging/LoggingClientTest.php @@ -38,7 +38,7 @@ class LoggingClientTest extends SnippetTestCase public function setUp() { $this->connection = $this->prophesize(ConnectionInterface::class); - $this->client = \Google\Cloud\Core\Testing\Functions::stub(LoggingClient::class); + $this->client = \Google\Cloud\Core\Testing\TestHelpers::stub(LoggingClient::class); $this->client->___setProperty('connection', $this->connection->reveal()); } diff --git a/tests/snippets/Logging/MetricTest.php b/tests/snippets/Logging/MetricTest.php index 42dcf9799809..653dd51a6dad 100644 --- a/tests/snippets/Logging/MetricTest.php +++ b/tests/snippets/Logging/MetricTest.php @@ -36,7 +36,7 @@ class MetricTest extends SnippetTestCase public function setUp() { $this->connection = $this->prophesize(ConnectionInterface::class); - $this->metric = \Google\Cloud\Core\Testing\Functions::stub(Metric::class, [ + $this->metric = \Google\Cloud\Core\Testing\TestHelpers::stub(Metric::class, [ $this->connection->reveal(), self::METRIC, self::PROJECT diff --git a/tests/snippets/Logging/SinkTest.php b/tests/snippets/Logging/SinkTest.php index e036e73cfcfc..22d55c9b3641 100644 --- a/tests/snippets/Logging/SinkTest.php +++ b/tests/snippets/Logging/SinkTest.php @@ -36,7 +36,7 @@ class SinkTest extends SnippetTestCase public function setUp() { $this->connection = $this->prophesize(ConnectionInterface::class); - $this->sink = \Google\Cloud\Core\Testing\Functions::stub(Sink::class, [ + $this->sink = \Google\Cloud\Core\Testing\TestHelpers::stub(Sink::class, [ $this->connection->reveal(), self::SINK, self::PROJECT diff --git a/tests/snippets/PubSub/PubSubClientTest.php b/tests/snippets/PubSub/PubSubClientTest.php index 0ef48631acae..768e1025bc5d 100644 --- a/tests/snippets/PubSub/PubSubClientTest.php +++ b/tests/snippets/PubSub/PubSubClientTest.php @@ -44,7 +44,7 @@ class PubSubClientTest extends SnippetTestCase public function setUp() { $this->connection = $this->prophesize(ConnectionInterface::class); - $this->client = \Google\Cloud\Core\Testing\Functions::stub(PubSubClient::class, [['transport' => 'rest']]); + $this->client = \Google\Cloud\Core\Testing\TestHelpers::stub(PubSubClient::class, [['transport' => 'rest']]); } public function testClassExample() diff --git a/tests/snippets/PubSub/SnapshotTest.php b/tests/snippets/PubSub/SnapshotTest.php index 47a8afff34b9..d498c8d2c988 100644 --- a/tests/snippets/PubSub/SnapshotTest.php +++ b/tests/snippets/PubSub/SnapshotTest.php @@ -38,7 +38,7 @@ class SnapshotTest extends SnippetTestCase public function setUp() { $this->connection = $this->prophesize(ConnectionInterface::class); - $this->snapshot = \Google\Cloud\Core\Testing\Functions::stub(Snapshot::class, [ + $this->snapshot = \Google\Cloud\Core\Testing\TestHelpers::stub(Snapshot::class, [ $this->connection->reveal(), self::PROJECT, self::SNAPSHOT, diff --git a/tests/snippets/PubSub/SubscriptionTest.php b/tests/snippets/PubSub/SubscriptionTest.php index df1f106502e0..8a641ef8d509 100644 --- a/tests/snippets/PubSub/SubscriptionTest.php +++ b/tests/snippets/PubSub/SubscriptionTest.php @@ -40,7 +40,7 @@ class SubscriptionTest extends SnippetTestCase public function setUp() { $this->connection = $this->prophesize(ConnectionInterface::class); - $this->subscription = \Google\Cloud\Core\Testing\Functions::stub(Subscription::class, [ + $this->subscription = \Google\Cloud\Core\Testing\TestHelpers::stub(Subscription::class, [ $this->connection->reveal(), 'foo', self::SUBSCRIPTION, @@ -48,7 +48,7 @@ public function setUp() false ]); - $this->pubsub = \Google\Cloud\Core\Testing\Functions::stub(PubSubClient::class, [['transport' => 'rest']]); + $this->pubsub = \Google\Cloud\Core\Testing\TestHelpers::stub(PubSubClient::class, [['transport' => 'rest']]); $this->pubsub->___setProperty('connection', $this->connection->reveal()); } diff --git a/tests/snippets/PubSub/TopicTest.php b/tests/snippets/PubSub/TopicTest.php index 8c8beb8f7f6d..1aa0efb08d3e 100644 --- a/tests/snippets/PubSub/TopicTest.php +++ b/tests/snippets/PubSub/TopicTest.php @@ -42,8 +42,8 @@ class TopicTest extends SnippetTestCase public function setUp() { $this->connection = $this->prophesize(ConnectionInterface::class); - $this->pubsub = \Google\Cloud\Core\Testing\Functions::stub(PubSubClient::class); - $this->topic = \Google\Cloud\Core\Testing\Functions::stub(Topic::class, [ + $this->pubsub = \Google\Cloud\Core\Testing\TestHelpers::stub(PubSubClient::class); + $this->topic = \Google\Cloud\Core\Testing\TestHelpers::stub(Topic::class, [ $this->connection->reveal(), 'my-awesome-project', self::TOPIC, diff --git a/tests/snippets/Spanner/DatabaseTest.php b/tests/snippets/Spanner/DatabaseTest.php index 726940bcf863..87a593faf34a 100644 --- a/tests/snippets/Spanner/DatabaseTest.php +++ b/tests/snippets/Spanner/DatabaseTest.php @@ -70,7 +70,7 @@ public function setUp() ->willReturn(null); $this->connection = $this->prophesize(ConnectionInterface::class); - $this->database = \Google\Cloud\Core\Testing\Functions::stub(Database::class, [ + $this->database = \Google\Cloud\Core\Testing\TestHelpers::stub(Database::class, [ $this->connection->reveal(), $instance->reveal(), $this->prophesize(LongRunningConnectionInterface::class)->reveal(), @@ -83,7 +83,7 @@ public function setUp() private function stubOperation() { - $operation = \Google\Cloud\Core\Testing\Functions::stub(Operation::class, [ + $operation = \Google\Cloud\Core\Testing\TestHelpers::stub(Operation::class, [ $this->connection->reveal(), false ]); diff --git a/tests/snippets/Spanner/InstanceConfigurationTest.php b/tests/snippets/Spanner/InstanceConfigurationTest.php index dbc7f4f594c0..7c51fb3b8dfe 100644 --- a/tests/snippets/Spanner/InstanceConfigurationTest.php +++ b/tests/snippets/Spanner/InstanceConfigurationTest.php @@ -43,7 +43,7 @@ public function setUp() $this->checkAndSkipGrpcTests(); $this->connection = $this->prophesize(ConnectionInterface::class); - $this->config = \Google\Cloud\Core\Testing\Functions::stub(InstanceConfiguration::class, [ + $this->config = \Google\Cloud\Core\Testing\TestHelpers::stub(InstanceConfiguration::class, [ $this->connection->reveal(), self::PROJECT, self::CONFIG diff --git a/tests/snippets/Spanner/InstanceTest.php b/tests/snippets/Spanner/InstanceTest.php index 8cbd9947bdcf..d0bed6006e47 100644 --- a/tests/snippets/Spanner/InstanceTest.php +++ b/tests/snippets/Spanner/InstanceTest.php @@ -51,7 +51,7 @@ public function setUp() $this->checkAndSkipGrpcTests(); $this->connection = $this->prophesize(ConnectionInterface::class); - $this->instance = \Google\Cloud\Core\Testing\Functions::stub(Instance::class, [ + $this->instance = \Google\Cloud\Core\Testing\TestHelpers::stub(Instance::class, [ $this->connection->reveal(), $this->prophesize(LongRunningConnectionInterface::class)->reveal(), [], diff --git a/tests/snippets/Spanner/SnapshotTest.php b/tests/snippets/Spanner/SnapshotTest.php index dc73c83c2d11..e3056c60922c 100644 --- a/tests/snippets/Spanner/SnapshotTest.php +++ b/tests/snippets/Spanner/SnapshotTest.php @@ -51,7 +51,7 @@ public function setUp() $operation = $this->prophesize(Operation::class); $session = $this->prophesize(Session::class); - $this->snapshot = \Google\Cloud\Core\Testing\Functions::stub(Snapshot::class, [ + $this->snapshot = \Google\Cloud\Core\Testing\TestHelpers::stub(Snapshot::class, [ $operation->reveal(), $session->reveal(), [ @@ -63,7 +63,7 @@ public function setUp() private function stubOperation($stub = null) { - $operation = \Google\Cloud\Core\Testing\Functions::stub(Operation::class, [ + $operation = \Google\Cloud\Core\Testing\TestHelpers::stub(Operation::class, [ $this->connection->reveal(), false ]); diff --git a/tests/snippets/Spanner/SpannerClientTest.php b/tests/snippets/Spanner/SpannerClientTest.php index 222a424139db..825c351b1580 100644 --- a/tests/snippets/Spanner/SpannerClientTest.php +++ b/tests/snippets/Spanner/SpannerClientTest.php @@ -55,7 +55,7 @@ public function setUp() $this->checkAndSkipGrpcTests(); $this->connection = $this->prophesize(ConnectionInterface::class); - $this->client = \Google\Cloud\Core\Testing\Functions::stub(SpannerClient::class); + $this->client = \Google\Cloud\Core\Testing\TestHelpers::stub(SpannerClient::class); $this->client->___setProperty('connection', $this->connection->reveal()); } diff --git a/tests/snippets/Spanner/TransactionTest.php b/tests/snippets/Spanner/TransactionTest.php index ef8ff5802971..611c23e30eb4 100644 --- a/tests/snippets/Spanner/TransactionTest.php +++ b/tests/snippets/Spanner/TransactionTest.php @@ -50,7 +50,7 @@ public function setUp() $operation = $this->prophesize(Operation::class); $session = $this->prophesize(Session::class); - $this->transaction = \Google\Cloud\Core\Testing\Functions::stub(Transaction::class, [ + $this->transaction = \Google\Cloud\Core\Testing\TestHelpers::stub(Transaction::class, [ $operation->reveal(), $session->reveal(), self::TRANSACTION @@ -59,7 +59,7 @@ public function setUp() private function stubOperation($stub = null) { - $operation = \Google\Cloud\Core\Testing\Functions::stub(Operation::class, [ + $operation = \Google\Cloud\Core\Testing\TestHelpers::stub(Operation::class, [ $this->connection->reveal(), false ]); diff --git a/tests/snippets/Speech/OperationTest.php b/tests/snippets/Speech/OperationTest.php index 1659c88a49b0..cdd0e115d15c 100644 --- a/tests/snippets/Speech/OperationTest.php +++ b/tests/snippets/Speech/OperationTest.php @@ -48,7 +48,7 @@ public function setUp() ]; $this->connection = $this->prophesize(ConnectionInterface::class); - $this->operation = \Google\Cloud\Core\Testing\Functions::stub(Operation::class, [ + $this->operation = \Google\Cloud\Core\Testing\TestHelpers::stub(Operation::class, [ $this->connection->reveal(), $this->opData['name'], $this->opData diff --git a/tests/snippets/Speech/SpeechClientTest.php b/tests/snippets/Speech/SpeechClientTest.php index 6191596fb6eb..09a5c6c2fb17 100644 --- a/tests/snippets/Speech/SpeechClientTest.php +++ b/tests/snippets/Speech/SpeechClientTest.php @@ -36,7 +36,7 @@ public function setUp() { $this->testFile = "'" . __DIR__ . '/../fixtures/Speech/demo.flac' . "'"; $this->connection = $this->prophesize(ConnectionInterface::class); - $this->client = \Google\Cloud\Core\Testing\Functions::stub(SpeechClient::class, [ + $this->client = \Google\Cloud\Core\Testing\TestHelpers::stub(SpeechClient::class, [ ['languageCode' => 'en-US'] ]); $this->client->___setProperty('connection', $this->connection->reveal()); diff --git a/tests/snippets/Storage/AclTest.php b/tests/snippets/Storage/AclTest.php index f4964486f27e..b0f78b957a9f 100644 --- a/tests/snippets/Storage/AclTest.php +++ b/tests/snippets/Storage/AclTest.php @@ -33,7 +33,7 @@ class AclTest extends SnippetTestCase public function setUp() { $this->connection = $this->prophesize(ConnectionInterface::class); - $this->acl = \Google\Cloud\Core\Testing\Functions::stub(Acl::class, [ + $this->acl = \Google\Cloud\Core\Testing\TestHelpers::stub(Acl::class, [ $this->connection->reveal(), 'bucketAccessControls', [] diff --git a/tests/snippets/Storage/BucketTest.php b/tests/snippets/Storage/BucketTest.php index a524e24dbaf2..0bc28de43ed1 100644 --- a/tests/snippets/Storage/BucketTest.php +++ b/tests/snippets/Storage/BucketTest.php @@ -51,7 +51,7 @@ public function setUp() $this->connection = $this->prophesize(Rest::class); $this->connection->projectId() ->willReturn(self::PROJECT_ID); - $this->bucket = \Google\Cloud\Core\Testing\Functions::stub(Bucket::class, [ + $this->bucket = \Google\Cloud\Core\Testing\TestHelpers::stub(Bucket::class, [ $this->connection->reveal(), self::BUCKET, [] diff --git a/tests/snippets/Storage/NotificationTest.php b/tests/snippets/Storage/NotificationTest.php index 51724a577910..c59f65201d1d 100644 --- a/tests/snippets/Storage/NotificationTest.php +++ b/tests/snippets/Storage/NotificationTest.php @@ -40,7 +40,7 @@ class NotificationTest extends SnippetTestCase public function setUp() { $this->connection = $this->prophesize(Rest::class); - $this->notification = \Google\Cloud\Core\Testing\Functions::stub(Notification::class, [ + $this->notification = \Google\Cloud\Core\Testing\TestHelpers::stub(Notification::class, [ $this->connection->reveal(), self::NOTIFICATION_ID, self::BUCKET diff --git a/tests/snippets/Storage/StorageClientTest.php b/tests/snippets/Storage/StorageClientTest.php index cda1abe606f5..0ebd2a2c6134 100644 --- a/tests/snippets/Storage/StorageClientTest.php +++ b/tests/snippets/Storage/StorageClientTest.php @@ -43,7 +43,7 @@ public function setUp() $this->connection = $this->prophesize(Rest::class); $this->connection->projectId() ->willReturn(self::PROJECT_ID); - $this->client = \Google\Cloud\Core\Testing\Functions::stub(StorageClient::class); + $this->client = \Google\Cloud\Core\Testing\TestHelpers::stub(StorageClient::class); $this->client->___setProperty('connection', $this->connection->reveal()); } diff --git a/tests/snippets/Storage/StorageObjectTest.php b/tests/snippets/Storage/StorageObjectTest.php index c61d82e0d580..cc0e222f721c 100644 --- a/tests/snippets/Storage/StorageObjectTest.php +++ b/tests/snippets/Storage/StorageObjectTest.php @@ -47,7 +47,7 @@ class StorageObjectTest extends SnippetTestCase public function setUp() { $this->connection = $this->prophesize(Rest::class); - $this->object = \Google\Cloud\Core\Testing\Functions::stub(StorageObject::class, [ + $this->object = \Google\Cloud\Core\Testing\TestHelpers::stub(StorageObject::class, [ $this->connection->reveal(), self::OBJECT, self::BUCKET diff --git a/tests/snippets/Trace/TraceClientTest.php b/tests/snippets/Trace/TraceClientTest.php index 29154a46be89..a18be1a08e5c 100644 --- a/tests/snippets/Trace/TraceClientTest.php +++ b/tests/snippets/Trace/TraceClientTest.php @@ -34,7 +34,7 @@ class TraceClientTest extends SnippetTestCase public function setUp() { $this->connection = $this->prophesize(ConnectionInterface::class); - $this->client = \Google\Cloud\Core\Testing\Functions::stub(TraceClient::class); + $this->client = \Google\Cloud\Core\Testing\TestHelpers::stub(TraceClient::class); $this->client->___setProperty('connection', $this->connection->reveal()); } diff --git a/tests/snippets/Translate/TranslateClientTest.php b/tests/snippets/Translate/TranslateClientTest.php index a1113c6d19ef..1e3f5fec2eea 100644 --- a/tests/snippets/Translate/TranslateClientTest.php +++ b/tests/snippets/Translate/TranslateClientTest.php @@ -33,7 +33,7 @@ class TranslateClientTest extends SnippetTestCase public function setUp() { $this->connection = $this->prophesize(ConnectionInterface::class); - $this->client = \Google\Cloud\Core\Testing\Functions::stub(TranslateClient::class); + $this->client = \Google\Cloud\Core\Testing\TestHelpers::stub(TranslateClient::class); $this->client->___setProperty('connection', $this->connection->reveal()); } diff --git a/tests/snippets/Vision/VisionClientTest.php b/tests/snippets/Vision/VisionClientTest.php index f3e310af1881..f8ba1148c05a 100644 --- a/tests/snippets/Vision/VisionClientTest.php +++ b/tests/snippets/Vision/VisionClientTest.php @@ -35,7 +35,7 @@ class VisionClientTest extends SnippetTestCase public function setUp() { $this->connection = $this->prophesize(ConnectionInterface::class); - $this->client = \Google\Cloud\Core\Testing\Functions::stub(VisionClient::class); + $this->client = \Google\Cloud\Core\Testing\TestHelpers::stub(VisionClient::class); $this->client->___setProperty('connection', $this->connection->reveal()); } diff --git a/tests/unit/BigQuery/BigQueryClientTest.php b/tests/unit/BigQuery/BigQueryClientTest.php index be7c2e88f7f4..9f6232d81b7b 100644 --- a/tests/unit/BigQuery/BigQueryClientTest.php +++ b/tests/unit/BigQuery/BigQueryClientTest.php @@ -47,7 +47,7 @@ class BigQueryClientTest extends TestCase public function setUp() { $this->connection = $this->prophesize(ConnectionInterface::class); - $this->client = \Google\Cloud\Core\Testing\Functions::stub(BigQueryClient::class, ['options' => ['projectId' => self::PROJECT_ID]]); + $this->client = \Google\Cloud\Core\Testing\TestHelpers::stub(BigQueryClient::class, ['options' => ['projectId' => self::PROJECT_ID]]); } public function testQueryConfig() diff --git a/tests/unit/BigQuery/JobConfigurationTraitTest.php b/tests/unit/BigQuery/JobConfigurationTraitTest.php index 8dd15373edda..f196596df764 100644 --- a/tests/unit/BigQuery/JobConfigurationTraitTest.php +++ b/tests/unit/BigQuery/JobConfigurationTraitTest.php @@ -33,7 +33,7 @@ class JobConfigurationTraitTest extends TestCase public function setUp() { - $this->trait = \Google\Cloud\Core\Testing\Functions::impl(JobConfigurationTrait::class); + $this->trait = \Google\Cloud\Core\Testing\TestHelpers::impl(JobConfigurationTrait::class); } public function testJobConfigurationProperties() diff --git a/tests/unit/BigQuery/JobWaitTraitTest.php b/tests/unit/BigQuery/JobWaitTraitTest.php index 74e62e341f58..cb98d736e201 100644 --- a/tests/unit/BigQuery/JobWaitTraitTest.php +++ b/tests/unit/BigQuery/JobWaitTraitTest.php @@ -31,7 +31,7 @@ class JobWaitTraitTest extends TestCase public function setUp() { - $this->trait = \Google\Cloud\Core\Testing\Functions::impl(JobWaitTrait::class); + $this->trait = \Google\Cloud\Core\Testing\TestHelpers::impl(JobWaitTrait::class); $this->job = $this->prophesize(Job::class)->reveal(); } diff --git a/tests/unit/Core/ClientTraitTest.php b/tests/unit/Core/ClientTraitTest.php index 964a6247f182..e527f2fe3d9e 100644 --- a/tests/unit/Core/ClientTraitTest.php +++ b/tests/unit/Core/ClientTraitTest.php @@ -33,9 +33,9 @@ class ClientTraitTest extends TestCase public function setUp() { - $this->impl = \Google\Cloud\Core\Testing\Functions::impl(ClientTrait::class); + $this->impl = \Google\Cloud\Core\Testing\TestHelpers::impl(ClientTrait::class); - $this->dependency = \Google\Cloud\Core\Testing\Functions::impl(ClientTraitStubGrpcDependencyChecks::class, [ + $this->dependency = \Google\Cloud\Core\Testing\TestHelpers::impl(ClientTraitStubGrpcDependencyChecks::class, [ 'dependencyStatus' ]); } @@ -266,7 +266,7 @@ public function testDetectProjectIdOnGce() $m = $this->prophesize(Metadata::class); $m->getProjectId()->willReturn($projectId)->shouldBeCalled(); - $trait = \Google\Cloud\Core\Testing\Functions::impl(ClientTraitStubOnGce::class, ['metadata']); + $trait = \Google\Cloud\Core\Testing\TestHelpers::impl(ClientTraitStubOnGce::class, ['metadata']); $trait->___setProperty('metadata', $m); $res = $trait->call('detectProjectId', [[]]); @@ -281,7 +281,7 @@ public function testDetectNumericProjectIdOnGce() $m = $this->prophesize(Metadata::class); $m->getNumericProjectId()->willReturn($projectId)->shouldBeCalled(); - $trait = \Google\Cloud\Core\Testing\Functions::impl(ClientTraitStubOnGce::class, ['metadata']); + $trait = \Google\Cloud\Core\Testing\TestHelpers::impl(ClientTraitStubOnGce::class, ['metadata']); $trait->___setProperty('metadata', $m); $res = $trait->call('detectProjectId', [['preferNumericProjectId' => true]]); @@ -299,7 +299,7 @@ public function testDetectProjectIdOnGceButOhNoThereStillIsntAProjectId() $m = $this->prophesize(Metadata::class); $m->getProjectId()->willReturn($projectId)->shouldBeCalled(); - $trait = \Google\Cloud\Core\Testing\Functions::impl(ClientTraitStubOnGce::class, ['metadata']); + $trait = \Google\Cloud\Core\Testing\TestHelpers::impl(ClientTraitStubOnGce::class, ['metadata']); $trait->___setProperty('metadata', $m); $res = $trait->call('detectProjectId', [[ @@ -317,7 +317,7 @@ public function testDetectProjectIdEmulator() $m = $this->prophesize(Metadata::class); $m->getProjectId()->willReturn(false)->shouldBeCalled(); - $trait = \Google\Cloud\Core\Testing\Functions::impl(ClientTraitStubOnGce::class, ['metadata']); + $trait = \Google\Cloud\Core\Testing\TestHelpers::impl(ClientTraitStubOnGce::class, ['metadata']); $trait->___setProperty('metadata', $m); $res = $trait->call('detectProjectId', [[ diff --git a/tests/unit/Core/ConcurrencyControlTraitTest.php b/tests/unit/Core/ConcurrencyControlTraitTest.php index c568f36a3aa9..bda7250178a5 100644 --- a/tests/unit/Core/ConcurrencyControlTraitTest.php +++ b/tests/unit/Core/ConcurrencyControlTraitTest.php @@ -31,7 +31,7 @@ class ConcurrencyControlTraitTest extends TestCase public function setUp() { - $this->trait = \Google\Cloud\Core\Testing\Functions::impl(ConcurrencyControlTrait::class); + $this->trait = \Google\Cloud\Core\Testing\TestHelpers::impl(ConcurrencyControlTrait::class); } public function testApplyEtagHeader() diff --git a/tests/unit/Core/EmulatorTraitTest.php b/tests/unit/Core/EmulatorTraitTest.php index 6ed246a3d9c5..e1efdadcbb58 100644 --- a/tests/unit/Core/EmulatorTraitTest.php +++ b/tests/unit/Core/EmulatorTraitTest.php @@ -30,7 +30,7 @@ class EmulatorTraitTest extends TestCase public function setUp() { - $this->impl = \Google\Cloud\Core\Testing\Functions::impl(EmulatorTrait::class); + $this->impl = \Google\Cloud\Core\Testing\TestHelpers::impl(EmulatorTrait::class); } public function testEmulatorBaseUri() diff --git a/tests/unit/Core/Fixtures.php b/tests/unit/Core/Fixtures.php index c84c45d05c2a..aa888bb3750d 100644 --- a/tests/unit/Core/Fixtures.php +++ b/tests/unit/Core/Fixtures.php @@ -1,6 +1,6 @@ checkAndSkipGrpcTests(); - $this->implementation = \Google\Cloud\Core\Testing\Functions::impl(GrpcTrait::class); + $this->implementation = \Google\Cloud\Core\Testing\TestHelpers::impl(GrpcTrait::class); $this->requestWrapper = $this->prophesize(GrpcRequestWrapper::class); } diff --git a/tests/unit/Core/JsonTraitTest.php b/tests/unit/Core/JsonTraitTest.php index 437ee95f9eb2..845e73130ac1 100644 --- a/tests/unit/Core/JsonTraitTest.php +++ b/tests/unit/Core/JsonTraitTest.php @@ -29,7 +29,7 @@ class JsonTraitTest extends TestCase public function setUp() { - $this->implementation = \Google\Cloud\Core\Testing\Functions::impl(JsonTrait::class); + $this->implementation = \Google\Cloud\Core\Testing\TestHelpers::impl(JsonTrait::class); } public function testJsonEncode() diff --git a/tests/unit/Datastore/Fixtures.php b/tests/unit/Datastore/Fixtures.php index ab8c4ce0035d..348bc4d6155b 100644 --- a/tests/unit/Datastore/Fixtures.php +++ b/tests/unit/Datastore/Fixtures.php @@ -1,6 +1,6 @@ connection = $this->prophesize(ConnectionInterface::class); - $this->collection = \Google\Cloud\Core\Testing\Functions::stub(CollectionReference::class, [ + $this->collection = \Google\Cloud\Core\Testing\TestHelpers::stub(CollectionReference::class, [ $this->connection->reveal(), new ValueMapper($this->connection->reveal(), false), self::NAME @@ -130,7 +130,7 @@ public function testRandomNames(DocumentReference $doc) public function randomNames() { $connection = $this->prophesize(ConnectionInterface::class); - $collection = \Google\Cloud\Core\Testing\Functions::stub(CollectionReference::class, [ + $collection = \Google\Cloud\Core\Testing\TestHelpers::stub(CollectionReference::class, [ $connection->reveal(), new ValueMapper($connection->reveal(), false), self::NAME diff --git a/tests/unit/Firestore/DocumentReferenceTest.php b/tests/unit/Firestore/DocumentReferenceTest.php index df189390195c..766620b9e459 100644 --- a/tests/unit/Firestore/DocumentReferenceTest.php +++ b/tests/unit/Firestore/DocumentReferenceTest.php @@ -46,7 +46,7 @@ public function setUp() $this->connection = $this->prophesize(ConnectionInterface::class); $valueMapper = new ValueMapper($this->connection->reveal(), false); - $this->document = \Google\Cloud\Core\Testing\Functions::stub(DocumentReference::class, [ + $this->document = \Google\Cloud\Core\Testing\TestHelpers::stub(DocumentReference::class, [ $this->connection->reveal(), $valueMapper, new CollectionReference($this->connection->reveal(), $valueMapper, self::COLLECTION), diff --git a/tests/unit/Firestore/DocumentSnapshotTest.php b/tests/unit/Firestore/DocumentSnapshotTest.php index 0b18b306be2d..6f39a7ac2e01 100644 --- a/tests/unit/Firestore/DocumentSnapshotTest.php +++ b/tests/unit/Firestore/DocumentSnapshotTest.php @@ -43,7 +43,7 @@ public function setUp() $ref->id()->willReturn(self::ID); $ref->path()->willReturn('a/b'); - $this->snapshot = \Google\Cloud\Core\Testing\Functions::stub(DocumentSnapshot::class, [ + $this->snapshot = \Google\Cloud\Core\Testing\TestHelpers::stub(DocumentSnapshot::class, [ $ref->reveal(), new ValueMapper($this->prophesize(ConnectionInterface::class)->reveal(), false), [], [], true diff --git a/tests/unit/Firestore/FirestoreClientTest.php b/tests/unit/Firestore/FirestoreClientTest.php index 7289756d33ba..1ba7f5e561dd 100644 --- a/tests/unit/Firestore/FirestoreClientTest.php +++ b/tests/unit/Firestore/FirestoreClientTest.php @@ -51,7 +51,7 @@ public function setUp() $this->checkAndSkipGrpcTests(); $this->connection = $this->prophesize(ConnectionInterface::class); - $this->client = \Google\Cloud\Core\Testing\Functions::stub(FirestoreClient::class); + $this->client = \Google\Cloud\Core\Testing\TestHelpers::stub(FirestoreClient::class); } public function testBatch() diff --git a/tests/unit/Firestore/PathTraitTest.php b/tests/unit/Firestore/PathTraitTest.php index a5cf0a754012..2851fd4cb957 100644 --- a/tests/unit/Firestore/PathTraitTest.php +++ b/tests/unit/Firestore/PathTraitTest.php @@ -36,7 +36,7 @@ class PathTraitTest extends TestCase public function setUp() { - $this->impl = \Google\Cloud\Core\Testing\Functions::impl(PathTrait::class); + $this->impl = \Google\Cloud\Core\Testing\TestHelpers::impl(PathTrait::class); } public function testFullName() diff --git a/tests/unit/Firestore/QuerySnapshotTest.php b/tests/unit/Firestore/QuerySnapshotTest.php index f27f551ceec5..e9f2c4984c15 100644 --- a/tests/unit/Firestore/QuerySnapshotTest.php +++ b/tests/unit/Firestore/QuerySnapshotTest.php @@ -37,7 +37,7 @@ class QuerySnapshotTest extends TestCase public function setUp() { $this->connection = $this->prophesize(ConnectionInterface::class); - $this->snapshot = \Google\Cloud\Core\Testing\Functions::stub(QuerySnapshot::class, [ + $this->snapshot = \Google\Cloud\Core\Testing\TestHelpers::stub(QuerySnapshot::class, [ $this->prophesize(Query::class)->reveal(), [] ], ['rows']); diff --git a/tests/unit/Firestore/QueryTest.php b/tests/unit/Firestore/QueryTest.php index 0ce5b44e6557..ed759fb40642 100644 --- a/tests/unit/Firestore/QueryTest.php +++ b/tests/unit/Firestore/QueryTest.php @@ -51,7 +51,7 @@ class QueryTest extends TestCase public function setUp() { $this->connection = $this->prophesize(ConnectionInterface::class); - $this->query = \Google\Cloud\Core\Testing\Functions::stub(Query::class, [ + $this->query = \Google\Cloud\Core\Testing\TestHelpers::stub(Query::class, [ $this->connection->reveal(), new ValueMapper($this->connection->reveal(), false), self::PARENT, diff --git a/tests/unit/Firestore/SnapshotTraitTest.php b/tests/unit/Firestore/SnapshotTraitTest.php index 9dc0311f0af4..a6008badd652 100644 --- a/tests/unit/Firestore/SnapshotTraitTest.php +++ b/tests/unit/Firestore/SnapshotTraitTest.php @@ -43,7 +43,7 @@ class SnapshotTraitTest extends TestCase public function setUp() { $this->connection = $this->prophesize(ConnectionInterface::class); - $this->impl = \Google\Cloud\Core\Testing\Functions::impl(SnapshotTrait::class); + $this->impl = \Google\Cloud\Core\Testing\TestHelpers::impl(SnapshotTrait::class); $this->valueMapper = new ValueMapper($this->connection->reveal(), false); } diff --git a/tests/unit/Firestore/TransactionTest.php b/tests/unit/Firestore/TransactionTest.php index 2241fdbd9ffb..1ba97daff306 100644 --- a/tests/unit/Firestore/TransactionTest.php +++ b/tests/unit/Firestore/TransactionTest.php @@ -48,7 +48,7 @@ public function setUp() { $this->connection = $this->prophesize(ConnectionInterface::class); $this->valueMapper = new ValueMapper($this->connection->reveal(), false); - $this->transaction = \Google\Cloud\Core\Testing\Functions::stub(Transaction::class, [ + $this->transaction = \Google\Cloud\Core\Testing\TestHelpers::stub(Transaction::class, [ $this->connection->reveal(), $this->valueMapper, sprintf('projects/%s/databases/%s', self::PROJECT, self::DATABASE), diff --git a/tests/unit/Firestore/ValueMapperTest.php b/tests/unit/Firestore/ValueMapperTest.php index a0da18287bf3..7b073de4a0f0 100644 --- a/tests/unit/Firestore/ValueMapperTest.php +++ b/tests/unit/Firestore/ValueMapperTest.php @@ -43,7 +43,7 @@ class ValueMapperTest extends TestCase public function setUp() { $this->connection = $this->prophesize(ConnectionInterface::class); - $this->mapper = \Google\Cloud\Core\Testing\Functions::stub(ValueMapper::class, [ + $this->mapper = \Google\Cloud\Core\Testing\TestHelpers::stub(ValueMapper::class, [ $this->connection->reveal(), false ], ['connection', 'returnInt64AsObject']); diff --git a/tests/unit/Firestore/WriteBatchTest.php b/tests/unit/Firestore/WriteBatchTest.php index 0bb29470a506..f182678997d0 100644 --- a/tests/unit/Firestore/WriteBatchTest.php +++ b/tests/unit/Firestore/WriteBatchTest.php @@ -45,7 +45,7 @@ class WriteBatchTest extends TestCase public function setUp() { $this->connection = $this->prophesize(ConnectionInterface::class); - $this->batch = \Google\Cloud\Core\Testing\Functions::stub(WriteBatch::class, [ + $this->batch = \Google\Cloud\Core\Testing\TestHelpers::stub(WriteBatch::class, [ $this->connection->reveal(), new ValueMapper($this->connection->reveal(), false), sprintf('projects/%s/databases/%s', self::PROJECT, self::DATABASE) diff --git a/tests/unit/Spanner/Connection/IamDatabaseTest.php b/tests/unit/Spanner/Connection/IamDatabaseTest.php index 2b572ea65648..35015a349ba4 100644 --- a/tests/unit/Spanner/Connection/IamDatabaseTest.php +++ b/tests/unit/Spanner/Connection/IamDatabaseTest.php @@ -36,7 +36,7 @@ public function setUp() { $this->connection = $this->prophesize(ConnectionInterface::class); - $this->iam = \Google\Cloud\Core\Testing\Functions::stub(IamDatabase::class, [$this->connection->reveal()]); + $this->iam = \Google\Cloud\Core\Testing\TestHelpers::stub(IamDatabase::class, [$this->connection->reveal()]); } /** diff --git a/tests/unit/Spanner/Connection/IamInstanceTest.php b/tests/unit/Spanner/Connection/IamInstanceTest.php index afdf0083a61a..a259494ebb51 100644 --- a/tests/unit/Spanner/Connection/IamInstanceTest.php +++ b/tests/unit/Spanner/Connection/IamInstanceTest.php @@ -36,7 +36,7 @@ public function setUp() { $this->connection = $this->prophesize(ConnectionInterface::class); - $this->iam = \Google\Cloud\Core\Testing\Functions::stub(IamInstance::class, [$this->connection->reveal()]); + $this->iam = \Google\Cloud\Core\Testing\TestHelpers::stub(IamInstance::class, [$this->connection->reveal()]); } /** diff --git a/tests/unit/Spanner/Connection/LongRunningConnectionTest.php b/tests/unit/Spanner/Connection/LongRunningConnectionTest.php index f21ae632d60b..123ad8b5c3db 100644 --- a/tests/unit/Spanner/Connection/LongRunningConnectionTest.php +++ b/tests/unit/Spanner/Connection/LongRunningConnectionTest.php @@ -33,7 +33,7 @@ class LongRunningConnectionTest extends TestCase public function setUp() { $this->connection = $this->prophesize(ConnectionInterface::class); - $this->lro = \Google\Cloud\Core\Testing\Functions::stub(LongRunningConnection::class, [ + $this->lro = \Google\Cloud\Core\Testing\TestHelpers::stub(LongRunningConnection::class, [ $this->connection->reveal() ]); } diff --git a/tests/unit/Spanner/DatabaseTest.php b/tests/unit/Spanner/DatabaseTest.php index 4e501fe46416..cfed4dd57f0d 100644 --- a/tests/unit/Spanner/DatabaseTest.php +++ b/tests/unit/Spanner/DatabaseTest.php @@ -99,7 +99,7 @@ public function setUp() 'connection', 'operation' ]; - $this->database = \Google\Cloud\Core\Testing\Functions::stub(Database::class, $args, $props); + $this->database = \Google\Cloud\Core\Testing\TestHelpers::stub(Database::class, $args, $props); } public function testName() diff --git a/tests/unit/Spanner/Fixtures.php b/tests/unit/Spanner/Fixtures.php index 9cdcb23a5f2b..6e177c2782d6 100644 --- a/tests/unit/Spanner/Fixtures.php +++ b/tests/unit/Spanner/Fixtures.php @@ -1,6 +1,6 @@ checkAndSkipGrpcTests(); $this->connection = $this->prophesize(ConnectionInterface::class); - $this->configuration = \Google\Cloud\Core\Testing\Functions::stub(InstanceConfiguration::class, [ + $this->configuration = \Google\Cloud\Core\Testing\TestHelpers::stub(InstanceConfiguration::class, [ $this->connection->reveal(), self::PROJECT_ID, self::NAME @@ -62,7 +62,7 @@ public function testInfo() $this->configuration->___setProperty('connection', $this->connection->reveal()); $info = ['foo' => 'bar']; - $config = \Google\Cloud\Core\Testing\Functions::stub(InstanceConfiguration::class, [ + $config = \Google\Cloud\Core\Testing\TestHelpers::stub(InstanceConfiguration::class, [ $this->connection->reveal(), self::PROJECT_ID, self::NAME, diff --git a/tests/unit/Spanner/InstanceTest.php b/tests/unit/Spanner/InstanceTest.php index 4cbfc308a45a..5215c7ee1db7 100644 --- a/tests/unit/Spanner/InstanceTest.php +++ b/tests/unit/Spanner/InstanceTest.php @@ -52,7 +52,7 @@ public function setUp() $this->checkAndSkipGrpcTests(); $this->connection = $this->prophesize(ConnectionInterface::class); - $this->instance = \Google\Cloud\Core\Testing\Functions::stub(Instance::class, [ + $this->instance = \Google\Cloud\Core\Testing\TestHelpers::stub(Instance::class, [ $this->connection->reveal(), $this->prophesize(LongRunningConnectionInterface::class)->reveal(), [], diff --git a/tests/unit/Spanner/OperationTest.php b/tests/unit/Spanner/OperationTest.php index dba40960a35a..097c8852b39f 100644 --- a/tests/unit/Spanner/OperationTest.php +++ b/tests/unit/Spanner/OperationTest.php @@ -55,7 +55,7 @@ public function setUp() $this->connection = $this->prophesize(ConnectionInterface::class); - $this->operation = \Google\Cloud\Core\Testing\Functions::stub(Operation::class, [ + $this->operation = \Google\Cloud\Core\Testing\TestHelpers::stub(Operation::class, [ $this->connection->reveal(), false ]); diff --git a/tests/unit/Spanner/SpannerClientTest.php b/tests/unit/Spanner/SpannerClientTest.php index b47d8d7a0e49..47b827813d67 100644 --- a/tests/unit/Spanner/SpannerClientTest.php +++ b/tests/unit/Spanner/SpannerClientTest.php @@ -56,7 +56,7 @@ public function setUp() $this->checkAndSkipGrpcTests(); $this->connection = $this->prophesize(ConnectionInterface::class); - $this->client = \Google\Cloud\Core\Testing\Functions::stub(SpannerClient::class, [ + $this->client = \Google\Cloud\Core\Testing\TestHelpers::stub(SpannerClient::class, [ ['projectId' => self::PROJECT] ]); } diff --git a/tests/unit/Spanner/TransactionTest.php b/tests/unit/Spanner/TransactionTest.php index 197e05d30c3a..23f10ea94888 100644 --- a/tests/unit/Spanner/TransactionTest.php +++ b/tests/unit/Spanner/TransactionTest.php @@ -80,10 +80,10 @@ public function setUp() 'operation', 'readTimestamp', 'state' ]; - $this->transaction = \Google\Cloud\Core\Testing\Functions::stub(Transaction::class, $args, $props); + $this->transaction = \Google\Cloud\Core\Testing\TestHelpers::stub(Transaction::class, $args, $props); unset($args[2]); - $this->singleUseTransaction = \Google\Cloud\Core\Testing\Functions::stub(Transaction::class, $args, $props); + $this->singleUseTransaction = \Google\Cloud\Core\Testing\TestHelpers::stub(Transaction::class, $args, $props); } public function testInsert() @@ -299,7 +299,7 @@ public function testIsRetryTrue() true ]; - $transaction = \Google\Cloud\Core\Testing\Functions::stub(Transaction::class, $args); + $transaction = \Google\Cloud\Core\Testing\TestHelpers::stub(Transaction::class, $args); $this->assertTrue($transaction->isRetry()); } diff --git a/tests/unit/Spanner/TransactionTypeTest.php b/tests/unit/Spanner/TransactionTypeTest.php index dd35fdfcb479..8e520e9603ae 100644 --- a/tests/unit/Spanner/TransactionTypeTest.php +++ b/tests/unit/Spanner/TransactionTypeTest.php @@ -731,7 +731,7 @@ private function database(ConnectionInterface $connection) $instance = $this->prophesize(Instance::class); $instance->name()->willReturn(InstanceAdminClient::instanceName(self::PROJECT, self::INSTANCE)); - $database = \Google\Cloud\Core\Testing\Functions::stub(Database::class, [ + $database = \Google\Cloud\Core\Testing\TestHelpers::stub(Database::class, [ $connection, $instance->reveal(), $this->prophesize(LongRunningConnectionInterface::class)->reveal(), diff --git a/tests/unit/Storage/EncryptionTraitTest.php b/tests/unit/Storage/EncryptionTraitTest.php index 292a1acc3b8f..4a70dbea3213 100644 --- a/tests/unit/Storage/EncryptionTraitTest.php +++ b/tests/unit/Storage/EncryptionTraitTest.php @@ -32,7 +32,7 @@ class EncryptionTraitTest extends TestCase public function setUp() { - $this->implementation = \Google\Cloud\Core\Testing\Functions::impl(EncryptionTrait::class); + $this->implementation = \Google\Cloud\Core\Testing\TestHelpers::impl(EncryptionTrait::class); } public function testSignString() diff --git a/tests/unit/Storage/RequesterPaysTest.php b/tests/unit/Storage/RequesterPaysTest.php index 595c8947e427..2561916bcc70 100644 --- a/tests/unit/Storage/RequesterPaysTest.php +++ b/tests/unit/Storage/RequesterPaysTest.php @@ -43,7 +43,7 @@ class RequesterPaysTest extends TestCase public function setUp() { $this->connection = new Rest(['projectId' => self::PROJECT]); - $this->client = \Google\Cloud\Core\Testing\Functions::stub(StorageClient::class); + $this->client = \Google\Cloud\Core\Testing\TestHelpers::stub(StorageClient::class); } /** diff --git a/tests/unit/Storage/StorageClientTest.php b/tests/unit/Storage/StorageClientTest.php index 049da19f61d9..c492adeef3c2 100644 --- a/tests/unit/Storage/StorageClientTest.php +++ b/tests/unit/Storage/StorageClientTest.php @@ -38,7 +38,7 @@ class StorageClientTest extends TestCase public function setUp() { $this->connection = $this->prophesize(Rest::class); - $this->client = \Google\Cloud\Core\Testing\Functions::stub(StorageClient::class, [['projectId' => self::PROJECT]]); + $this->client = \Google\Cloud\Core\Testing\TestHelpers::stub(StorageClient::class, [['projectId' => self::PROJECT]]); } public function testGetBucket() diff --git a/tests/unit/Vision/Fixtures.php b/tests/unit/Vision/Fixtures.php index a200eabd2844..2b2899f65fb4 100644 --- a/tests/unit/Vision/Fixtures.php +++ b/tests/unit/Vision/Fixtures.php @@ -1,6 +1,6 @@ Date: Wed, 31 Jan 2018 12:55:07 -0800 Subject: [PATCH 34/36] Exclude Core/Testing from unit tests --- phpunit.xml.dist | 1 + 1 file changed, 1 insertion(+) diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 6b8f7126ba61..443b0c12f1e3 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -12,6 +12,7 @@ src/*/V[!a-zA-Z]* src/*/*/V[!a-zA-Z]* src/*/*/*/V[!a-zA-Z]* + src/Core/Testing From a12ce0436d6f56f0b7e12708a4eb8ac309e65bde Mon Sep 17 00:00:00 2001 From: Michael Bausor Date: Wed, 31 Jan 2018 12:56:00 -0800 Subject: [PATCH 35/36] Remove extra space --- tests/unit/Core/Fixtures.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unit/Core/Fixtures.php b/tests/unit/Core/Fixtures.php index aa888bb3750d..93f278230d0d 100644 --- a/tests/unit/Core/Fixtures.php +++ b/tests/unit/Core/Fixtures.php @@ -24,7 +24,7 @@ public static function JSON_KEY_FIXTURE() return __DIR__ . '/fixtures/json-key-fixture.json'; } - public static function SERVICE_FIXTURE() + public static function SERVICE_FIXTURE() { return __DIR__ . '/fixtures/service-fixture.json'; } From 8200a4b18f67a9cb08bca9527cf8f8f081451e68 Mon Sep 17 00:00:00 2001 From: Michael Bausor Date: Wed, 31 Jan 2018 13:28:37 -0800 Subject: [PATCH 36/36] Rename Functions to TestHelpers --- tests/snippets/Core/Iam/IamTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/snippets/Core/Iam/IamTest.php b/tests/snippets/Core/Iam/IamTest.php index 151c028f7f0a..8bdb5130e530 100644 --- a/tests/snippets/Core/Iam/IamTest.php +++ b/tests/snippets/Core/Iam/IamTest.php @@ -17,10 +17,10 @@ namespace Google\Cloud\Tests\Snippets\Core\Iam; -use Google\Cloud\Core\Testing\TestHelpers; use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Core\Iam\Iam; use Google\Cloud\Core\Iam\IamConnectionInterface; +use Google\Cloud\Core\Testing\TestHelpers; use Google\Cloud\PubSub\PubSubClient; use Prophecy\Argument; @@ -40,7 +40,7 @@ public function setUp() $this->resource = 'testObject'; $this->connection = $this->prophesize(IamConnectionInterface::class); - $this->iam = Functions::stub(Iam::class, [$this->connection->reveal(), $this->resource]); + $this->iam = TestHelpers::stub(Iam::class, [$this->connection->reveal(), $this->resource]); $this->iam->___setProperty('connection', $this->connection->reveal()); }