# Google Cloud Dialogflow Cx V3 Client - Class TestCasesClient (0.11.1)

0.11.1 (latest) 0.11.0 0.10.2 0.9.2 0.8.1 0.7.2 0.6.0 0.5.2 0.4.1 0.3.4 0.2.1 0.1.1 Reference documentation and code samples for the Google Cloud Dialogflow Cx V3 Client class TestCasesClient.

Service Description: Service for managing [Test Cases](https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow-cx/latest/V3.TestCase) and
[Test Case Results](https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow-cx/latest/V3.TestCaseResult).

This class provides the ability to make remote calls to the backing service through method
calls that map to API methods.

Many parameters require resource names to be formatted in a particular way. To
assist with these names, this class includes a format method for each type of
name, and additionally a parseName method to extract the individual identifiers
contained within formatted names that are returned by the API.

## Namespace

Google \\ Cloud \\ Dialogflow \\ Cx \\ V3 \\ Client

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `options` | `array|https://docs.cloud.google.com/php/docs/reference/gax/latest/Options.ClientOptions.html` Optional. Options for configuring the service API wrapper. |
| `↳ apiEndpoint` | `string` The address of the API remote host. May optionally include the port, formatted as " |
| `↳ credentials` | `https://docs.cloud.google.com/php/docs/reference/auth/latest/FetchAuthTokenInterface.html|https://docs.cloud.google.com/php/docs/reference/gax/latest/CredentialsWrapper.html` This option should only be used with a pre-constructed [Google\\Auth\\FetchAuthTokenInterface](https://docs.cloud.google.com/php/docs/reference/auth/latest/FetchAuthTokenInterface.html) or [Google\\ApiCore\\CredentialsWrapper](https://docs.cloud.google.com/php/docs/reference/gax/latest/CredentialsWrapper.html) object. Note that when one of these objects are provided, any settings in $credentialsConfig will be ignored. **Important** : If you are providing a path to a credentials file, or a decoded credentials file as a PHP array, this usage is now DEPRECATED. Providing an unvalidated credential configuration to Google APIs can compromise the security of your systems and data. It is recommended to create the credentials explicitly `use Google\Auth\Credentials\ServiceAccountCredentials; use Google\Cloud\Dialogflow\Cx\V3\TestCasesClient; $creds = new ServiceAccountCredentials($scopes, $json); $options = new TestCasesClient(['credentials' => $creds]);` <https://cloud.google.com/docs/authentication/external/externally-sourced-credentials> |
| `↳ credentialsConfig` | `array` Options used to configure credentials, including auth token caching, for the client. For a full list of supporting configuration options, see [Google\\ApiCore\\CredentialsWrapper::build()](https://docs.cloud.google.com/php/docs/reference/gax/latest/CredentialsWrapper.html#_Google_ApiCore_CredentialsWrapper__build__) . |
| `↳ disableRetries` | `bool` Determines whether or not retries defined by the client configuration should be disabled. Defaults to `false`. |
| `↳ clientConfig` | `string|array` Client method configuration, including retry settings. This option can be either a path to a JSON file, or a PHP array containing the decoded JSON data. By default this settings points to the default client config file, which is provided in the resources folder. |
| `↳ transport` | `string|https://docs.cloud.google.com/php/docs/reference/gax/latest/Transport.TransportInterface.html` The transport used for executing network requests. May be either the string `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. *Advanced usage* : Additionally, it is possible to pass in an already instantiated [Google\\ApiCore\\Transport\\TransportInterface](https://docs.cloud.google.com/php/docs/reference/gax/latest/Transport.TransportInterface.html) object. Note that when this object is provided, any settings in $transportConfig, and any $apiEndpoint setting, will be ignored. |
| `↳ transportConfig` | `array` Configuration options that will be used to construct the transport. Options for each supported transport type should be passed in a key for that transport. For example: $transportConfig = \[ 'grpc' =\> \[...\], 'rest' =\> \[...\], \]; See the [Google\\ApiCore\\Transport\\GrpcTransport::build()](https://docs.cloud.google.com/php/docs/reference/gax/latest/Transport.GrpcTransport.html#_Google_ApiCore_Transport_GrpcTransport__build__) and [Google\\ApiCore\\Transport\\RestTransport::build()](https://docs.cloud.google.com/php/docs/reference/gax/latest/Transport.RestTransport.html#_Google_ApiCore_Transport_RestTransport__build__) methods for the supported options. |
| `↳ clientCertSource` | `callable` A callable which returns the client cert as a string. This can be used to provide a certificate and private key to the transport layer for mTLS. |
| `↳ logger` | `false|Psr\Log\LoggerInterface` A PSR-3 compliant logger. If set to false, logging is disabled, ignoring the 'GOOGLE_SDK_PHP_LOGGING' environment flag |
| `↳ universeDomain` | `string` The service domain for the client. Defaults to 'googleapis.com'. |

### batchDeleteTestCases

Batch deletes test cases.

The async variant is [TestCasesClient::batchDeleteTestCasesAsync()](https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow-cx/latest/V3.Client.TestCasesClient#_Google_Cloud_Dialogflow_Cx_V3_Client_TestCasesClient__batchDeleteTestCasesAsync__) .

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow-cx/latest/V3.BatchDeleteTestCasesRequest` A request to house fields associated with the call. |
| `callOptions` | `array` Optional. |
| `↳ retrySettings` | `https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html|array` Retry settings to use for this call. Can be a [Google\\ApiCore\\RetrySettings](https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html) object, or an associative array of retry settings parameters. See the documentation on [Google\\ApiCore\\RetrySettings](https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html) for example usage. |

**Example**

    use Google\ApiCore\ApiException;
    use Google\Cloud\Dialogflow\Cx\V3\BatchDeleteTestCasesRequest;
    use Google\Cloud\Dialogflow\Cx\V3\Client\TestCasesClient;

    /**
     * @param string $formattedParent       The agent to delete test cases from.
     *                                      Format: `projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>`. Please see
     *                                      {@see TestCasesClient::agentName()} for help formatting this field.
     * @param string $formattedNamesElement Format of test case names:
     *                                      `projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>/testCases/<TestCaseID>`. Please see
     *                                      {@see TestCasesClient::testCaseName()} for help formatting this field.
     */
    function batch_delete_test_cases_sample(
        string $formattedParent,
        string $formattedNamesElement
    ): void {
        // Create a client.
        $testCasesClient = new TestCasesClient();

        // Prepare the request message.
        $formattedNames = [$formattedNamesElement,];
        $request = (new BatchDeleteTestCasesRequest())
            ->setParent($formattedParent)
            ->setNames($formattedNames);

        // Call the API and handle any network failures.
        try {
            $testCasesClient->batchDeleteTestCases($request);
            printf('Call completed successfully.' . PHP_EOL);
        } catch (ApiException $ex) {
            printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
        }
    }

    /**
     * Helper to execute the sample.
     *
     * This sample has been automatically generated and should be regarded as a code
     * template only. It will require modifications to work:
     *  - It may require correct/in-range values for request initialization.
     *  - It may require specifying regional endpoints when creating the service client,
     *    please see the apiEndpoint client configuration option for more details.
     */
    function callSample(): void
    {
        $formattedParent = TestCasesClient::agentName('[PROJECT]', '[LOCATION]', '[AGENT]');
        $formattedNamesElement = TestCasesClient::testCaseName(
            '[PROJECT]',
            '[LOCATION]',
            '[AGENT]',
            '[TEST_CASE]'
        );

        batch_delete_test_cases_sample($formattedParent, $formattedNamesElement);
    }

### batchRunTestCases

Kicks off a batch run of test cases.

This method is a [long-running
operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation).
The returned `Operation` type has the following method-specific fields:

- `metadata`: [BatchRunTestCasesMetadata](https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow-cx/latest/V3.BatchRunTestCasesMetadata)
- `response`: [BatchRunTestCasesResponse](https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow-cx/latest/V3.BatchRunTestCasesResponse)

The async variant is [TestCasesClient::batchRunTestCasesAsync()](https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow-cx/latest/V3.Client.TestCasesClient#_Google_Cloud_Dialogflow_Cx_V3_Client_TestCasesClient__batchRunTestCasesAsync__) .

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow-cx/latest/V3.BatchRunTestCasesRequest` A request to house fields associated with the call. |
| `callOptions` | `array` Optional. |
| `↳ retrySettings` | `https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html|array` Retry settings to use for this call. Can be a [Google\\ApiCore\\RetrySettings](https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html) object, or an associative array of retry settings parameters. See the documentation on [Google\\ApiCore\\RetrySettings](https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html) for example usage. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/gax/latest/OperationResponse.html<https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow-cx/latest/V3.BatchRunTestCasesResponse>` |   |

**Example**

    use Google\ApiCore\ApiException;
    use Google\ApiCore\OperationResponse;
    use Google\Cloud\Dialogflow\Cx\V3\BatchRunTestCasesRequest;
    use Google\Cloud\Dialogflow\Cx\V3\BatchRunTestCasesResponse;
    use Google\Cloud\Dialogflow\Cx\V3\Client\TestCasesClient;
    use Google\Rpc\Status;

    /**
     * @param string $formattedParent           Agent name. Format:
     *                                          `projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>`. Please see
     *                                          {@see TestCasesClient::agentName()} for help formatting this field.
     * @param string $formattedTestCasesElement Format:
     *                                          `projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>/testCases/<TestCaseID>`. Please see
     *                                          {@see TestCasesClient::testCaseName()} for help formatting this field.
     */
    function batch_run_test_cases_sample(
        string $formattedParent,
        string $formattedTestCasesElement
    ): void {
        // Create a client.
        $testCasesClient = new TestCasesClient();

        // Prepare the request message.
        $formattedTestCases = [$formattedTestCasesElement,];
        $request = (new BatchRunTestCasesRequest())
            ->setParent($formattedParent)
            ->setTestCases($formattedTestCases);

        // Call the API and handle any network failures.
        try {
            /** @var OperationResponse $response */
            $response = $testCasesClient->batchRunTestCases($request);
            $response->pollUntilComplete();

            if ($response->operationSucceeded()) {
                /** @var BatchRunTestCasesResponse $result */
                $result = $response->getResult();
                printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
            } else {
                /** @var Status $error */
                $error = $response->getError();
                printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
            }
        } catch (ApiException $ex) {
            printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
        }
    }

    /**
     * Helper to execute the sample.
     *
     * This sample has been automatically generated and should be regarded as a code
     * template only. It will require modifications to work:
     *  - It may require correct/in-range values for request initialization.
     *  - It may require specifying regional endpoints when creating the service client,
     *    please see the apiEndpoint client configuration option for more details.
     */
    function callSample(): void
    {
        $formattedParent = TestCasesClient::agentName('[PROJECT]', '[LOCATION]', '[AGENT]');
        $formattedTestCasesElement = TestCasesClient::testCaseName(
            '[PROJECT]',
            '[LOCATION]',
            '[AGENT]',
            '[TEST_CASE]'
        );

        batch_run_test_cases_sample($formattedParent, $formattedTestCasesElement);
    }

### calculateCoverage

Calculates the test coverage for an agent.

The async variant is [TestCasesClient::calculateCoverageAsync()](https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow-cx/latest/V3.Client.TestCasesClient#_Google_Cloud_Dialogflow_Cx_V3_Client_TestCasesClient__calculateCoverageAsync__) .

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow-cx/latest/V3.CalculateCoverageRequest` A request to house fields associated with the call. |
| `callOptions` | `array` Optional. |
| `↳ retrySettings` | `https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html|array` Retry settings to use for this call. Can be a [Google\\ApiCore\\RetrySettings](https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html) object, or an associative array of retry settings parameters. See the documentation on [Google\\ApiCore\\RetrySettings](https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html) for example usage. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow-cx/latest/V3.CalculateCoverageResponse` |   |

**Example**

    use Google\ApiCore\ApiException;
    use Google\Cloud\Dialogflow\Cx\V3\CalculateCoverageRequest;
    use Google\Cloud\Dialogflow\Cx\V3\CalculateCoverageRequest\CoverageType;
    use Google\Cloud\Dialogflow\Cx\V3\CalculateCoverageResponse;
    use Google\Cloud\Dialogflow\Cx\V3\Client\TestCasesClient;

    /**
     * @param string $formattedAgent The agent to calculate coverage for.
     *                               Format: `projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>`. Please see
     *                               {@see TestCasesClient::agentName()} for help formatting this field.
     * @param int    $type           The type of coverage requested.
     */
    function calculate_coverage_sample(string $formattedAgent, int $type): void
    {
        // Create a client.
        $testCasesClient = new TestCasesClient();

        // Prepare the request message.
        $request = (new CalculateCoverageRequest())
            ->setAgent($formattedAgent)
            ->setType($type);

        // Call the API and handle any network failures.
        try {
            /** @var CalculateCoverageResponse $response */
            $response = $testCasesClient->calculateCoverage($request);
            printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
        } catch (ApiException $ex) {
            printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
        }
    }

    /**
     * Helper to execute the sample.
     *
     * This sample has been automatically generated and should be regarded as a code
     * template only. It will require modifications to work:
     *  - It may require correct/in-range values for request initialization.
     *  - It may require specifying regional endpoints when creating the service client,
     *    please see the apiEndpoint client configuration option for more details.
     */
    function callSample(): void
    {
        $formattedAgent = TestCasesClient::agentName('[PROJECT]', '[LOCATION]', '[AGENT]');
        $type = CoverageType::COVERAGE_TYPE_UNSPECIFIED;

        calculate_coverage_sample($formattedAgent, $type);
    }

### createTestCase

Creates a test case for the given agent.

The async variant is [TestCasesClient::createTestCaseAsync()](https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow-cx/latest/V3.Client.TestCasesClient#_Google_Cloud_Dialogflow_Cx_V3_Client_TestCasesClient__createTestCaseAsync__) .

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow-cx/latest/V3.CreateTestCaseRequest` A request to house fields associated with the call. |
| `callOptions` | `array` Optional. |
| `↳ retrySettings` | `https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html|array` Retry settings to use for this call. Can be a [Google\\ApiCore\\RetrySettings](https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html) object, or an associative array of retry settings parameters. See the documentation on [Google\\ApiCore\\RetrySettings](https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html) for example usage. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow-cx/latest/V3.TestCase` |   |

**Example**

    use Google\ApiCore\ApiException;
    use Google\Cloud\Dialogflow\Cx\V3\Client\TestCasesClient;
    use Google\Cloud\Dialogflow\Cx\V3\CreateTestCaseRequest;
    use Google\Cloud\Dialogflow\Cx\V3\TestCase;

    /**
     * @param string $formattedParent     The agent to create the test case for.
     *                                    Format: `projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>`. Please see
     *                                    {@see TestCasesClient::agentName()} for help formatting this field.
     * @param string $testCaseDisplayName The human-readable name of the test case, unique within the
     *                                    agent. Limit of 200 characters.
     */
    function create_test_case_sample(string $formattedParent, string $testCaseDisplayName): void
    {
        // Create a client.
        $testCasesClient = new TestCasesClient();

        // Prepare the request message.
        $testCase = (new TestCase())
            ->setDisplayName($testCaseDisplayName);
        $request = (new CreateTestCaseRequest())
            ->setParent($formattedParent)
            ->setTestCase($testCase);

        // Call the API and handle any network failures.
        try {
            /** @var TestCase $response */
            $response = $testCasesClient->createTestCase($request);
            printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
        } catch (ApiException $ex) {
            printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
        }
    }

    /**
     * Helper to execute the sample.
     *
     * This sample has been automatically generated and should be regarded as a code
     * template only. It will require modifications to work:
     *  - It may require correct/in-range values for request initialization.
     *  - It may require specifying regional endpoints when creating the service client,
     *    please see the apiEndpoint client configuration option for more details.
     */
    function callSample(): void
    {
        $formattedParent = TestCasesClient::agentName('[PROJECT]', '[LOCATION]', '[AGENT]');
        $testCaseDisplayName = '[DISPLAY_NAME]';

        create_test_case_sample($formattedParent, $testCaseDisplayName);
    }

### exportTestCases

Exports the test cases under the agent to a Cloud Storage bucket or a local
file. Filter can be applied to export a subset of test cases.

This method is a [long-running
operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation).
The returned `Operation` type has the following method-specific fields:

- `metadata`: [ExportTestCasesMetadata](https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow-cx/latest/V3.ExportTestCasesMetadata)
- `response`: [ExportTestCasesResponse](https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow-cx/latest/V3.ExportTestCasesResponse)

The async variant is [TestCasesClient::exportTestCasesAsync()](https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow-cx/latest/V3.Client.TestCasesClient#_Google_Cloud_Dialogflow_Cx_V3_Client_TestCasesClient__exportTestCasesAsync__) .

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow-cx/latest/V3.ExportTestCasesRequest` A request to house fields associated with the call. |
| `callOptions` | `array` Optional. |
| `↳ retrySettings` | `https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html|array` Retry settings to use for this call. Can be a [Google\\ApiCore\\RetrySettings](https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html) object, or an associative array of retry settings parameters. See the documentation on [Google\\ApiCore\\RetrySettings](https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html) for example usage. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/gax/latest/OperationResponse.html<https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow-cx/latest/V3.ExportTestCasesResponse>` |   |

**Example**

    use Google\ApiCore\ApiException;
    use Google\ApiCore\OperationResponse;
    use Google\Cloud\Dialogflow\Cx\V3\Client\TestCasesClient;
    use Google\Cloud\Dialogflow\Cx\V3\ExportTestCasesRequest;
    use Google\Cloud\Dialogflow\Cx\V3\ExportTestCasesResponse;
    use Google\Rpc\Status;

    /**
     * @param string $formattedParent The agent where to export test cases from.
     *                                Format: `projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>`. Please see
     *                                {@see TestCasesClient::agentName()} for help formatting this field.
     */
    function export_test_cases_sample(string $formattedParent): void
    {
        // Create a client.
        $testCasesClient = new TestCasesClient();

        // Prepare the request message.
        $request = (new ExportTestCasesRequest())
            ->setParent($formattedParent);

        // Call the API and handle any network failures.
        try {
            /** @var OperationResponse $response */
            $response = $testCasesClient->exportTestCases($request);
            $response->pollUntilComplete();

            if ($response->operationSucceeded()) {
                /** @var ExportTestCasesResponse $result */
                $result = $response->getResult();
                printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
            } else {
                /** @var Status $error */
                $error = $response->getError();
                printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
            }
        } catch (ApiException $ex) {
            printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
        }
    }

    /**
     * Helper to execute the sample.
     *
     * This sample has been automatically generated and should be regarded as a code
     * template only. It will require modifications to work:
     *  - It may require correct/in-range values for request initialization.
     *  - It may require specifying regional endpoints when creating the service client,
     *    please see the apiEndpoint client configuration option for more details.
     */
    function callSample(): void
    {
        $formattedParent = TestCasesClient::agentName('[PROJECT]', '[LOCATION]', '[AGENT]');

        export_test_cases_sample($formattedParent);
    }

### getTestCase

Gets a test case.

The async variant is [TestCasesClient::getTestCaseAsync()](https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow-cx/latest/V3.Client.TestCasesClient#_Google_Cloud_Dialogflow_Cx_V3_Client_TestCasesClient__getTestCaseAsync__) .

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow-cx/latest/V3.GetTestCaseRequest` A request to house fields associated with the call. |
| `callOptions` | `array` Optional. |
| `↳ retrySettings` | `https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html|array` Retry settings to use for this call. Can be a [Google\\ApiCore\\RetrySettings](https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html) object, or an associative array of retry settings parameters. See the documentation on [Google\\ApiCore\\RetrySettings](https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html) for example usage. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow-cx/latest/V3.TestCase` |   |

**Example**

    use Google\ApiCore\ApiException;
    use Google\Cloud\Dialogflow\Cx\V3\Client\TestCasesClient;
    use Google\Cloud\Dialogflow\Cx\V3\GetTestCaseRequest;
    use Google\Cloud\Dialogflow\Cx\V3\TestCase;

    /**
     * @param string $formattedName The name of the testcase.
     *                              Format:
     *                              `projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>/testCases/<TestCaseID>`. Please see
     *                              {@see TestCasesClient::testCaseName()} for help formatting this field.
     */
    function get_test_case_sample(string $formattedName): void
    {
        // Create a client.
        $testCasesClient = new TestCasesClient();

        // Prepare the request message.
        $request = (new GetTestCaseRequest())
            ->setName($formattedName);

        // Call the API and handle any network failures.
        try {
            /** @var TestCase $response */
            $response = $testCasesClient->getTestCase($request);
            printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
        } catch (ApiException $ex) {
            printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
        }
    }

    /**
     * Helper to execute the sample.
     *
     * This sample has been automatically generated and should be regarded as a code
     * template only. It will require modifications to work:
     *  - It may require correct/in-range values for request initialization.
     *  - It may require specifying regional endpoints when creating the service client,
     *    please see the apiEndpoint client configuration option for more details.
     */
    function callSample(): void
    {
        $formattedName = TestCasesClient::testCaseName('[PROJECT]', '[LOCATION]', '[AGENT]', '[TEST_CASE]');

        get_test_case_sample($formattedName);
    }

### getTestCaseResult

Gets a test case result.

The async variant is [TestCasesClient::getTestCaseResultAsync()](https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow-cx/latest/V3.Client.TestCasesClient#_Google_Cloud_Dialogflow_Cx_V3_Client_TestCasesClient__getTestCaseResultAsync__) .

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow-cx/latest/V3.GetTestCaseResultRequest` A request to house fields associated with the call. |
| `callOptions` | `array` Optional. |
| `↳ retrySettings` | `https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html|array` Retry settings to use for this call. Can be a [Google\\ApiCore\\RetrySettings](https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html) object, or an associative array of retry settings parameters. See the documentation on [Google\\ApiCore\\RetrySettings](https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html) for example usage. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow-cx/latest/V3.TestCaseResult` |   |

**Example**

    use Google\ApiCore\ApiException;
    use Google\Cloud\Dialogflow\Cx\V3\Client\TestCasesClient;
    use Google\Cloud\Dialogflow\Cx\V3\GetTestCaseResultRequest;
    use Google\Cloud\Dialogflow\Cx\V3\TestCaseResult;

    /**
     * @param string $formattedName The name of the testcase.
     *                              Format:
     *                              `projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>/testCases/<TestCaseID>/results/<TestCaseResultID>`. Please see
     *                              {@see TestCasesClient::testCaseResultName()} for help formatting this field.
     */
    function get_test_case_result_sample(string $formattedName): void
    {
        // Create a client.
        $testCasesClient = new TestCasesClient();

        // Prepare the request message.
        $request = (new GetTestCaseResultRequest())
            ->setName($formattedName);

        // Call the API and handle any network failures.
        try {
            /** @var TestCaseResult $response */
            $response = $testCasesClient->getTestCaseResult($request);
            printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
        } catch (ApiException $ex) {
            printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
        }
    }

    /**
     * Helper to execute the sample.
     *
     * This sample has been automatically generated and should be regarded as a code
     * template only. It will require modifications to work:
     *  - It may require correct/in-range values for request initialization.
     *  - It may require specifying regional endpoints when creating the service client,
     *    please see the apiEndpoint client configuration option for more details.
     */
    function callSample(): void
    {
        $formattedName = TestCasesClient::testCaseResultName(
            '[PROJECT]',
            '[LOCATION]',
            '[AGENT]',
            '[TEST_CASE]',
            '[RESULT]'
        );

        get_test_case_result_sample($formattedName);
    }

### importTestCases

Imports the test cases from a Cloud Storage bucket or a local file. It
always creates new test cases and won't overwrite any existing ones. The
provided ID in the imported test case is neglected.

This method is a [long-running
operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation).
The returned `Operation` type has the following method-specific fields:

- `metadata`: [ImportTestCasesMetadata](https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow-cx/latest/V3.ImportTestCasesMetadata)
- `response`: [ImportTestCasesResponse](https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow-cx/latest/V3.ImportTestCasesResponse)

The async variant is [TestCasesClient::importTestCasesAsync()](https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow-cx/latest/V3.Client.TestCasesClient#_Google_Cloud_Dialogflow_Cx_V3_Client_TestCasesClient__importTestCasesAsync__) .

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow-cx/latest/V3.ImportTestCasesRequest` A request to house fields associated with the call. |
| `callOptions` | `array` Optional. |
| `↳ retrySettings` | `https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html|array` Retry settings to use for this call. Can be a [Google\\ApiCore\\RetrySettings](https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html) object, or an associative array of retry settings parameters. See the documentation on [Google\\ApiCore\\RetrySettings](https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html) for example usage. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/gax/latest/OperationResponse.html<https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow-cx/latest/V3.ImportTestCasesResponse>` |   |

**Example**

    use Google\ApiCore\ApiException;
    use Google\ApiCore\OperationResponse;
    use Google\Cloud\Dialogflow\Cx\V3\Client\TestCasesClient;
    use Google\Cloud\Dialogflow\Cx\V3\ImportTestCasesRequest;
    use Google\Cloud\Dialogflow\Cx\V3\ImportTestCasesResponse;
    use Google\Rpc\Status;

    /**
     * @param string $formattedParent The agent to import test cases to.
     *                                Format: `projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>`. Please see
     *                                {@see TestCasesClient::agentName()} for help formatting this field.
     */
    function import_test_cases_sample(string $formattedParent): void
    {
        // Create a client.
        $testCasesClient = new TestCasesClient();

        // Prepare the request message.
        $request = (new ImportTestCasesRequest())
            ->setParent($formattedParent);

        // Call the API and handle any network failures.
        try {
            /** @var OperationResponse $response */
            $response = $testCasesClient->importTestCases($request);
            $response->pollUntilComplete();

            if ($response->operationSucceeded()) {
                /** @var ImportTestCasesResponse $result */
                $result = $response->getResult();
                printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
            } else {
                /** @var Status $error */
                $error = $response->getError();
                printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
            }
        } catch (ApiException $ex) {
            printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
        }
    }

    /**
     * Helper to execute the sample.
     *
     * This sample has been automatically generated and should be regarded as a code
     * template only. It will require modifications to work:
     *  - It may require correct/in-range values for request initialization.
     *  - It may require specifying regional endpoints when creating the service client,
     *    please see the apiEndpoint client configuration option for more details.
     */
    function callSample(): void
    {
        $formattedParent = TestCasesClient::agentName('[PROJECT]', '[LOCATION]', '[AGENT]');

        import_test_cases_sample($formattedParent);
    }

### listTestCaseResults

Fetches the list of run results for the given test case. A maximum of 100
results are kept for each test case.

The async variant is [TestCasesClient::listTestCaseResultsAsync()](https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow-cx/latest/V3.Client.TestCasesClient#_Google_Cloud_Dialogflow_Cx_V3_Client_TestCasesClient__listTestCaseResultsAsync__) .

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow-cx/latest/V3.ListTestCaseResultsRequest` A request to house fields associated with the call. |
| `callOptions` | `array` Optional. |
| `↳ retrySettings` | `https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html|array` Retry settings to use for this call. Can be a [Google\\ApiCore\\RetrySettings](https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html) object, or an associative array of retry settings parameters. See the documentation on [Google\\ApiCore\\RetrySettings](https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html) for example usage. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/gax/latest/PagedListResponse.html` |   |

**Example**

    use Google\ApiCore\ApiException;
    use Google\ApiCore\PagedListResponse;
    use Google\Cloud\Dialogflow\Cx\V3\Client\TestCasesClient;
    use Google\Cloud\Dialogflow\Cx\V3\ListTestCaseResultsRequest;
    use Google\Cloud\Dialogflow\Cx\V3\TestCaseResult;

    /**
     * @param string $formattedParent The test case to list results for.
     *                                Format:
     *                                `projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>/testCases/<TestCaseID>`.
     *                                Specify a `-` as a wildcard for TestCase ID to
     *                                list results across multiple test cases. Please see
     *                                {@see TestCasesClient::testCaseName()} for help formatting this field.
     */
    function list_test_case_results_sample(string $formattedParent): void
    {
        // Create a client.
        $testCasesClient = new TestCasesClient();

        // Prepare the request message.
        $request = (new ListTestCaseResultsRequest())
            ->setParent($formattedParent);

        // Call the API and handle any network failures.
        try {
            /** @var PagedListResponse $response */
            $response = $testCasesClient->listTestCaseResults($request);

            /** @var TestCaseResult $element */
            foreach ($response as $element) {
                printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
            }
        } catch (ApiException $ex) {
            printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
        }
    }

    /**
     * Helper to execute the sample.
     *
     * This sample has been automatically generated and should be regarded as a code
     * template only. It will require modifications to work:
     *  - It may require correct/in-range values for request initialization.
     *  - It may require specifying regional endpoints when creating the service client,
     *    please see the apiEndpoint client configuration option for more details.
     */
    function callSample(): void
    {
        $formattedParent = TestCasesClient::testCaseName(
            '[PROJECT]',
            '[LOCATION]',
            '[AGENT]',
            '[TEST_CASE]'
        );

        list_test_case_results_sample($formattedParent);
    }

### listTestCases

Fetches a list of test cases for a given agent.

The async variant is [TestCasesClient::listTestCasesAsync()](https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow-cx/latest/V3.Client.TestCasesClient#_Google_Cloud_Dialogflow_Cx_V3_Client_TestCasesClient__listTestCasesAsync__) .

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow-cx/latest/V3.ListTestCasesRequest` A request to house fields associated with the call. |
| `callOptions` | `array` Optional. |
| `↳ retrySettings` | `https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html|array` Retry settings to use for this call. Can be a [Google\\ApiCore\\RetrySettings](https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html) object, or an associative array of retry settings parameters. See the documentation on [Google\\ApiCore\\RetrySettings](https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html) for example usage. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/gax/latest/PagedListResponse.html` |   |

**Example**

    use Google\ApiCore\ApiException;
    use Google\ApiCore\PagedListResponse;
    use Google\Cloud\Dialogflow\Cx\V3\Client\TestCasesClient;
    use Google\Cloud\Dialogflow\Cx\V3\ListTestCasesRequest;
    use Google\Cloud\Dialogflow\Cx\V3\TestCase;

    /**
     * @param string $formattedParent The agent to list all pages for.
     *                                Format: `projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>`. Please see
     *                                {@see TestCasesClient::agentName()} for help formatting this field.
     */
    function list_test_cases_sample(string $formattedParent): void
    {
        // Create a client.
        $testCasesClient = new TestCasesClient();

        // Prepare the request message.
        $request = (new ListTestCasesRequest())
            ->setParent($formattedParent);

        // Call the API and handle any network failures.
        try {
            /** @var PagedListResponse $response */
            $response = $testCasesClient->listTestCases($request);

            /** @var TestCase $element */
            foreach ($response as $element) {
                printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
            }
        } catch (ApiException $ex) {
            printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
        }
    }

    /**
     * Helper to execute the sample.
     *
     * This sample has been automatically generated and should be regarded as a code
     * template only. It will require modifications to work:
     *  - It may require correct/in-range values for request initialization.
     *  - It may require specifying regional endpoints when creating the service client,
     *    please see the apiEndpoint client configuration option for more details.
     */
    function callSample(): void
    {
        $formattedParent = TestCasesClient::agentName('[PROJECT]', '[LOCATION]', '[AGENT]');

        list_test_cases_sample($formattedParent);
    }

### runTestCase

Kicks off a test case run.

This method is a [long-running
operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation).
The returned `Operation` type has the following method-specific fields:

- `metadata`: [RunTestCaseMetadata](https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow-cx/latest/V3.RunTestCaseMetadata)
- `response`: [RunTestCaseResponse](https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow-cx/latest/V3.RunTestCaseResponse)

The async variant is [TestCasesClient::runTestCaseAsync()](https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow-cx/latest/V3.Client.TestCasesClient#_Google_Cloud_Dialogflow_Cx_V3_Client_TestCasesClient__runTestCaseAsync__) .

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow-cx/latest/V3.RunTestCaseRequest` A request to house fields associated with the call. |
| `callOptions` | `array` Optional. |
| `↳ retrySettings` | `https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html|array` Retry settings to use for this call. Can be a [Google\\ApiCore\\RetrySettings](https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html) object, or an associative array of retry settings parameters. See the documentation on [Google\\ApiCore\\RetrySettings](https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html) for example usage. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/gax/latest/OperationResponse.html<https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow-cx/latest/V3.RunTestCaseResponse>` |   |

**Example**

    use Google\ApiCore\ApiException;
    use Google\ApiCore\OperationResponse;
    use Google\Cloud\Dialogflow\Cx\V3\Client\TestCasesClient;
    use Google\Cloud\Dialogflow\Cx\V3\RunTestCaseRequest;
    use Google\Cloud\Dialogflow\Cx\V3\RunTestCaseResponse;
    use Google\Rpc\Status;

    /**
     * @param string $formattedName Format of test case name to run:
     *                              `projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>/testCases/<TestCaseID>`. Please see
     *                              {@see TestCasesClient::testCaseName()} for help formatting this field.
     */
    function run_test_case_sample(string $formattedName): void
    {
        // Create a client.
        $testCasesClient = new TestCasesClient();

        // Prepare the request message.
        $request = (new RunTestCaseRequest())
            ->setName($formattedName);

        // Call the API and handle any network failures.
        try {
            /** @var OperationResponse $response */
            $response = $testCasesClient->runTestCase($request);
            $response->pollUntilComplete();

            if ($response->operationSucceeded()) {
                /** @var RunTestCaseResponse $result */
                $result = $response->getResult();
                printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
            } else {
                /** @var Status $error */
                $error = $response->getError();
                printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
            }
        } catch (ApiException $ex) {
            printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
        }
    }

    /**
     * Helper to execute the sample.
     *
     * This sample has been automatically generated and should be regarded as a code
     * template only. It will require modifications to work:
     *  - It may require correct/in-range values for request initialization.
     *  - It may require specifying regional endpoints when creating the service client,
     *    please see the apiEndpoint client configuration option for more details.
     */
    function callSample(): void
    {
        $formattedName = TestCasesClient::testCaseName('[PROJECT]', '[LOCATION]', '[AGENT]', '[TEST_CASE]');

        run_test_case_sample($formattedName);
    }

### updateTestCase

Updates the specified test case.

The async variant is [TestCasesClient::updateTestCaseAsync()](https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow-cx/latest/V3.Client.TestCasesClient#_Google_Cloud_Dialogflow_Cx_V3_Client_TestCasesClient__updateTestCaseAsync__) .

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow-cx/latest/V3.UpdateTestCaseRequest` A request to house fields associated with the call. |
| `callOptions` | `array` Optional. |
| `↳ retrySettings` | `https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html|array` Retry settings to use for this call. Can be a [Google\\ApiCore\\RetrySettings](https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html) object, or an associative array of retry settings parameters. See the documentation on [Google\\ApiCore\\RetrySettings](https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html) for example usage. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow-cx/latest/V3.TestCase` |   |

**Example**

    use Google\ApiCore\ApiException;
    use Google\Cloud\Dialogflow\Cx\V3\Client\TestCasesClient;
    use Google\Cloud\Dialogflow\Cx\V3\TestCase;
    use Google\Cloud\Dialogflow\Cx\V3\UpdateTestCaseRequest;
    use Google\Protobuf\FieldMask;

    /**
     * @param string $testCaseDisplayName The human-readable name of the test case, unique within the
     *                                    agent. Limit of 200 characters.
     */
    function update_test_case_sample(string $testCaseDisplayName): void
    {
        // Create a client.
        $testCasesClient = new TestCasesClient();

        // Prepare the request message.
        $testCase = (new TestCase())
            ->setDisplayName($testCaseDisplayName);
        $updateMask = new FieldMask();
        $request = (new UpdateTestCaseRequest())
            ->setTestCase($testCase)
            ->setUpdateMask($updateMask);

        // Call the API and handle any network failures.
        try {
            /** @var TestCase $response */
            $response = $testCasesClient->updateTestCase($request);
            printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
        } catch (ApiException $ex) {
            printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
        }
    }

    /**
     * Helper to execute the sample.
     *
     * This sample has been automatically generated and should be regarded as a code
     * template only. It will require modifications to work:
     *  - It may require correct/in-range values for request initialization.
     *  - It may require specifying regional endpoints when creating the service client,
     *    please see the apiEndpoint client configuration option for more details.
     */
    function callSample(): void
    {
        $testCaseDisplayName = '[DISPLAY_NAME]';

        update_test_case_sample($testCaseDisplayName);
    }

### getLocation

Gets information about a location.

The async variant is [TestCasesClient::getLocationAsync()](https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow-cx/latest/V3.Client.TestCasesClient#_Google_Cloud_Dialogflow_Cx_V3_Client_TestCasesClient__getLocationAsync__) .

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/php/docs/reference/common-protos/latest/Cloud.Location.GetLocationRequest.html` A request to house fields associated with the call. |
| `callOptions` | `array` Optional. |
| `↳ retrySettings` | `https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html|array` Retry settings to use for this call. Can be a [Google\\ApiCore\\RetrySettings](https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html) object, or an associative array of retry settings parameters. See the documentation on [Google\\ApiCore\\RetrySettings](https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html) for example usage. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/common-protos/latest/Cloud.Location.Location.html` |   |

**Example**

    use Google\ApiCore\ApiException;
    use Google\Cloud\Dialogflow\Cx\V3\Client\TestCasesClient;
    use Google\Cloud\Location\GetLocationRequest;
    use Google\Cloud\Location\Location;

    /**
     * This sample has been automatically generated and should be regarded as a code
     * template only. It will require modifications to work:
     *  - It may require correct/in-range values for request initialization.
     *  - It may require specifying regional endpoints when creating the service client,
     *    please see the apiEndpoint client configuration option for more details.
     */
    function get_location_sample(): void
    {
        // Create a client.
        $testCasesClient = new TestCasesClient();

        // Prepare the request message.
        $request = new GetLocationRequest();

        // Call the API and handle any network failures.
        try {
            /** @var Location $response */
            $response = $testCasesClient->getLocation($request);
            printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
        } catch (ApiException $ex) {
            printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
        }
    }

### listLocations

Lists information about the supported locations for this service.

This method lists locations based on the resource scope provided in
the \[ListLocationsRequest.name\] field:

**Global locations** : If `name` is empty, the method lists the
public locations available to all projects. \* **Project-specific
locations** : If `name` follows the format
`projects/{project}`, the method lists locations visible to that
specific project. This includes public, private, or other
project-specific locations enabled for the project.

For gRPC and client library implementations, the resource name is
passed as the `name` field. For direct service calls, the resource
name is
incorporated into the request path based on the specific service
implementation and version.

The async variant is [TestCasesClient::listLocationsAsync()](https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow-cx/latest/V3.Client.TestCasesClient#_Google_Cloud_Dialogflow_Cx_V3_Client_TestCasesClient__listLocationsAsync__) .

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/php/docs/reference/common-protos/latest/Cloud.Location.ListLocationsRequest.html` A request to house fields associated with the call. |
| `callOptions` | `array` Optional. |
| `↳ retrySettings` | `https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html|array` Retry settings to use for this call. Can be a [Google\\ApiCore\\RetrySettings](https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html) object, or an associative array of retry settings parameters. See the documentation on [Google\\ApiCore\\RetrySettings](https://docs.cloud.google.com/php/docs/reference/gax/latest/RetrySettings.html) for example usage. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/gax/latest/PagedListResponse.html` |   |

**Example**

    use Google\ApiCore\ApiException;
    use Google\ApiCore\PagedListResponse;
    use Google\Cloud\Dialogflow\Cx\V3\Client\TestCasesClient;
    use Google\Cloud\Location\ListLocationsRequest;
    use Google\Cloud\Location\Location;

    /**
     * This sample has been automatically generated and should be regarded as a code
     * template only. It will require modifications to work:
     *  - It may require correct/in-range values for request initialization.
     *  - It may require specifying regional endpoints when creating the service client,
     *    please see the apiEndpoint client configuration option for more details.
     */
    function list_locations_sample(): void
    {
        // Create a client.
        $testCasesClient = new TestCasesClient();

        // Prepare the request message.
        $request = new ListLocationsRequest();

        // Call the API and handle any network failures.
        try {
            /** @var PagedListResponse $response */
            $response = $testCasesClient->listLocations($request);

            /** @var Location $element */
            foreach ($response as $element) {
                printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
            }
        } catch (ApiException $ex) {
            printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
        }
    }

### batchDeleteTestCasesAsync

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow-cx/latest/V3.BatchDeleteTestCasesRequest` |
| `optionalArgs` | `array` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.aws.amazon.com/aws-sdk-php/v3/api/class-GuzzleHttp.Promise.Promise.html<void>` |   |

### batchRunTestCasesAsync

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow-cx/latest/V3.BatchRunTestCasesRequest` |
| `optionalArgs` | `array` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.aws.amazon.com/aws-sdk-php/v3/api/class-GuzzleHttp.Promise.Promise.html<https://docs.cloud.google.com/php/docs/reference/gax/latest/OperationResponse.html>` |   |

### calculateCoverageAsync

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow-cx/latest/V3.CalculateCoverageRequest` |
| `optionalArgs` | `array` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.aws.amazon.com/aws-sdk-php/v3/api/class-GuzzleHttp.Promise.Promise.html<https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow-cx/latest/V3.CalculateCoverageResponse>` |   |

### createTestCaseAsync

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow-cx/latest/V3.CreateTestCaseRequest` |
| `optionalArgs` | `array` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.aws.amazon.com/aws-sdk-php/v3/api/class-GuzzleHttp.Promise.Promise.html<https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow-cx/latest/V3.TestCase>` |   |

### exportTestCasesAsync

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow-cx/latest/V3.ExportTestCasesRequest` |
| `optionalArgs` | `array` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.aws.amazon.com/aws-sdk-php/v3/api/class-GuzzleHttp.Promise.Promise.html<https://docs.cloud.google.com/php/docs/reference/gax/latest/OperationResponse.html>` |   |

### getTestCaseAsync

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow-cx/latest/V3.GetTestCaseRequest` |
| `optionalArgs` | `array` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.aws.amazon.com/aws-sdk-php/v3/api/class-GuzzleHttp.Promise.Promise.html<https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow-cx/latest/V3.TestCase>` |   |

### getTestCaseResultAsync

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow-cx/latest/V3.GetTestCaseResultRequest` |
| `optionalArgs` | `array` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.aws.amazon.com/aws-sdk-php/v3/api/class-GuzzleHttp.Promise.Promise.html<https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow-cx/latest/V3.TestCaseResult>` |   |

### importTestCasesAsync

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow-cx/latest/V3.ImportTestCasesRequest` |
| `optionalArgs` | `array` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.aws.amazon.com/aws-sdk-php/v3/api/class-GuzzleHttp.Promise.Promise.html<https://docs.cloud.google.com/php/docs/reference/gax/latest/OperationResponse.html>` |   |

### listTestCaseResultsAsync

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow-cx/latest/V3.ListTestCaseResultsRequest` |
| `optionalArgs` | `array` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.aws.amazon.com/aws-sdk-php/v3/api/class-GuzzleHttp.Promise.Promise.html<https://docs.cloud.google.com/php/docs/reference/gax/latest/PagedListResponse.html>` |   |

### listTestCasesAsync

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow-cx/latest/V3.ListTestCasesRequest` |
| `optionalArgs` | `array` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.aws.amazon.com/aws-sdk-php/v3/api/class-GuzzleHttp.Promise.Promise.html<https://docs.cloud.google.com/php/docs/reference/gax/latest/PagedListResponse.html>` |   |

### runTestCaseAsync

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow-cx/latest/V3.RunTestCaseRequest` |
| `optionalArgs` | `array` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.aws.amazon.com/aws-sdk-php/v3/api/class-GuzzleHttp.Promise.Promise.html<https://docs.cloud.google.com/php/docs/reference/gax/latest/OperationResponse.html>` |   |

### updateTestCaseAsync

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow-cx/latest/V3.UpdateTestCaseRequest` |
| `optionalArgs` | `array` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.aws.amazon.com/aws-sdk-php/v3/api/class-GuzzleHttp.Promise.Promise.html<https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow-cx/latest/V3.TestCase>` |   |

### getLocationAsync

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/php/docs/reference/common-protos/latest/Cloud.Location.GetLocationRequest.html` |
| `optionalArgs` | `array` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.aws.amazon.com/aws-sdk-php/v3/api/class-GuzzleHttp.Promise.Promise.html<https://docs.cloud.google.com/php/docs/reference/common-protos/latest/Cloud.Location.Location.html>` |   |

### listLocationsAsync

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/php/docs/reference/common-protos/latest/Cloud.Location.ListLocationsRequest.html` |
| `optionalArgs` | `array` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.aws.amazon.com/aws-sdk-php/v3/api/class-GuzzleHttp.Promise.Promise.html<https://docs.cloud.google.com/php/docs/reference/gax/latest/PagedListResponse.html>` |   |

### getOperationsClient

Return an OperationsClient object with the same endpoint as $this.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `Google\LongRunning\Client\OperationsClient` |   |

### resumeOperation

Resume an existing long running operation that was previously started by a long
running API method. If $methodName is not provided, or does not match a long
running API method, then the operation can still be resumed, but the
OperationResponse object will not deserialize the final response.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `operationName` | `string` The name of the long running operation |
| `methodName` | `string` The name of the method used to start the operation |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/gax/latest/OperationResponse.html` |   |

### static::agentName

Formats a string containing the fully-qualified path to represent a agent
resource.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `project` | `string` |
| `location` | `string` |
| `agent` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` | The formatted agent resource. |

### static::entityTypeName

Formats a string containing the fully-qualified path to represent a entity_type
resource.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `project` | `string` |
| `location` | `string` |
| `agent` | `string` |
| `entityType` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` | The formatted entity_type resource. |

### static::environmentName

Formats a string containing the fully-qualified path to represent a environment
resource.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `project` | `string` |
| `location` | `string` |
| `agent` | `string` |
| `environment` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` | The formatted environment resource. |

### static::flowName

Formats a string containing the fully-qualified path to represent a flow
resource.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `project` | `string` |
| `location` | `string` |
| `agent` | `string` |
| `flow` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` | The formatted flow resource. |

### static::generatorName

Formats a string containing the fully-qualified path to represent a generator
resource.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `project` | `string` |
| `location` | `string` |
| `agent` | `string` |
| `generator` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` | The formatted generator resource. |

### static::intentName

Formats a string containing the fully-qualified path to represent a intent
resource.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `project` | `string` |
| `location` | `string` |
| `agent` | `string` |
| `intent` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` | The formatted intent resource. |

### static::pageName

Formats a string containing the fully-qualified path to represent a page
resource.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `project` | `string` |
| `location` | `string` |
| `agent` | `string` |
| `flow` | `string` |
| `page` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` | The formatted page resource. |

### static::playbookName

Formats a string containing the fully-qualified path to represent a playbook
resource.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `project` | `string` |
| `location` | `string` |
| `agent` | `string` |
| `playbook` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` | The formatted playbook resource. |

### static::projectLocationAgentFlowTransitionRouteGroupName

Formats a string containing the fully-qualified path to represent a
project_location_agent_flow_transition_route_group resource.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `project` | `string` |
| `location` | `string` |
| `agent` | `string` |
| `flow` | `string` |
| `transitionRouteGroup` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` | The formatted project_location_agent_flow_transition_route_group resource. |

### static::projectLocationAgentTransitionRouteGroupName

Formats a string containing the fully-qualified path to represent a
project_location_agent_transition_route_group resource.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `project` | `string` |
| `location` | `string` |
| `agent` | `string` |
| `transitionRouteGroup` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` | The formatted project_location_agent_transition_route_group resource. |

### static::testCaseName

Formats a string containing the fully-qualified path to represent a test_case
resource.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `project` | `string` |
| `location` | `string` |
| `agent` | `string` |
| `testCase` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` | The formatted test_case resource. |

### static::testCaseResultName

Formats a string containing the fully-qualified path to represent a
test_case_result resource.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `project` | `string` |
| `location` | `string` |
| `agent` | `string` |
| `testCase` | `string` |
| `result` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` | The formatted test_case_result resource. |

### static::toolName

Formats a string containing the fully-qualified path to represent a tool
resource.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `project` | `string` |
| `location` | `string` |
| `agent` | `string` |
| `tool` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` | The formatted tool resource. |

### static::transitionRouteGroupName

Formats a string containing the fully-qualified path to represent a
transition_route_group resource.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `project` | `string` |
| `location` | `string` |
| `agent` | `string` |
| `flow` | `string` |
| `transitionRouteGroup` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` | The formatted transition_route_group resource. |

### static::webhookName

Formats a string containing the fully-qualified path to represent a webhook
resource.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `project` | `string` |
| `location` | `string` |
| `agent` | `string` |
| `webhook` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` | The formatted webhook resource. |

### static::parseName

Parses a formatted name string and returns an associative array of the components in the name.

The following name formats are supported:
Template: Pattern

- agent: projects/{project}/locations/{location}/agents/{agent}
- entityType: projects/{project}/locations/{location}/agents/{agent}/entityTypes/{entity_type}
- environment: projects/{project}/locations/{location}/agents/{agent}/environments/{environment}
- flow: projects/{project}/locations/{location}/agents/{agent}/flows/{flow}
- generator: projects/{project}/locations/{location}/agents/{agent}/generators/{generator}
- intent: projects/{project}/locations/{location}/agents/{agent}/intents/{intent}
- page: projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/pages/{page}
- playbook: projects/{project}/locations/{location}/agents/{agent}/playbooks/{playbook}
- projectLocationAgentFlowTransitionRouteGroup: projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/transitionRouteGroups/{transition_route_group}
- projectLocationAgentTransitionRouteGroup: projects/{project}/locations/{location}/agents/{agent}/transitionRouteGroups/{transition_route_group}
- testCase: projects/{project}/locations/{location}/agents/{agent}/testCases/{test_case}
- testCaseResult: projects/{project}/locations/{location}/agents/{agent}/testCases/{test_case}/results/{result}
- tool: projects/{project}/locations/{location}/agents/{agent}/tools/{tool}
- transitionRouteGroup: projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/transitionRouteGroups/{transition_route_group}
- webhook: projects/{project}/locations/{location}/agents/{agent}/webhooks/{webhook}

The optional $template argument can be supplied to specify a particular pattern,
and must match one of the templates listed above. If no $template argument is
provided, or if the $template argument does not match one of the templates
listed, then parseName will check each of the supported templates, and return
the first match.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `formattedName` | `string` The formatted name string |
| `template` | `?string` Optional name of template to match |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `array` | An associative array from name component IDs to component values. |