From c2d2ccf6cf2448f0ce19f05d0abcf5025861aa65 Mon Sep 17 00:00:00 2001 From: John Pedrie Date: Wed, 10 Jun 2020 09:26:59 -0400 Subject: [PATCH] fix: use prophecy for php generated unit tests --- src/main/resources/com/google/api/codegen/php/test.snip | 4 +--- .../api/codegen/gapic/testdata/php/php_library.baseline | 8 ++------ .../codegen/gapic/testdata/php/php_longrunning.baseline | 4 +--- .../gapic/testdata/php/php_no_path_templates.baseline | 4 +--- .../protoannotations/testdata/php_library.baseline | 8 ++------ .../php_library_with_grpc_service_config.baseline | 8 ++------ 6 files changed, 9 insertions(+), 27 deletions(-) diff --git a/src/main/resources/com/google/api/codegen/php/test.snip b/src/main/resources/com/google/api/codegen/php/test.snip index 805b24d587..5f5de62d37 100644 --- a/src/main/resources/com/google/api/codegen/php/test.snip +++ b/src/main/resources/com/google/api/codegen/php/test.snip @@ -32,9 +32,7 @@ */ private function createCredentials() { - return $this->getMockBuilder(CredentialsWrapper::class) - ->disableOriginalConstructor() - ->getMock(); + return $this->prophesize(CredentialsWrapper::class)->reveal(); } /** diff --git a/src/test/java/com/google/api/codegen/gapic/testdata/php/php_library.baseline b/src/test/java/com/google/api/codegen/gapic/testdata/php/php_library.baseline index 28c7cfa318..0875d7ec78 100644 --- a/src/test/java/com/google/api/codegen/gapic/testdata/php/php_library.baseline +++ b/src/test/java/com/google/api/codegen/gapic/testdata/php/php_library.baseline @@ -5929,9 +5929,7 @@ class LibraryServiceClientTest extends GeneratedTest */ private function createCredentials() { - return $this->getMockBuilder(CredentialsWrapper::class) - ->disableOriginalConstructor() - ->getMock(); + return $this->prophesize(CredentialsWrapper::class)->reveal(); } /** @@ -8868,9 +8866,7 @@ class MyProtoClientTest extends GeneratedTest */ private function createCredentials() { - return $this->getMockBuilder(CredentialsWrapper::class) - ->disableOriginalConstructor() - ->getMock(); + return $this->prophesize(CredentialsWrapper::class)->reveal(); } /** diff --git a/src/test/java/com/google/api/codegen/gapic/testdata/php/php_longrunning.baseline b/src/test/java/com/google/api/codegen/gapic/testdata/php/php_longrunning.baseline index ee68b02cf2..b2d9c18517 100644 --- a/src/test/java/com/google/api/codegen/gapic/testdata/php/php_longrunning.baseline +++ b/src/test/java/com/google/api/codegen/gapic/testdata/php/php_longrunning.baseline @@ -755,9 +755,7 @@ class OperationsClientTest extends GeneratedTest */ private function createCredentials() { - return $this->getMockBuilder(CredentialsWrapper::class) - ->disableOriginalConstructor() - ->getMock(); + return $this->prophesize(CredentialsWrapper::class)->reveal(); } /** diff --git a/src/test/java/com/google/api/codegen/gapic/testdata/php/php_no_path_templates.baseline b/src/test/java/com/google/api/codegen/gapic/testdata/php/php_no_path_templates.baseline index ae0e953913..c8e107b951 100644 --- a/src/test/java/com/google/api/codegen/gapic/testdata/php/php_no_path_templates.baseline +++ b/src/test/java/com/google/api/codegen/gapic/testdata/php/php_no_path_templates.baseline @@ -396,9 +396,7 @@ class NoTemplatesApiServiceClientTest extends GeneratedTest */ private function createCredentials() { - return $this->getMockBuilder(CredentialsWrapper::class) - ->disableOriginalConstructor() - ->getMock(); + return $this->prophesize(CredentialsWrapper::class)->reveal(); } /** diff --git a/src/test/java/com/google/api/codegen/protoannotations/testdata/php_library.baseline b/src/test/java/com/google/api/codegen/protoannotations/testdata/php_library.baseline index 98d4e9088b..a370e7de4a 100644 --- a/src/test/java/com/google/api/codegen/protoannotations/testdata/php_library.baseline +++ b/src/test/java/com/google/api/codegen/protoannotations/testdata/php_library.baseline @@ -6956,9 +6956,7 @@ class LibraryServiceClientTest extends GeneratedTest */ private function createCredentials() { - return $this->getMockBuilder(CredentialsWrapper::class) - ->disableOriginalConstructor() - ->getMock(); + return $this->prophesize(CredentialsWrapper::class)->reveal(); } /** @@ -10252,9 +10250,7 @@ class MyProtoClientTest extends GeneratedTest */ private function createCredentials() { - return $this->getMockBuilder(CredentialsWrapper::class) - ->disableOriginalConstructor() - ->getMock(); + return $this->prophesize(CredentialsWrapper::class)->reveal(); } /** diff --git a/src/test/java/com/google/api/codegen/protoannotations/testdata/php_library_with_grpc_service_config.baseline b/src/test/java/com/google/api/codegen/protoannotations/testdata/php_library_with_grpc_service_config.baseline index 165160b9f0..8641f3fe1b 100644 --- a/src/test/java/com/google/api/codegen/protoannotations/testdata/php_library_with_grpc_service_config.baseline +++ b/src/test/java/com/google/api/codegen/protoannotations/testdata/php_library_with_grpc_service_config.baseline @@ -6981,9 +6981,7 @@ class LibraryServiceClientTest extends GeneratedTest */ private function createCredentials() { - return $this->getMockBuilder(CredentialsWrapper::class) - ->disableOriginalConstructor() - ->getMock(); + return $this->prophesize(CredentialsWrapper::class)->reveal(); } /** @@ -10277,9 +10275,7 @@ class MyProtoClientTest extends GeneratedTest */ private function createCredentials() { - return $this->getMockBuilder(CredentialsWrapper::class) - ->disableOriginalConstructor() - ->getMock(); + return $this->prophesize(CredentialsWrapper::class)->reveal(); } /**