From 34f83311f1ff543075b1b5faec7b0953942d0410 Mon Sep 17 00:00:00 2001 From: JoeWang1127 Date: Fri, 21 Aug 2026 15:30:56 +0000 Subject: [PATCH 1/2] chore: updatre owlbot.py --- Workflows/owlbot.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Workflows/owlbot.py b/Workflows/owlbot.py index 7acb0f50ece0..f3c11a515c54 100644 --- a/Workflows/owlbot.py +++ b/Workflows/owlbot.py @@ -101,3 +101,17 @@ r"(.{0,})\]\((/.{0,})\)", r"\1](https://cloud.google.com\2)" ) + +# format generated clients +subprocess.run([ + 'npm', + 'exec', + '--yes', + '--package=@prettier/plugin-php@^0.19', + '--', + 'prettier', + '**/Client/*', + '--write', + '--parser=php', + '--single-quote', + '--print-width=120']) From b959983f1889a7ae3ed158c20af21dd36f84ef39 Mon Sep 17 00:00:00 2001 From: JoeWang1127 Date: Fri, 21 Aug 2026 15:34:28 +0000 Subject: [PATCH 2/2] format --- .../Executions/V1/Client/ExecutionsClient.php | 4 +- Workflows/src/V1/Client/WorkflowsClient.php | 24 ++- .../V1/Client/ExecutionsClientTest.php | 97 +++++----- .../Unit/V1/Client/WorkflowsClientTest.php | 166 ++++++++++-------- 4 files changed, 154 insertions(+), 137 deletions(-) diff --git a/Workflows/src/Executions/V1/Client/ExecutionsClient.php b/Workflows/src/Executions/V1/Client/ExecutionsClient.php index c99b9a8a85c7..6ae9c04336e7 100644 --- a/Workflows/src/Executions/V1/Client/ExecutionsClient.php +++ b/Workflows/src/Executions/V1/Client/ExecutionsClient.php @@ -88,9 +88,7 @@ final class ExecutionsClient * * @internal */ - public static $serviceScopes = [ - 'https://www.googleapis.com/auth/cloud-platform', - ]; + public static $serviceScopes = ['https://www.googleapis.com/auth/cloud-platform']; private static function getClientDefaults() { diff --git a/Workflows/src/V1/Client/WorkflowsClient.php b/Workflows/src/V1/Client/WorkflowsClient.php index eaa5dba80e65..688b54b230ae 100644 --- a/Workflows/src/V1/Client/WorkflowsClient.php +++ b/Workflows/src/V1/Client/WorkflowsClient.php @@ -101,9 +101,7 @@ final class WorkflowsClient * * @internal */ - public static $serviceScopes = [ - 'https://www.googleapis.com/auth/cloud-platform', - ]; + public static $serviceScopes = ['https://www.googleapis.com/auth/cloud-platform']; private $operationsClient; @@ -149,7 +147,10 @@ public function getOperationsClient() */ public function resumeOperation($operationName, $methodName = null) { - $options = $methodName && isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : []; + $options = + $methodName && isset($this->descriptors[$methodName]['longRunning']) + ? $this->descriptors[$methodName]['longRunning'] + : []; $operation = new OperationResponse($operationName, $this->getOperationsClient(), $options); $operation->reload(); return $operation; @@ -207,8 +208,13 @@ public static function cryptoKeyName(string $project, string $location, string $ * * @return string The formatted crypto_key_version resource. */ - public static function cryptoKeyVersionName(string $project, string $location, string $keyRing, string $cryptoKey, string $cryptoKeyVersion): string - { + public static function cryptoKeyVersionName( + string $project, + string $location, + string $keyRing, + string $cryptoKey, + string $cryptoKeyVersion + ): string { return self::getPathTemplate('cryptoKeyVersion')->render([ 'project' => $project, 'location' => $location, @@ -470,8 +476,10 @@ public function getWorkflow(GetWorkflowRequest $request, array $callOptions = [] * * @throws ApiException Thrown if the API call fails. */ - public function listWorkflowRevisions(ListWorkflowRevisionsRequest $request, array $callOptions = []): PagedListResponse - { + public function listWorkflowRevisions( + ListWorkflowRevisionsRequest $request, + array $callOptions = [] + ): PagedListResponse { return $this->startApiCall('ListWorkflowRevisions', $request, $callOptions); } diff --git a/Workflows/tests/Unit/Executions/V1/Client/ExecutionsClientTest.php b/Workflows/tests/Unit/Executions/V1/Client/ExecutionsClientTest.php index 373e5f43077a..768badee8b7c 100644 --- a/Workflows/tests/Unit/Executions/V1/Client/ExecutionsClientTest.php +++ b/Workflows/tests/Unit/Executions/V1/Client/ExecutionsClientTest.php @@ -52,7 +52,9 @@ private function createTransport($deserialize = null) /** @return CredentialsWrapper */ private function createCredentials() { - return $this->getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return ExecutionsClient */ @@ -85,8 +87,7 @@ public function cancelExecutionTest() $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->executionName('[PROJECT]', '[LOCATION]', '[WORKFLOW]', '[EXECUTION]'); - $request = (new CancelExecutionRequest()) - ->setName($formattedName); + $request = (new CancelExecutionRequest())->setName($formattedName); $response = $gapicClient->cancelExecution($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -110,17 +111,19 @@ public function cancelExecutionExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedName = $gapicClient->executionName('[PROJECT]', '[LOCATION]', '[WORKFLOW]', '[EXECUTION]'); - $request = (new CancelExecutionRequest()) - ->setName($formattedName); + $request = (new CancelExecutionRequest())->setName($formattedName); try { $gapicClient->cancelExecution($request); // If the $gapicClient method call did not throw, fail the test @@ -156,9 +159,7 @@ public function createExecutionTest() // Mock request $formattedParent = $gapicClient->workflowName('[PROJECT]', '[LOCATION]', '[WORKFLOW]'); $execution = new Execution(); - $request = (new CreateExecutionRequest()) - ->setParent($formattedParent) - ->setExecution($execution); + $request = (new CreateExecutionRequest())->setParent($formattedParent)->setExecution($execution); $response = $gapicClient->createExecution($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -184,19 +185,20 @@ public function createExecutionExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->workflowName('[PROJECT]', '[LOCATION]', '[WORKFLOW]'); $execution = new Execution(); - $request = (new CreateExecutionRequest()) - ->setParent($formattedParent) - ->setExecution($execution); + $request = (new CreateExecutionRequest())->setParent($formattedParent)->setExecution($execution); try { $gapicClient->createExecution($request); // If the $gapicClient method call did not throw, fail the test @@ -231,8 +233,7 @@ public function getExecutionTest() $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->executionName('[PROJECT]', '[LOCATION]', '[WORKFLOW]', '[EXECUTION]'); - $request = (new GetExecutionRequest()) - ->setName($formattedName); + $request = (new GetExecutionRequest())->setName($formattedName); $response = $gapicClient->getExecution($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -256,17 +257,19 @@ public function getExecutionExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedName = $gapicClient->executionName('[PROJECT]', '[LOCATION]', '[WORKFLOW]', '[EXECUTION]'); - $request = (new GetExecutionRequest()) - ->setName($formattedName); + $request = (new GetExecutionRequest())->setName($formattedName); try { $gapicClient->getExecution($request); // If the $gapicClient method call did not throw, fail the test @@ -291,17 +294,14 @@ public function listExecutionsTest() // Mock response $nextPageToken = ''; $executionsElement = new Execution(); - $executions = [ - $executionsElement, - ]; + $executions = [$executionsElement]; $expectedResponse = new ListExecutionsResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setExecutions($executions); $transport->addResponse($expectedResponse); // Mock request $formattedParent = $gapicClient->workflowName('[PROJECT]', '[LOCATION]', '[WORKFLOW]'); - $request = (new ListExecutionsRequest()) - ->setParent($formattedParent); + $request = (new ListExecutionsRequest())->setParent($formattedParent); $response = $gapicClient->listExecutions($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -328,17 +328,19 @@ public function listExecutionsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->workflowName('[PROJECT]', '[LOCATION]', '[WORKFLOW]'); - $request = (new ListExecutionsRequest()) - ->setParent($formattedParent); + $request = (new ListExecutionsRequest())->setParent($formattedParent); try { $gapicClient->listExecutions($request); // If the $gapicClient method call did not throw, fail the test @@ -373,8 +375,7 @@ public function cancelExecutionAsyncTest() $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->executionName('[PROJECT]', '[LOCATION]', '[WORKFLOW]', '[EXECUTION]'); - $request = (new CancelExecutionRequest()) - ->setName($formattedName); + $request = (new CancelExecutionRequest())->setName($formattedName); $response = $gapicClient->cancelExecutionAsync($request)->wait(); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); diff --git a/Workflows/tests/Unit/V1/Client/WorkflowsClientTest.php b/Workflows/tests/Unit/V1/Client/WorkflowsClientTest.php index b8faf3eb756b..719e18ad257d 100644 --- a/Workflows/tests/Unit/V1/Client/WorkflowsClientTest.php +++ b/Workflows/tests/Unit/V1/Client/WorkflowsClientTest.php @@ -64,7 +64,9 @@ private function createTransport($deserialize = null) /** @return CredentialsWrapper */ private function createCredentials() { - return $this->getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return WorkflowsClient */ @@ -186,12 +188,15 @@ public function createWorkflowExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $operationsTransport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); @@ -254,8 +259,7 @@ public function deleteWorkflowTest() $operationsTransport->addResponse($completeOperation); // Mock request $formattedName = $gapicClient->workflowName('[PROJECT]', '[LOCATION]', '[WORKFLOW]'); - $request = (new DeleteWorkflowRequest()) - ->setName($formattedName); + $request = (new DeleteWorkflowRequest())->setName($formattedName); $response = $gapicClient->deleteWorkflow($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -311,17 +315,19 @@ public function deleteWorkflowExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $operationsTransport->addResponse(null, $status); // Mock request $formattedName = $gapicClient->workflowName('[PROJECT]', '[LOCATION]', '[WORKFLOW]'); - $request = (new DeleteWorkflowRequest()) - ->setName($formattedName); + $request = (new DeleteWorkflowRequest())->setName($formattedName); $response = $gapicClient->deleteWorkflow($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -371,8 +377,7 @@ public function getWorkflowTest() $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->workflowName('[PROJECT]', '[LOCATION]', '[WORKFLOW]'); - $request = (new GetWorkflowRequest()) - ->setName($formattedName); + $request = (new GetWorkflowRequest())->setName($formattedName); $response = $gapicClient->getWorkflow($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -396,17 +401,19 @@ public function getWorkflowExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedName = $gapicClient->workflowName('[PROJECT]', '[LOCATION]', '[WORKFLOW]'); - $request = (new GetWorkflowRequest()) - ->setName($formattedName); + $request = (new GetWorkflowRequest())->setName($formattedName); try { $gapicClient->getWorkflow($request); // If the $gapicClient method call did not throw, fail the test @@ -431,17 +438,14 @@ public function listWorkflowRevisionsTest() // Mock response $nextPageToken = ''; $workflowsElement = new Workflow(); - $workflows = [ - $workflowsElement, - ]; + $workflows = [$workflowsElement]; $expectedResponse = new ListWorkflowRevisionsResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setWorkflows($workflows); $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->workflowName('[PROJECT]', '[LOCATION]', '[WORKFLOW]'); - $request = (new ListWorkflowRevisionsRequest()) - ->setName($formattedName); + $request = (new ListWorkflowRevisionsRequest())->setName($formattedName); $response = $gapicClient->listWorkflowRevisions($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -468,17 +472,19 @@ public function listWorkflowRevisionsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedName = $gapicClient->workflowName('[PROJECT]', '[LOCATION]', '[WORKFLOW]'); - $request = (new ListWorkflowRevisionsRequest()) - ->setName($formattedName); + $request = (new ListWorkflowRevisionsRequest())->setName($formattedName); try { $gapicClient->listWorkflowRevisions($request); // If the $gapicClient method call did not throw, fail the test @@ -503,17 +509,14 @@ public function listWorkflowsTest() // Mock response $nextPageToken = ''; $workflowsElement = new Workflow(); - $workflows = [ - $workflowsElement, - ]; + $workflows = [$workflowsElement]; $expectedResponse = new ListWorkflowsResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setWorkflows($workflows); $transport->addResponse($expectedResponse); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $request = (new ListWorkflowsRequest()) - ->setParent($formattedParent); + $request = (new ListWorkflowsRequest())->setParent($formattedParent); $response = $gapicClient->listWorkflows($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -540,17 +543,19 @@ public function listWorkflowsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $request = (new ListWorkflowsRequest()) - ->setParent($formattedParent); + $request = (new ListWorkflowsRequest())->setParent($formattedParent); try { $gapicClient->listWorkflows($request); // If the $gapicClient method call did not throw, fail the test @@ -609,8 +614,7 @@ public function updateWorkflowTest() $operationsTransport->addResponse($completeOperation); // Mock request $workflow = new Workflow(); - $request = (new UpdateWorkflowRequest()) - ->setWorkflow($workflow); + $request = (new UpdateWorkflowRequest())->setWorkflow($workflow); $response = $gapicClient->updateWorkflow($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -666,17 +670,19 @@ public function updateWorkflowExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $operationsTransport->addResponse(null, $status); // Mock request $workflow = new Workflow(); - $request = (new UpdateWorkflowRequest()) - ->setWorkflow($workflow); + $request = (new UpdateWorkflowRequest())->setWorkflow($workflow); $response = $gapicClient->updateWorkflow($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -738,12 +744,15 @@ public function getLocationExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); $request = new GetLocationRequest(); try { @@ -770,9 +779,7 @@ public function listLocationsTest() // Mock response $nextPageToken = ''; $locationsElement = new Location(); - $locations = [ - $locationsElement, - ]; + $locations = [$locationsElement]; $expectedResponse = new ListLocationsResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setLocations($locations); @@ -802,12 +809,15 @@ public function listLocationsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); $request = new ListLocationsRequest(); try {