diff --git a/.gitignore b/.gitignore index 85c6eae17ab5..c65362505885 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ vendor/ # do not delete keys/ +.testing diff --git a/.travis.yml b/.travis.yml index b638dd434ebf..acc85ad34057 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,7 +18,7 @@ before_script: - if [[ $TRAVIS_PHP_VERSION =~ ^7 ]]; then pecl install stackdriver_debugger-alpha || echo 'Failed to install stackdriver_debugger'; fi - composer install - if [[ $TRAVIS_PHP_VERSION =~ ^hhvm ]]; then composer --no-interaction --dev remove google/protobuf google/gax google/proto-client; fi - - ./dev/sh/system-test-credentials + - dev/google-cloud credentials env: global: @@ -34,7 +34,3 @@ after_success: - if [[ $TRAVIS_PHP_VERSION =~ ^hhvm ]]; then bash <(curl -s https://codecov.io/bash); fi - ./dev/sh/push-docs - ./dev/sh/trigger-split - - cat ./build/snippets-uncovered.json - -after_failure: - - echo "SNIPPET COVERAGE REPORT" && cat ./build/snippets-uncovered.json diff --git a/src/Logging/.github/pull_request_template.md b/BigQuery/.github/pull_request_template.md similarity index 93% rename from src/Logging/.github/pull_request_template.md rename to BigQuery/.github/pull_request_template.md index e037e4001c2b..b1c7e28b8881 100644 --- a/src/Logging/.github/pull_request_template.md +++ b/BigQuery/.github/pull_request_template.md @@ -14,7 +14,7 @@ $ git clone git@github.com:GoogleCloudPlatform/google-cloud-php.git ``` * Move your changes into the correct location in that library. Library code -belongs in `src/Logging`, and tests in `tests/*/Logging`. +belongs in `BigQuery/src`, and tests in `BigQuery/tests`. * Push the changes in a new branch to a fork, and open a new pull request [here](https://github.com/GoogleCloudPlatform/google-cloud-php). diff --git a/src/BigQuery/CONTRIBUTING.md b/BigQuery/CONTRIBUTING.md similarity index 100% rename from src/BigQuery/CONTRIBUTING.md rename to BigQuery/CONTRIBUTING.md diff --git a/src/BigQuery/LICENSE b/BigQuery/LICENSE similarity index 100% rename from src/BigQuery/LICENSE rename to BigQuery/LICENSE diff --git a/src/BigQuery/README.md b/BigQuery/README.md similarity index 100% rename from src/BigQuery/README.md rename to BigQuery/README.md diff --git a/src/BigQuery/VERSION b/BigQuery/VERSION similarity index 100% rename from src/BigQuery/VERSION rename to BigQuery/VERSION diff --git a/src/BigQuery/composer.json b/BigQuery/composer.json similarity index 57% rename from src/BigQuery/composer.json rename to BigQuery/composer.json index 9b22519c5058..2c18983c2537 100644 --- a/src/BigQuery/composer.json +++ b/BigQuery/composer.json @@ -7,6 +7,13 @@ "google/cloud-core": "^1.14", "ramsey/uuid": "~3" }, + "require-dev": { + "phpunit/phpunit": "^4.8|^5.0", + "squizlabs/php_codesniffer": "2.*", + "phpdocumentor/reflection": "^3.0", + "erusev/parsedown": "^1.6", + "google/cloud-storage": "^1.3" + }, "suggest": { "google/cloud-storage": "Makes it easier to load data from Cloud Storage into BigQuery" }, @@ -15,13 +22,18 @@ "displayName": "Google Cloud BigQuery", "id": "cloud-bigquery", "target": "GoogleCloudPlatform/google-cloud-php-bigquery.git", - "path": "src/BigQuery", - "entry": "BigQueryClient.php" + "path": "BigQuery", + "entry": "src/BigQueryClient.php" } }, "autoload": { "psr-4": { - "Google\\Cloud\\BigQuery\\": "" + "Google\\Cloud\\BigQuery\\": "src" + } + }, + "autoload-dev": { + "psr-4": { + "Google\\Cloud\\BigQuery\\Tests\\": "tests" } } } diff --git a/BigQuery/phpunit-snippets.xml.dist b/BigQuery/phpunit-snippets.xml.dist new file mode 100644 index 000000000000..b92fd83e3c1b --- /dev/null +++ b/BigQuery/phpunit-snippets.xml.dist @@ -0,0 +1,19 @@ + + + + + tests/Snippet + + + + + src + + src/V[!a-zA-Z]* + + + + diff --git a/BigQuery/phpunit-system.xml.dist b/BigQuery/phpunit-system.xml.dist new file mode 100644 index 000000000000..f6deee15a036 --- /dev/null +++ b/BigQuery/phpunit-system.xml.dist @@ -0,0 +1,16 @@ + + + + + tests/System + + + + + src + + src/V[!a-zA-Z]* + + + + diff --git a/BigQuery/phpunit.xml.dist b/BigQuery/phpunit.xml.dist new file mode 100644 index 000000000000..1c2b8f6b56d2 --- /dev/null +++ b/BigQuery/phpunit.xml.dist @@ -0,0 +1,16 @@ + + + + + tests/Unit + + + + + src + + src/V[!a-zA-Z]* + + + + diff --git a/src/BigQuery/BigQueryClient.php b/BigQuery/src/BigQueryClient.php similarity index 99% rename from src/BigQuery/BigQueryClient.php rename to BigQuery/src/BigQueryClient.php index 9e4656797694..e72dc43a6795 100644 --- a/src/BigQuery/BigQueryClient.php +++ b/BigQuery/src/BigQueryClient.php @@ -17,6 +17,7 @@ namespace Google\Cloud\BigQuery; +use Google\Auth\FetchAuthTokenInterface; use Google\Cloud\BigQuery\Connection\ConnectionInterface; use Google\Cloud\BigQuery\Connection\Rest; use Google\Cloud\BigQuery\Exception\JobException; diff --git a/src/BigQuery/Bytes.php b/BigQuery/src/Bytes.php similarity index 100% rename from src/BigQuery/Bytes.php rename to BigQuery/src/Bytes.php diff --git a/src/BigQuery/Connection/ConnectionInterface.php b/BigQuery/src/Connection/ConnectionInterface.php similarity index 100% rename from src/BigQuery/Connection/ConnectionInterface.php rename to BigQuery/src/Connection/ConnectionInterface.php diff --git a/src/BigQuery/Connection/Rest.php b/BigQuery/src/Connection/Rest.php similarity index 100% rename from src/BigQuery/Connection/Rest.php rename to BigQuery/src/Connection/Rest.php diff --git a/src/BigQuery/Connection/ServiceDefinition/bigquery-v2.json b/BigQuery/src/Connection/ServiceDefinition/bigquery-v2.json similarity index 100% rename from src/BigQuery/Connection/ServiceDefinition/bigquery-v2.json rename to BigQuery/src/Connection/ServiceDefinition/bigquery-v2.json diff --git a/src/BigQuery/CopyJobConfiguration.php b/BigQuery/src/CopyJobConfiguration.php similarity index 100% rename from src/BigQuery/CopyJobConfiguration.php rename to BigQuery/src/CopyJobConfiguration.php diff --git a/src/BigQuery/Dataset.php b/BigQuery/src/Dataset.php similarity index 100% rename from src/BigQuery/Dataset.php rename to BigQuery/src/Dataset.php diff --git a/src/BigQuery/Date.php b/BigQuery/src/Date.php similarity index 100% rename from src/BigQuery/Date.php rename to BigQuery/src/Date.php diff --git a/src/BigQuery/Exception/JobException.php b/BigQuery/src/Exception/JobException.php similarity index 100% rename from src/BigQuery/Exception/JobException.php rename to BigQuery/src/Exception/JobException.php diff --git a/src/BigQuery/ExtractJobConfiguration.php b/BigQuery/src/ExtractJobConfiguration.php similarity index 100% rename from src/BigQuery/ExtractJobConfiguration.php rename to BigQuery/src/ExtractJobConfiguration.php diff --git a/src/BigQuery/InsertResponse.php b/BigQuery/src/InsertResponse.php similarity index 100% rename from src/BigQuery/InsertResponse.php rename to BigQuery/src/InsertResponse.php diff --git a/src/BigQuery/Job.php b/BigQuery/src/Job.php similarity index 100% rename from src/BigQuery/Job.php rename to BigQuery/src/Job.php diff --git a/src/BigQuery/JobConfigurationInterface.php b/BigQuery/src/JobConfigurationInterface.php similarity index 100% rename from src/BigQuery/JobConfigurationInterface.php rename to BigQuery/src/JobConfigurationInterface.php diff --git a/src/BigQuery/JobConfigurationTrait.php b/BigQuery/src/JobConfigurationTrait.php similarity index 100% rename from src/BigQuery/JobConfigurationTrait.php rename to BigQuery/src/JobConfigurationTrait.php diff --git a/src/BigQuery/JobWaitTrait.php b/BigQuery/src/JobWaitTrait.php similarity index 100% rename from src/BigQuery/JobWaitTrait.php rename to BigQuery/src/JobWaitTrait.php diff --git a/src/BigQuery/LoadJobConfiguration.php b/BigQuery/src/LoadJobConfiguration.php similarity index 100% rename from src/BigQuery/LoadJobConfiguration.php rename to BigQuery/src/LoadJobConfiguration.php diff --git a/src/BigQuery/QueryJobConfiguration.php b/BigQuery/src/QueryJobConfiguration.php similarity index 100% rename from src/BigQuery/QueryJobConfiguration.php rename to BigQuery/src/QueryJobConfiguration.php diff --git a/src/BigQuery/QueryResults.php b/BigQuery/src/QueryResults.php similarity index 100% rename from src/BigQuery/QueryResults.php rename to BigQuery/src/QueryResults.php diff --git a/src/BigQuery/Table.php b/BigQuery/src/Table.php similarity index 100% rename from src/BigQuery/Table.php rename to BigQuery/src/Table.php diff --git a/src/BigQuery/Time.php b/BigQuery/src/Time.php similarity index 100% rename from src/BigQuery/Time.php rename to BigQuery/src/Time.php diff --git a/src/BigQuery/Timestamp.php b/BigQuery/src/Timestamp.php similarity index 100% rename from src/BigQuery/Timestamp.php rename to BigQuery/src/Timestamp.php diff --git a/src/BigQuery/ValueInterface.php b/BigQuery/src/ValueInterface.php similarity index 100% rename from src/BigQuery/ValueInterface.php rename to BigQuery/src/ValueInterface.php diff --git a/src/BigQuery/ValueMapper.php b/BigQuery/src/ValueMapper.php similarity index 100% rename from src/BigQuery/ValueMapper.php rename to BigQuery/src/ValueMapper.php diff --git a/tests/perf/BigQueryTest.php b/BigQuery/tests/Perf/BigQueryTest.php similarity index 93% rename from tests/perf/BigQueryTest.php rename to BigQuery/tests/Perf/BigQueryTest.php index be09b0c7e90d..83685c4196b5 100644 --- a/tests/perf/BigQueryTest.php +++ b/BigQuery/tests/Perf/BigQueryTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Perf; +namespace Google\Cloud\BigQuery\Tests\Perf; use Google\Cloud\BigQuery\BigQueryClient; use PHPUnit\Framework\TestCase; @@ -67,7 +67,7 @@ public function testPerf($query) public function queries() { - $queries = json_decode(file_get_contents(__DIR__ .'/fixtures/'. self::SOURCE), true); + $queries = json_decode(file_get_contents(__DIR__ . '/fixtures/' . self::SOURCE), true); foreach ($queries as $key => $q) { $queries[$key] = is_array($q) ? $q diff --git a/BigQuery/tests/Perf/bootstrap.php b/BigQuery/tests/Perf/bootstrap.php new file mode 100644 index 000000000000..38465605b9a8 --- /dev/null +++ b/BigQuery/tests/Perf/bootstrap.php @@ -0,0 +1,5 @@ + $keyFilePath diff --git a/tests/system/BigQuery/LoadDataAndQueryTest.php b/BigQuery/tests/System/LoadDataAndQueryTest.php similarity index 97% rename from tests/system/BigQuery/LoadDataAndQueryTest.php rename to BigQuery/tests/System/LoadDataAndQueryTest.php index e0ebf71001a4..8879e98bfab7 100644 --- a/tests/system/BigQuery/LoadDataAndQueryTest.php +++ b/BigQuery/tests/System/LoadDataAndQueryTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\System\BigQuery; +namespace Google\Cloud\BigQuery\Tests\System; use Google\Cloud\BigQuery\Bytes; use Google\Cloud\BigQuery\Date; @@ -367,7 +367,7 @@ public function testLoadsDataToTable($data) $this->fail('Job failed to complete within the allotted time.'); } - self::$expectedRows += count(file(__DIR__ . '/../data/table-data.json')); + self::$expectedRows += count(file(__DIR__ . '/data/table-data.json')); $actualRows = count(iterator_to_array(self::$table->rows())); $this->assertEquals(self::$expectedRows, $actualRows); @@ -375,11 +375,11 @@ public function testLoadsDataToTable($data) public function rowProvider() { - $data = file_get_contents(__DIR__ . '/../data/table-data.json'); + $data = file_get_contents(__DIR__ . '/data/table-data.json'); return [ [$data], - [fopen(__DIR__ . '/../data/table-data.json', 'r')], + [fopen(__DIR__ . '/data/table-data.json', 'r')], [Psr7\stream_for($data)] ]; } @@ -390,7 +390,7 @@ public function rowProvider() public function testLoadsDataFromStorageToTable() { $object = self::$bucket->upload( - fopen(__DIR__ . '/../data/table-data.json', 'r') + fopen(__DIR__ . '/data/table-data.json', 'r') ); $loadJobConfig = self::$table->loadFromStorage($object) @@ -408,7 +408,7 @@ public function testLoadsDataFromStorageToTable() $this->fail('Job failed to complete within the allotted time.'); } - self::$expectedRows += count(file(__DIR__ . '/../data/table-data.json')); + self::$expectedRows += count(file(__DIR__ . '/data/table-data.json')); $actualRows = count(iterator_to_array(self::$table->rows())); $this->assertEquals(self::$expectedRows, $actualRows); diff --git a/tests/system/BigQuery/ManageDatasetsTest.php b/BigQuery/tests/System/ManageDatasetsTest.php similarity index 98% rename from tests/system/BigQuery/ManageDatasetsTest.php rename to BigQuery/tests/System/ManageDatasetsTest.php index f6b1ffe1276b..f7ac6c85592a 100644 --- a/tests/system/BigQuery/ManageDatasetsTest.php +++ b/BigQuery/tests/System/ManageDatasetsTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\System\BigQuery; +namespace Google\Cloud\BigQuery\Tests\System; /** * @group bigquery diff --git a/tests/system/BigQuery/ManageJobsTest.php b/BigQuery/tests/System/ManageJobsTest.php similarity index 97% rename from tests/system/BigQuery/ManageJobsTest.php rename to BigQuery/tests/System/ManageJobsTest.php index bd4622694690..a41e5e87aeb2 100644 --- a/tests/system/BigQuery/ManageJobsTest.php +++ b/BigQuery/tests/System/ManageJobsTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\System\BigQuery; +namespace Google\Cloud\BigQuery\Tests\System; use Google\Cloud\BigQuery\Job; diff --git a/tests/system/BigQuery/ManageTablesTest.php b/BigQuery/tests/System/ManageTablesTest.php similarity index 98% rename from tests/system/BigQuery/ManageTablesTest.php rename to BigQuery/tests/System/ManageTablesTest.php index 4e53cbc466ca..289b5261a391 100644 --- a/tests/system/BigQuery/ManageTablesTest.php +++ b/BigQuery/tests/System/ManageTablesTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\System\BigQuery; +namespace Google\Cloud\BigQuery\Tests\System; use Google\Cloud\Core\ExponentialBackoff; diff --git a/tests/system/BigQuery/README.md b/BigQuery/tests/System/README.md similarity index 100% rename from tests/system/BigQuery/README.md rename to BigQuery/tests/System/README.md diff --git a/BigQuery/tests/System/bootstrap.php b/BigQuery/tests/System/bootstrap.php new file mode 100644 index 000000000000..38465605b9a8 --- /dev/null +++ b/BigQuery/tests/System/bootstrap.php @@ -0,0 +1,5 @@ + + + + + tests/Snippet + + + + + src + + src/V[!a-zA-Z]* + + + + diff --git a/Bigtable/phpunit-system.xml.dist b/Bigtable/phpunit-system.xml.dist new file mode 100644 index 000000000000..f6deee15a036 --- /dev/null +++ b/Bigtable/phpunit-system.xml.dist @@ -0,0 +1,16 @@ + + + + + tests/System + + + + + src + + src/V[!a-zA-Z]* + + + + diff --git a/Bigtable/phpunit.xml.dist b/Bigtable/phpunit.xml.dist new file mode 100644 index 000000000000..b27349b8debf --- /dev/null +++ b/Bigtable/phpunit.xml.dist @@ -0,0 +1,17 @@ + + + + + tests/Unit + + + + + src + + src/V[!a-zA-Z]* + src/*/V[!a-zA-Z]* + + + + diff --git a/src/Bigtable/Admin/README.md b/Bigtable/src/Admin/README.md similarity index 100% rename from src/Bigtable/Admin/README.md rename to Bigtable/src/Admin/README.md diff --git a/src/Bigtable/Admin/V2/BigtableInstanceAdminClient.php b/Bigtable/src/Admin/V2/BigtableInstanceAdminClient.php similarity index 100% rename from src/Bigtable/Admin/V2/BigtableInstanceAdminClient.php rename to Bigtable/src/Admin/V2/BigtableInstanceAdminClient.php diff --git a/src/Bigtable/Admin/V2/BigtableTableAdminClient.php b/Bigtable/src/Admin/V2/BigtableTableAdminClient.php similarity index 100% rename from src/Bigtable/Admin/V2/BigtableTableAdminClient.php rename to Bigtable/src/Admin/V2/BigtableTableAdminClient.php diff --git a/src/Bigtable/Admin/V2/Gapic/BigtableInstanceAdminGapicClient.php b/Bigtable/src/Admin/V2/Gapic/BigtableInstanceAdminGapicClient.php similarity index 100% rename from src/Bigtable/Admin/V2/Gapic/BigtableInstanceAdminGapicClient.php rename to Bigtable/src/Admin/V2/Gapic/BigtableInstanceAdminGapicClient.php diff --git a/src/Bigtable/Admin/V2/Gapic/BigtableTableAdminGapicClient.php b/Bigtable/src/Admin/V2/Gapic/BigtableTableAdminGapicClient.php similarity index 100% rename from src/Bigtable/Admin/V2/Gapic/BigtableTableAdminGapicClient.php rename to Bigtable/src/Admin/V2/Gapic/BigtableTableAdminGapicClient.php diff --git a/src/Bigtable/Admin/V2/README.md b/Bigtable/src/Admin/V2/README.md similarity index 100% rename from src/Bigtable/Admin/V2/README.md rename to Bigtable/src/Admin/V2/README.md diff --git a/src/Bigtable/Admin/V2/resources/bigtable_instance_admin_client_config.json b/Bigtable/src/Admin/V2/resources/bigtable_instance_admin_client_config.json similarity index 100% rename from src/Bigtable/Admin/V2/resources/bigtable_instance_admin_client_config.json rename to Bigtable/src/Admin/V2/resources/bigtable_instance_admin_client_config.json diff --git a/src/Bigtable/Admin/V2/resources/bigtable_instance_admin_descriptor_config.php b/Bigtable/src/Admin/V2/resources/bigtable_instance_admin_descriptor_config.php similarity index 100% rename from src/Bigtable/Admin/V2/resources/bigtable_instance_admin_descriptor_config.php rename to Bigtable/src/Admin/V2/resources/bigtable_instance_admin_descriptor_config.php diff --git a/src/Bigtable/Admin/V2/resources/bigtable_instance_admin_rest_client_config.php b/Bigtable/src/Admin/V2/resources/bigtable_instance_admin_rest_client_config.php similarity index 100% rename from src/Bigtable/Admin/V2/resources/bigtable_instance_admin_rest_client_config.php rename to Bigtable/src/Admin/V2/resources/bigtable_instance_admin_rest_client_config.php diff --git a/src/Bigtable/Admin/V2/resources/bigtable_table_admin_client_config.json b/Bigtable/src/Admin/V2/resources/bigtable_table_admin_client_config.json similarity index 100% rename from src/Bigtable/Admin/V2/resources/bigtable_table_admin_client_config.json rename to Bigtable/src/Admin/V2/resources/bigtable_table_admin_client_config.json diff --git a/src/Bigtable/Admin/V2/resources/bigtable_table_admin_descriptor_config.php b/Bigtable/src/Admin/V2/resources/bigtable_table_admin_descriptor_config.php similarity index 100% rename from src/Bigtable/Admin/V2/resources/bigtable_table_admin_descriptor_config.php rename to Bigtable/src/Admin/V2/resources/bigtable_table_admin_descriptor_config.php diff --git a/src/Bigtable/Admin/V2/resources/bigtable_table_admin_rest_client_config.php b/Bigtable/src/Admin/V2/resources/bigtable_table_admin_rest_client_config.php similarity index 100% rename from src/Bigtable/Admin/V2/resources/bigtable_table_admin_rest_client_config.php rename to Bigtable/src/Admin/V2/resources/bigtable_table_admin_rest_client_config.php diff --git a/src/Bigtable/V2/BigtableClient.php b/Bigtable/src/V2/BigtableClient.php similarity index 100% rename from src/Bigtable/V2/BigtableClient.php rename to Bigtable/src/V2/BigtableClient.php diff --git a/src/Bigtable/V2/Gapic/BigtableGapicClient.php b/Bigtable/src/V2/Gapic/BigtableGapicClient.php similarity index 100% rename from src/Bigtable/V2/Gapic/BigtableGapicClient.php rename to Bigtable/src/V2/Gapic/BigtableGapicClient.php diff --git a/src/Bigtable/V2/README.md b/Bigtable/src/V2/README.md similarity index 100% rename from src/Bigtable/V2/README.md rename to Bigtable/src/V2/README.md diff --git a/src/Bigtable/V2/resources/bigtable_client_config.json b/Bigtable/src/V2/resources/bigtable_client_config.json similarity index 100% rename from src/Bigtable/V2/resources/bigtable_client_config.json rename to Bigtable/src/V2/resources/bigtable_client_config.json diff --git a/src/Bigtable/V2/resources/bigtable_descriptor_config.php b/Bigtable/src/V2/resources/bigtable_descriptor_config.php similarity index 100% rename from src/Bigtable/V2/resources/bigtable_descriptor_config.php rename to Bigtable/src/V2/resources/bigtable_descriptor_config.php diff --git a/src/Bigtable/V2/resources/bigtable_rest_client_config.php b/Bigtable/src/V2/resources/bigtable_rest_client_config.php similarity index 100% rename from src/Bigtable/V2/resources/bigtable_rest_client_config.php rename to Bigtable/src/V2/resources/bigtable_rest_client_config.php diff --git a/tests/system/Bigtable/BigtableInstanceAdminTest.php b/Bigtable/tests/System/BigtableInstanceAdminTest.php similarity index 93% rename from tests/system/Bigtable/BigtableInstanceAdminTest.php rename to Bigtable/tests/System/BigtableInstanceAdminTest.php index eb8cb6a7d004..7f02622ee8f5 100644 --- a/tests/system/Bigtable/BigtableInstanceAdminTest.php +++ b/Bigtable/tests/System/BigtableInstanceAdminTest.php @@ -15,14 +15,14 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\System\Bigtable; +namespace Google\Cloud\Bigtable\Tests\System; use Google\Auth\CredentialsLoader; use Google\Cloud\Bigtable\Admin\V2\BigtableInstanceAdminClient; use Google\Cloud\Bigtable\Admin\V2\ListInstancesResponse; -use Google\Cloud\Core\Testing\System\SystemTestCase; +use PHPUnit\Framework\TestCase; -class BigtableInstanceAdminClientTest extends SystemTestCase +class BigtableInstanceAdminClientTest extends TestCase { protected static $grpcClient; protected static $restClient; diff --git a/Bigtable/tests/System/bootstrap.php b/Bigtable/tests/System/bootstrap.php new file mode 100644 index 000000000000..38465605b9a8 --- /dev/null +++ b/Bigtable/tests/System/bootstrap.php @@ -0,0 +1,5 @@ + + + + + tests/Snippet + + + + + src + + src/V[!a-zA-Z]* + + + + diff --git a/Container/phpunit-system.xml.dist b/Container/phpunit-system.xml.dist new file mode 100644 index 000000000000..f6deee15a036 --- /dev/null +++ b/Container/phpunit-system.xml.dist @@ -0,0 +1,16 @@ + + + + + tests/System + + + + + src + + src/V[!a-zA-Z]* + + + + diff --git a/Container/phpunit.xml.dist b/Container/phpunit.xml.dist new file mode 100644 index 000000000000..1c2b8f6b56d2 --- /dev/null +++ b/Container/phpunit.xml.dist @@ -0,0 +1,16 @@ + + + + + tests/Unit + + + + + src + + src/V[!a-zA-Z]* + + + + diff --git a/src/Container/V1/ClusterManagerClient.php b/Container/src/V1/ClusterManagerClient.php similarity index 100% rename from src/Container/V1/ClusterManagerClient.php rename to Container/src/V1/ClusterManagerClient.php diff --git a/src/Container/V1/Gapic/ClusterManagerGapicClient.php b/Container/src/V1/Gapic/ClusterManagerGapicClient.php similarity index 100% rename from src/Container/V1/Gapic/ClusterManagerGapicClient.php rename to Container/src/V1/Gapic/ClusterManagerGapicClient.php diff --git a/src/Container/V1/README.md b/Container/src/V1/README.md similarity index 100% rename from src/Container/V1/README.md rename to Container/src/V1/README.md diff --git a/src/Container/V1/resources/cluster_manager_client_config.json b/Container/src/V1/resources/cluster_manager_client_config.json similarity index 100% rename from src/Container/V1/resources/cluster_manager_client_config.json rename to Container/src/V1/resources/cluster_manager_client_config.json diff --git a/src/Container/V1/resources/cluster_manager_descriptor_config.php b/Container/src/V1/resources/cluster_manager_descriptor_config.php similarity index 100% rename from src/Container/V1/resources/cluster_manager_descriptor_config.php rename to Container/src/V1/resources/cluster_manager_descriptor_config.php diff --git a/src/Container/V1/resources/cluster_manager_rest_client_config.php b/Container/src/V1/resources/cluster_manager_rest_client_config.php similarity index 100% rename from src/Container/V1/resources/cluster_manager_rest_client_config.php rename to Container/src/V1/resources/cluster_manager_rest_client_config.php diff --git a/tests/system/Container/ClusterManagerClientTest.php b/Container/tests/System/ClusterManagerClientTest.php similarity index 93% rename from tests/system/Container/ClusterManagerClientTest.php rename to Container/tests/System/ClusterManagerClientTest.php index a6376393a1b9..c61d64473d54 100644 --- a/tests/system/Container/ClusterManagerClientTest.php +++ b/Container/tests/System/ClusterManagerClientTest.php @@ -15,14 +15,14 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\System\Container; +namespace Google\Cloud\Container\Tests\System; use Google\Auth\CredentialsLoader; use Google\Cloud\Container\V1\ClusterManagerClient; use Google\Cloud\Container\V1\ListOperationsResponse; -use Google\Cloud\Core\Testing\System\SystemTestCase; +use PHPUnit\Framework\TestCase; -class ClusterManagerClientTest extends SystemTestCase +class ClusterManagerClientTest extends TestCase { const ZONE = 'us-central1-b'; diff --git a/Container/tests/System/bootstrap.php b/Container/tests/System/bootstrap.php new file mode 100644 index 000000000000..38465605b9a8 --- /dev/null +++ b/Container/tests/System/bootstrap.php @@ -0,0 +1,5 @@ + + + + + tests/Snippet + + + + + src + + src/V[!a-zA-Z]* + + + + diff --git a/Core/phpunit-system.xml.dist b/Core/phpunit-system.xml.dist new file mode 100644 index 000000000000..f6deee15a036 --- /dev/null +++ b/Core/phpunit-system.xml.dist @@ -0,0 +1,16 @@ + + + + + tests/System + + + + + src + + src/V[!a-zA-Z]* + + + + diff --git a/Core/phpunit.xml.dist b/Core/phpunit.xml.dist new file mode 100644 index 000000000000..1c2b8f6b56d2 --- /dev/null +++ b/Core/phpunit.xml.dist @@ -0,0 +1,16 @@ + + + + + tests/Unit + + + + + src + + src/V[!a-zA-Z]* + + + + diff --git a/Core/snippet-bootstrap.php b/Core/snippet-bootstrap.php new file mode 100644 index 000000000000..c36fafda5136 --- /dev/null +++ b/Core/snippet-bootstrap.php @@ -0,0 +1,5 @@ +projectRootPath = $projectRootPath; + $this->fileTypes = $fileTypes; + $this->testPaths = $testPaths; + $this->excludes = $excludes; + + parent::__construct($iterator); + } + + /** + * Decides whether to include the file or exclude it. + * + * @return bool + * + * @experimental + * @internal + */ + public function accept() + { + /** @var \SplFileInfo */ + $file = parent::current(); + + $path = '/' . trim(str_replace($this->projectRootPath, '', realpath($file->getPathName())), '/'); + + if (!in_array($file->getExtension(), $this->fileTypes)) { + return false; + } + + foreach ($this->excludes as $exclude) { + if ($exclude instanceof RegexFileFilter) { + $pattern = $exclude->regex; + + if (preg_match('/'. $pattern .'/', $path) === 1) { + return false; + } + + continue; + } + + if (strpos($exclude, '/') !== 0 && strpos($path, $exclude) !== false) { + return false; + } + + if (strpos($path, $exclude) === 0) { + return false; + } + } + + foreach ($this->testPaths as $testPath) { + if (strpos($path, $testPath) !== false) { + return false; + } + } + + return true; + } +} diff --git a/src/Core/Testing/GrpcTestTrait.php b/Core/src/Testing/GrpcTestTrait.php similarity index 100% rename from src/Core/Testing/GrpcTestTrait.php rename to Core/src/Testing/GrpcTestTrait.php diff --git a/src/Core/Testing/KeyPairGenerateTrait.php b/Core/src/Testing/KeyPairGenerateTrait.php similarity index 100% rename from src/Core/Testing/KeyPairGenerateTrait.php rename to Core/src/Testing/KeyPairGenerateTrait.php diff --git a/src/Core/Testing/Lock/MockGlobals.php b/Core/src/Testing/Lock/MockGlobals.php similarity index 100% rename from src/Core/Testing/Lock/MockGlobals.php rename to Core/src/Testing/Lock/MockGlobals.php diff --git a/src/Core/Testing/Lock/MockValues.php b/Core/src/Testing/Lock/MockValues.php similarity index 100% rename from src/Core/Testing/Lock/MockValues.php rename to Core/src/Testing/Lock/MockValues.php diff --git a/src/Core/Testing/README.md b/Core/src/Testing/README.md similarity index 100% rename from src/Core/Testing/README.md rename to Core/src/Testing/README.md diff --git a/src/Core/Testing/Snippet/Container.php b/Core/src/Testing/Snippet/Container.php similarity index 79% rename from src/Core/Testing/Snippet/Container.php rename to Core/src/Testing/Snippet/Container.php index 541da952f7c3..bfc0e9147d6e 100644 --- a/src/Core/Testing/Snippet/Container.php +++ b/Core/src/Testing/Snippet/Container.php @@ -27,4 +27,16 @@ class Container { public static $coverage; public static $parser; + + /** + * Reset the container statics. + * + * @experimental + * @internal + */ + public static function reset() + { + self::$coverage = null; + self::$parser = null; + } } diff --git a/src/Core/Testing/Snippet/Coverage/Coverage.php b/Core/src/Testing/Snippet/Coverage/Coverage.php similarity index 90% rename from src/Core/Testing/Snippet/Coverage/Coverage.php rename to Core/src/Testing/Snippet/Coverage/Coverage.php index 9e7e757a05a4..fd807d85adc2 100644 --- a/src/Core/Testing/Snippet/Coverage/Coverage.php +++ b/Core/src/Testing/Snippet/Coverage/Coverage.php @@ -17,6 +17,8 @@ namespace Google\Cloud\Core\Testing\Snippet\Coverage; +use Google\Cloud\Core\Testing\Snippet\Parser\Snippet; + /** * Class Coverage * @@ -35,7 +37,7 @@ class Coverage protected $scanner; /** - * @var \Google\Cloud\Core\Testing\Snippet\Parser\Snippet[] + * @var Snippet[] */ private $snippets = []; @@ -63,7 +65,7 @@ private function getSnippetExcludeList() /** * Creates a list of all snippets which should be covered. * - * @return \Google\Cloud\Core\Testing\Snippet\Parser\Snippet[] + * @return Snippet[] * * @experimental * @internal @@ -95,7 +97,7 @@ public function cover($identifier) /** * Return a list of all snippets not marked a covered. * - * @return \Google\Cloud\Core\Testing\Snippet\Parser\Snippet[] + * @return Snippet[] * * @experimental * @internal @@ -107,7 +109,7 @@ public function uncovered() /** * @param $identifier - * @return \Google\Cloud\Core\Testing\Snippet\Parser\Snippet|null + * @return Snippet|null * * @experimental * @internal diff --git a/src/Core/Testing/Snippet/Coverage/ExcludeFilter.php b/Core/src/Testing/Snippet/Coverage/ExcludeFilter.php similarity index 88% rename from src/Core/Testing/Snippet/Coverage/ExcludeFilter.php rename to Core/src/Testing/Snippet/Coverage/ExcludeFilter.php index da9a254f4dc4..6ca0bce0b65b 100644 --- a/src/Core/Testing/Snippet/Coverage/ExcludeFilter.php +++ b/Core/src/Testing/Snippet/Coverage/ExcludeFilter.php @@ -21,7 +21,10 @@ use Iterator; /** - * ExcludeFilter can be used to exclude directories from an iterable list + * Class ExcludeFilter is used to exclude directories from an iterable list + * + * @experimental + * @internal */ class ExcludeFilter extends FilterIterator { @@ -39,7 +42,7 @@ public function __construct(Iterator $iterator, array $excludeDirs) } /** - * @return bool + * @return bool Determines whether to accept or exclude a path */ public function accept() { diff --git a/Core/src/Testing/Snippet/Coverage/ResultPrinter.php b/Core/src/Testing/Snippet/Coverage/ResultPrinter.php new file mode 100644 index 000000000000..122f9e5e5d4b --- /dev/null +++ b/Core/src/Testing/Snippet/Coverage/ResultPrinter.php @@ -0,0 +1,75 @@ +uncovered(); + Container::reset(); + + if (!empty($uncovered)) { + $this->writeWithColor('bg-red', sprintf("NOTICE: %s uncovered snippets!", count($uncovered))); + + if ($this->verbose) { + $i = 0; + foreach ($uncovered as $snippet) { + $fqn = $snippet->fqn(); + $type = (strpos($fqn, '::') !== false) + ? 'Method' + : 'Class'; + + $this->write("$i: $type example: {$snippet->fqn()}[{$snippet->index()}]"); + $this->writeNewLine(); + $this->write("Declared on or around {$snippet->file()}:{$snippet->line()}"); + $this->writeNewLine(); + $this->writeNewLine(); + + $i++; + } + } else { + $this->write("Run command with `--verbose` flag to see uncovered snippets."); + } + + if (extension_loaded('grpc')) { + exit(1); + } + } + } +} diff --git a/src/Core/Testing/Snippet/Coverage/Scanner.php b/Core/src/Testing/Snippet/Coverage/Scanner.php similarity index 75% rename from src/Core/Testing/Snippet/Coverage/Scanner.php rename to Core/src/Testing/Snippet/Coverage/Scanner.php index 26c6724846fd..c5f725db3350 100644 --- a/src/Core/Testing/Snippet/Coverage/Scanner.php +++ b/Core/src/Testing/Snippet/Coverage/Scanner.php @@ -17,6 +17,7 @@ namespace Google\Cloud\Core\Testing\Snippet\Coverage; +use Google\Cloud\Core\Testing\FileListFilterIterator; use Google\Cloud\Core\Testing\Snippet\Parser\Parser; use phpDocumentor\Reflection\FileReflector; @@ -39,20 +40,27 @@ class Scanner implements ScannerInterface */ private $basePath; + /** + * @var array + */ + private $exclude; + /** * @param Parser $parser An instance of the Snippet Parser. - * @param \Iterator|string $basepath The path(s) to scan for PHP files. + * @param \Iterator|string $basePath The path(s) to scan for PHP files. + * @param array $exclude A list of patterns to exclude. * * @experimental * @internal */ - public function __construct(Parser $parser, $basePath) + public function __construct(Parser $parser, $basePath, array $exclude = []) { $this->parser = $parser; if (is_string($basePath)) { $basePath = [$basePath]; } $this->basePath = $basePath; + $this->exclude = $exclude; } /** @@ -66,17 +74,22 @@ public function __construct(Parser $parser, $basePath) public function files() { $files = []; - foreach ($this->basePath as $basePath) { - $regexIterator = new \RegexIterator( - new \RecursiveIteratorIterator( - new \RecursiveDirectoryIterator($basePath) - ), - '/^.+\.php$/i', - \RecursiveRegexIterator::GET_MATCH + + foreach ($this->basePath as $path) { + $directoryIterator = new \RecursiveDirectoryIterator($path); + $iterator = new \RecursiveIteratorIterator($directoryIterator); + $fileList = new FileListFilterIterator( + $path, + $iterator, + ['php'], + [ + '/tests/' + ], + $this->exclude ); - foreach ($regexIterator as $item) { - array_push($files, $item[0]); + foreach ($fileList as $item) { + array_push($files, realPath($item->getPathName())); } } @@ -96,6 +109,8 @@ private function checkExclude($className, array $exclude) /** * Retrieve a list of classes in the given PHP files. * + * @param array $files + * @param array $exclude * @return string[] * * @experimental @@ -124,6 +139,7 @@ public function classes(array $files, array $exclude = []) * * @experimental * @internal + * @throws \ReflectionException */ public function snippets(array $classes) { diff --git a/src/Core/Testing/Snippet/Coverage/ScannerInterface.php b/Core/src/Testing/Snippet/Coverage/ScannerInterface.php similarity index 100% rename from src/Core/Testing/Snippet/Coverage/ScannerInterface.php rename to Core/src/Testing/Snippet/Coverage/ScannerInterface.php diff --git a/src/Core/Testing/Snippet/Fixtures.php b/Core/src/Testing/Snippet/Fixtures.php similarity index 77% rename from src/Core/Testing/Snippet/Fixtures.php rename to Core/src/Testing/Snippet/Fixtures.php index cbf7132bce2e..314f0cc3bec4 100644 --- a/src/Core/Testing/Snippet/Fixtures.php +++ b/Core/src/Testing/Snippet/Fixtures.php @@ -18,14 +18,17 @@ namespace Google\Cloud\Core\Testing\Snippet; /** - * Fixtures that can be used for testing + * Class containing static functions to provide path to shared test fixtures + * + * @experimental + * @internal */ class Fixtures { /** - * @return string Location of keyfile-stub fixture + * @return string Path the keyfile-stub.json fixture */ - public static function keyfileStubFixture() + public static function KEYFILE_STUB_FIXTURE() { return __DIR__ . '/keyfile-stub.json'; } diff --git a/src/Core/Testing/Snippet/Parser/InvokeResult.php b/Core/src/Testing/Snippet/Parser/InvokeResult.php similarity index 100% rename from src/Core/Testing/Snippet/Parser/InvokeResult.php rename to Core/src/Testing/Snippet/Parser/InvokeResult.php diff --git a/src/Core/Testing/Snippet/Parser/Parser.php b/Core/src/Testing/Snippet/Parser/Parser.php similarity index 100% rename from src/Core/Testing/Snippet/Parser/Parser.php rename to Core/src/Testing/Snippet/Parser/Parser.php diff --git a/src/Core/Testing/Snippet/Parser/Snippet.php b/Core/src/Testing/Snippet/Parser/Snippet.php similarity index 97% rename from src/Core/Testing/Snippet/Parser/Snippet.php rename to Core/src/Testing/Snippet/Parser/Snippet.php index ddf3398863f4..3499d75d1066 100644 --- a/src/Core/Testing/Snippet/Parser/Snippet.php +++ b/Core/src/Testing/Snippet/Parser/Snippet.php @@ -30,7 +30,7 @@ class Snippet implements \JsonSerializable /** * @var array */ - private $options; + private $config; /** * @var array @@ -84,6 +84,16 @@ public function file() return $this->config['file']; } + /** + * The Snippet fully-qualified name. + * + * @return string + */ + public function fqn() + { + return $this->config['fqn']; + } + /** * The line number where the snippet's method or class is declared. * diff --git a/src/Core/Testing/Snippet/SnippetTestCase.php b/Core/src/Testing/Snippet/SnippetTestCase.php similarity index 100% rename from src/Core/Testing/Snippet/SnippetTestCase.php rename to Core/src/Testing/Snippet/SnippetTestCase.php diff --git a/src/Core/Testing/Snippet/keyfile-stub.json b/Core/src/Testing/Snippet/keyfile-stub.json similarity index 100% rename from src/Core/Testing/Snippet/keyfile-stub.json rename to Core/src/Testing/Snippet/keyfile-stub.json diff --git a/src/Core/Testing/SpannerOperationRefreshTrait.php b/Core/src/Testing/SpannerOperationRefreshTrait.php similarity index 97% rename from src/Core/Testing/SpannerOperationRefreshTrait.php rename to Core/src/Testing/SpannerOperationRefreshTrait.php index 5f3e743eb402..57e5cde23336 100644 --- a/src/Core/Testing/SpannerOperationRefreshTrait.php +++ b/Core/src/Testing/SpannerOperationRefreshTrait.php @@ -22,6 +22,9 @@ /** * Refresh Spanner operation class + * + * @experimental + * @internal */ trait SpannerOperationRefreshTrait { diff --git a/src/Core/Testing/StubTrait.php b/Core/src/Testing/StubTrait.php similarity index 100% rename from src/Core/Testing/StubTrait.php rename to Core/src/Testing/StubTrait.php diff --git a/src/Core/Testing/System/DeletionQueue.php b/Core/src/Testing/System/DeletionQueue.php similarity index 100% rename from src/Core/Testing/System/DeletionQueue.php rename to Core/src/Testing/System/DeletionQueue.php diff --git a/src/Core/Testing/System/SystemTestCase.php b/Core/src/Testing/System/SystemTestCase.php similarity index 98% rename from src/Core/Testing/System/SystemTestCase.php rename to Core/src/Testing/System/SystemTestCase.php index 1cb6fe677b89..d05627e49a6d 100644 --- a/src/Core/Testing/System/SystemTestCase.php +++ b/Core/src/Testing/System/SystemTestCase.php @@ -42,7 +42,9 @@ class SystemTestCase extends TestCase */ public static function setupQueue() { - self::$deletionQueue = new DeletionQueue; + if (!self::$deletionQueue) { + self::$deletionQueue = new DeletionQueue; + } } /** diff --git a/Core/src/Testing/TestHelpers.php b/Core/src/Testing/TestHelpers.php new file mode 100644 index 000000000000..c1d970f63c43 --- /dev/null +++ b/Core/src/Testing/TestHelpers.php @@ -0,0 +1,240 @@ +newInstanceArgs($args); + } + + /** + * Get a trait implementation. + * + * @param string $trait The fully-qualified name of the trait to implement. + * @return mixed + * + * @experimental + * @internal + */ + public static function impl($trait, array $props = []) + { + $properties = []; + foreach ($props as $prop) { + $properties[] = 'private $' . $prop . ';'; + } + + $tpl = 'class %s { + use %s; + use \Google\Cloud\Core\Testing\StubTrait; + private $___props = \'%s\'; + %s + public function call($fn, array $args = []) { return call_user_func_array([$this, $fn], $args); } + }'; + + $name = 'Trait' . sha1($trait . json_encode($props)); + + if (!class_exists($name)) { + eval(sprintf($tpl, $name, $trait, json_encode($props), implode("\n", $properties))); + } + + return new $name; + } + + /** + * Setup snippet tests support. + * + * @return void + * @experimental + * @internal + */ + public static function snippetBootstrap() + { + putenv('GOOGLE_APPLICATION_CREDENTIALS='. \Google\Cloud\Core\Testing\Snippet\Fixtures::KEYFILE_STUB_FIXTURE()); + + $parser = new Parser; + $scanner = new Scanner($parser, self::projectRoot(), ['/vendor/', '/dev/']); + $coverage = new Coverage($scanner); + $coverage->buildListToCover(); + + Container::$coverage = $coverage; + Container::$parser = $parser; + } + + /** + * Setup performance tests support. + * + * @return void + * @experimental + * @internal + */ + public static function perfBootstrap() + { + $bootstraps = glob(self::projectRoot() .'/*/tests/Perf/bootstrap.php'); + foreach ($bootstraps as $bootstrap) { + require_once $bootstrap; + } + } + + /** + * Check that the required environment variable keyfile paths are set and exist. + * + * @param array|string $env The environment variable(s) required. + * @throws \RuntimeException + * @experimental + * @internal + */ + public static function requireKeyfile($env) + { + $env = is_array($env) ? $env : [$env]; + + foreach ($env as $var) { + if (!getenv($var)) { + throw new \RuntimeException(sprintf( + 'Please set the \'%s\' env var to run the tests', + $var + )); + } + + $path = getenv($var); + if (!file_exists($path)) { + throw new \RuntimeException(sprintf( + 'The path \`%s\` specified in environment variable `%s` does not exist.', + $path, + $var + )); + } + } + } + + /** + * Setup stuff needed for the system test runner. + * + * This method can only be called once per run. Subsequent calls will thrown \RuntimeException. + * + * @internal + * @experimental + */ + public static function systemBootstrap() + { + static $started = false; + + if ($started) { + throw new \RuntimeException('system tests cannot be bootstrapped more than once.'); + } + + SystemTestCase::setupQueue(); + + $bootstraps = glob(self::projectRoot() .'/*/tests/System/bootstrap.php'); + foreach ($bootstraps as $bootstrap) { + require_once $bootstrap; + } + + // This should always be last. + self::systemTestShutdown(function () { + SystemTestCase::processQueue(); + }); + + $started = true; + } + + /** + * Add cleanup function for system tests. + * + * Calls to this method enqueue a PHP shutdown function, scoped to the parent + * PID. + * + * @param callable $shutdown The shutdown function. + * @return void + * @experimental + * @internal + */ + public static function systemTestShutdown(callable $shutdown) + { + $pid = getmypid(); + register_shutdown_function(function () use ($pid, $shutdown) { + // Skip flushing deletion queue if exiting a forked process. + if ($pid !== getmypid()) { + return; + } + + $shutdown(); + }); + } + + /** + * Determine the path of the project root based on where the composer + * autoloader is located. + * + * @return string + * @experimental + * @internal + */ + private static function projectRoot() + { + static $projectRoot; + + if (!$projectRoot) { + $ref = new \ReflectionClass(\Composer\Autoload\ClassLoader::class); + $projectRoot = dirname(dirname(dirname($ref->getFileName()))); + } + + return $projectRoot; + } +} diff --git a/src/Core/Timestamp.php b/Core/src/Timestamp.php similarity index 100% rename from src/Core/Timestamp.php rename to Core/src/Timestamp.php diff --git a/src/Core/Upload/AbstractUploader.php b/Core/src/Upload/AbstractUploader.php similarity index 100% rename from src/Core/Upload/AbstractUploader.php rename to Core/src/Upload/AbstractUploader.php diff --git a/src/Core/Upload/MultipartUploader.php b/Core/src/Upload/MultipartUploader.php similarity index 100% rename from src/Core/Upload/MultipartUploader.php rename to Core/src/Upload/MultipartUploader.php diff --git a/src/Core/Upload/ResumableUploader.php b/Core/src/Upload/ResumableUploader.php similarity index 100% rename from src/Core/Upload/ResumableUploader.php rename to Core/src/Upload/ResumableUploader.php diff --git a/src/Core/Upload/SignedUrlUploader.php b/Core/src/Upload/SignedUrlUploader.php similarity index 100% rename from src/Core/Upload/SignedUrlUploader.php rename to Core/src/Upload/SignedUrlUploader.php diff --git a/src/Core/Upload/StreamableUploader.php b/Core/src/Upload/StreamableUploader.php similarity index 100% rename from src/Core/Upload/StreamableUploader.php rename to Core/src/Upload/StreamableUploader.php diff --git a/src/Core/UriTrait.php b/Core/src/UriTrait.php similarity index 100% rename from src/Core/UriTrait.php rename to Core/src/UriTrait.php diff --git a/src/Core/ValidateTrait.php b/Core/src/ValidateTrait.php similarity index 100% rename from src/Core/ValidateTrait.php rename to Core/src/ValidateTrait.php diff --git a/src/Core/ValueMapperTrait.php b/Core/src/ValueMapperTrait.php similarity index 100% rename from src/Core/ValueMapperTrait.php rename to Core/src/ValueMapperTrait.php diff --git a/src/Core/WhitelistTrait.php b/Core/src/WhitelistTrait.php similarity index 100% rename from src/Core/WhitelistTrait.php rename to Core/src/WhitelistTrait.php diff --git a/Core/system-bootstrap.php b/Core/system-bootstrap.php new file mode 100644 index 000000000000..e49b0c19402c --- /dev/null +++ b/Core/system-bootstrap.php @@ -0,0 +1,5 @@ +setPsr4('Google\Cloud\\', '/tmp'); + foreach (self::getApis() as $api) { + $newAutoloader->setPsr4("Google\\Cloud\\$api\\", '/tmp'); + } spl_autoload_register(self::$newAutoloadFunc = [$newAutoloader, 'loadClass']); spl_autoload_unregister(self::$previousAutoloadFunc = $function); } @@ -49,6 +52,34 @@ public static function tearDownAfterClass() spl_autoload_unregister(self::$newAutoloadFunc); } + private static function getApis() + { + return [ + "BigQuery", + "Bigtable", + "Container", + "Core", + "Dataproc", + "Datastore", + "Debugger", + "Dlp", + "ErrorReporting", + "Firestore", + "Language", + "Logging", + "Monitoring", + "OsLogin", + "PubSub", + "Spanner", + "Speech", + "Storage", + "Trace", + "Translate", + "VideoIntelligence", + "Vision", + ]; + } + public function serviceBuilderMethods() { return [ diff --git a/tests/unit/Core/SysvTraitTest.php b/Core/tests/Unit/SysvTraitTest.php similarity index 97% rename from tests/unit/Core/SysvTraitTest.php rename to Core/tests/Unit/SysvTraitTest.php index 14ae1deb60ca..338b0c94fe61 100644 --- a/tests/unit/Core/SysvTraitTest.php +++ b/Core/tests/Unit/SysvTraitTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Unit\Core; +namespace Google\Cloud\Core\Tests\Unit; use Google\Cloud\Core\SysvTrait; use PHPUnit\Framework\TestCase; diff --git a/tests/unit/Core/TimestampTest.php b/Core/tests/Unit/TimestampTest.php similarity index 100% rename from tests/unit/Core/TimestampTest.php rename to Core/tests/Unit/TimestampTest.php diff --git a/tests/unit/Core/Upload/MultipartUploaderTest.php b/Core/tests/Unit/Upload/MultipartUploaderTest.php similarity index 97% rename from tests/unit/Core/Upload/MultipartUploaderTest.php rename to Core/tests/Unit/Upload/MultipartUploaderTest.php index 0806497d9563..a6f0635aa0c8 100644 --- a/tests/unit/Core/Upload/MultipartUploaderTest.php +++ b/Core/tests/Unit/Upload/MultipartUploaderTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Unit\Core\Upload; +namespace Google\Cloud\Core\Tests\Unit\Upload; use Google\Cloud\Core\RequestWrapper; use Google\Cloud\Core\Upload\MultipartUploader; diff --git a/tests/unit/Core/Upload/ResumableUploaderTest.php b/Core/tests/Unit/Upload/ResumableUploaderTest.php similarity index 99% rename from tests/unit/Core/Upload/ResumableUploaderTest.php rename to Core/tests/Unit/Upload/ResumableUploaderTest.php index 93bdef5c6d6b..d87799806b8c 100644 --- a/tests/unit/Core/Upload/ResumableUploaderTest.php +++ b/Core/tests/Unit/Upload/ResumableUploaderTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Unit\Core\Upload; +namespace Google\Cloud\Core\Tests\Unit\Upload; use Google\Cloud\Core\Exception\GoogleException; use Google\Cloud\Core\RequestWrapper; diff --git a/tests/unit/Core/Upload/SignedUrlUploaderTest.php b/Core/tests/Unit/Upload/SignedUrlUploaderTest.php similarity index 97% rename from tests/unit/Core/Upload/SignedUrlUploaderTest.php rename to Core/tests/Unit/Upload/SignedUrlUploaderTest.php index 3e943c9df246..02c0f971e629 100644 --- a/tests/unit/Core/Upload/SignedUrlUploaderTest.php +++ b/Core/tests/Unit/Upload/SignedUrlUploaderTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Unit\Core\Upload; +namespace Google\Cloud\Core\Tests\Unit\Upload; use Google\Cloud\Core\Exception\GoogleException; use Google\Cloud\Core\RequestWrapper; diff --git a/tests/unit/Core/Upload/StreamableUploaderTest.php b/Core/tests/Unit/Upload/StreamableUploaderTest.php similarity index 99% rename from tests/unit/Core/Upload/StreamableUploaderTest.php rename to Core/tests/Unit/Upload/StreamableUploaderTest.php index f180e4474cff..b78381f7f176 100644 --- a/tests/unit/Core/Upload/StreamableUploaderTest.php +++ b/Core/tests/Unit/Upload/StreamableUploaderTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Unit\Core\Upload; +namespace Google\Cloud\Core\Tests\Unit\Upload; use Google\Cloud\Core\Exception\GoogleException; use Google\Cloud\Core\RequestWrapper; diff --git a/tests/unit/Core/UriTraitTest.php b/Core/tests/Unit/UriTraitTest.php similarity index 97% rename from tests/unit/Core/UriTraitTest.php rename to Core/tests/Unit/UriTraitTest.php index c3a8f36be837..d5761d493152 100644 --- a/tests/unit/Core/UriTraitTest.php +++ b/Core/tests/Unit/UriTraitTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Unit\Core; +namespace Google\Cloud\Core\Tests\Unit; use Google\Cloud\Core\UriTrait; use PHPUnit\Framework\TestCase; diff --git a/tests/unit/Core/ValidateTraitTest.php b/Core/tests/Unit/ValidateTraitTest.php similarity index 97% rename from tests/unit/Core/ValidateTraitTest.php rename to Core/tests/Unit/ValidateTraitTest.php index 351620cc34bf..828d73161c61 100644 --- a/tests/unit/Core/ValidateTraitTest.php +++ b/Core/tests/Unit/ValidateTraitTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Unit\Core; +namespace Google\Cloud\Core\Tests\Unit; use Google\Cloud\Core\ValidateTrait; use PHPUnit\Framework\TestCase; diff --git a/tests/unit/Core/WhitelistTraitTest.php b/Core/tests/Unit/WhitelistTraitTest.php similarity index 97% rename from tests/unit/Core/WhitelistTraitTest.php rename to Core/tests/Unit/WhitelistTraitTest.php index b9c1989efba0..316c1f29b8bc 100644 --- a/tests/unit/Core/WhitelistTraitTest.php +++ b/Core/tests/Unit/WhitelistTraitTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Unit\Core; +namespace Google\Cloud\Core\Tests\Unit; use Google\Cloud\Core\Exception\NotFoundException; use Google\Cloud\Core\Exception\ServiceException; diff --git a/tests/unit/Core/fixtures/empty-json-key-fixture.json b/Core/tests/Unit/fixtures/empty-json-key-fixture.json similarity index 100% rename from tests/unit/Core/fixtures/empty-json-key-fixture.json rename to Core/tests/Unit/fixtures/empty-json-key-fixture.json diff --git a/tests/unit/Core/fixtures/json-key-fixture.json b/Core/tests/Unit/fixtures/json-key-fixture.json similarity index 100% rename from tests/unit/Core/fixtures/json-key-fixture.json rename to Core/tests/Unit/fixtures/json-key-fixture.json diff --git a/tests/unit/Core/fixtures/service-fixture.json b/Core/tests/Unit/fixtures/service-fixture.json similarity index 100% rename from tests/unit/Core/fixtures/service-fixture.json rename to Core/tests/Unit/fixtures/service-fixture.json diff --git a/Dataproc/.github/pull_request_template.md b/Dataproc/.github/pull_request_template.md new file mode 100644 index 000000000000..c29cf03d1bf5 --- /dev/null +++ b/Dataproc/.github/pull_request_template.md @@ -0,0 +1,24 @@ +**PLEASE READ THIS ENTIRE MESSAGE** + +Hello, and thank you for your contribution! Please note that this repository is +a read-only split of `GoogleCloudPlatform/google-cloud-php`. As such, we are +unable to accept pull requests to this repository. + +We welcome your pull request and would be happy to consider it for inclusion in +our library if you follow these steps: + +* Clone the parent client library repository: + +```sh +$ git clone git@github.com:GoogleCloudPlatform/google-cloud-php.git +``` + +* Move your changes into the correct location in that library. Library code +belongs in `Dataproc/src`, and tests in `Dataproc/tests`. + +* Push the changes in a new branch to a fork, and open a new pull request +[here](https://github.com/GoogleCloudPlatform/google-cloud-php). + +Thanks again, and we look forward to seeing your proposed change! + +The Google Cloud PHP team diff --git a/src/Dataproc/CONTRIBUTING.md b/Dataproc/CONTRIBUTING.md similarity index 100% rename from src/Dataproc/CONTRIBUTING.md rename to Dataproc/CONTRIBUTING.md diff --git a/src/Dataproc/LICENSE b/Dataproc/LICENSE similarity index 100% rename from src/Dataproc/LICENSE rename to Dataproc/LICENSE diff --git a/src/Dataproc/README.md b/Dataproc/README.md similarity index 100% rename from src/Dataproc/README.md rename to Dataproc/README.md diff --git a/src/Dataproc/VERSION b/Dataproc/VERSION similarity index 100% rename from src/Dataproc/VERSION rename to Dataproc/VERSION diff --git a/src/Dataproc/composer.json b/Dataproc/composer.json similarity index 75% rename from src/Dataproc/composer.json rename to Dataproc/composer.json index 10759770e7a4..5272d4fc8c9a 100644 --- a/src/Dataproc/composer.json +++ b/Dataproc/composer.json @@ -5,13 +5,13 @@ "minimum-stability": "stable", "autoload": { "psr-4": { - "Google\\Cloud\\Dataproc\\": "" + "Google\\Cloud\\Dataproc\\": "src" } }, "extra": { "component": { "id": "cloud-dataproc", - "path": "src/Dataproc", + "path": "Dataproc", "entry": null, "target": "GoogleCloudPlatform/google-cloud-php-dataproc.git" } @@ -20,6 +20,11 @@ "google/proto-client": "^0.34", "google/gax": "^0.30" }, + "require-dev": { + "phpunit/phpunit": "^4.8|^5.0", + "google/cloud-core": "^1.14", + "phpdocumentor/reflection": "^3.0" + }, "suggest": { "ext-protobuf": "Provides a significant increase in throughput over the pure PHP protobuf implementation. See https://cloud.google.com/php/grpc for installation instructions." } diff --git a/Dataproc/phpunit-snippets.xml.dist b/Dataproc/phpunit-snippets.xml.dist new file mode 100644 index 000000000000..b92fd83e3c1b --- /dev/null +++ b/Dataproc/phpunit-snippets.xml.dist @@ -0,0 +1,19 @@ + + + + + tests/Snippet + + + + + src + + src/V[!a-zA-Z]* + + + + diff --git a/Dataproc/phpunit-system.xml.dist b/Dataproc/phpunit-system.xml.dist new file mode 100644 index 000000000000..f6deee15a036 --- /dev/null +++ b/Dataproc/phpunit-system.xml.dist @@ -0,0 +1,16 @@ + + + + + tests/System + + + + + src + + src/V[!a-zA-Z]* + + + + diff --git a/Dataproc/phpunit.xml.dist b/Dataproc/phpunit.xml.dist new file mode 100644 index 000000000000..1c2b8f6b56d2 --- /dev/null +++ b/Dataproc/phpunit.xml.dist @@ -0,0 +1,16 @@ + + + + + tests/Unit + + + + + src + + src/V[!a-zA-Z]* + + + + diff --git a/src/Dataproc/V1/ClusterControllerClient.php b/Dataproc/src/V1/ClusterControllerClient.php similarity index 100% rename from src/Dataproc/V1/ClusterControllerClient.php rename to Dataproc/src/V1/ClusterControllerClient.php diff --git a/src/Dataproc/V1/Gapic/ClusterControllerGapicClient.php b/Dataproc/src/V1/Gapic/ClusterControllerGapicClient.php similarity index 100% rename from src/Dataproc/V1/Gapic/ClusterControllerGapicClient.php rename to Dataproc/src/V1/Gapic/ClusterControllerGapicClient.php diff --git a/src/Dataproc/V1/Gapic/JobControllerGapicClient.php b/Dataproc/src/V1/Gapic/JobControllerGapicClient.php similarity index 100% rename from src/Dataproc/V1/Gapic/JobControllerGapicClient.php rename to Dataproc/src/V1/Gapic/JobControllerGapicClient.php diff --git a/src/Dataproc/V1/JobControllerClient.php b/Dataproc/src/V1/JobControllerClient.php similarity index 100% rename from src/Dataproc/V1/JobControllerClient.php rename to Dataproc/src/V1/JobControllerClient.php diff --git a/src/Dataproc/V1/README.md b/Dataproc/src/V1/README.md similarity index 100% rename from src/Dataproc/V1/README.md rename to Dataproc/src/V1/README.md diff --git a/src/Dataproc/V1/resources/cluster_controller_client_config.json b/Dataproc/src/V1/resources/cluster_controller_client_config.json similarity index 100% rename from src/Dataproc/V1/resources/cluster_controller_client_config.json rename to Dataproc/src/V1/resources/cluster_controller_client_config.json diff --git a/src/Dataproc/V1/resources/cluster_controller_descriptor_config.php b/Dataproc/src/V1/resources/cluster_controller_descriptor_config.php similarity index 100% rename from src/Dataproc/V1/resources/cluster_controller_descriptor_config.php rename to Dataproc/src/V1/resources/cluster_controller_descriptor_config.php diff --git a/src/Dataproc/V1/resources/cluster_controller_rest_client_config.php b/Dataproc/src/V1/resources/cluster_controller_rest_client_config.php similarity index 100% rename from src/Dataproc/V1/resources/cluster_controller_rest_client_config.php rename to Dataproc/src/V1/resources/cluster_controller_rest_client_config.php diff --git a/src/Dataproc/V1/resources/job_controller_client_config.json b/Dataproc/src/V1/resources/job_controller_client_config.json similarity index 100% rename from src/Dataproc/V1/resources/job_controller_client_config.json rename to Dataproc/src/V1/resources/job_controller_client_config.json diff --git a/src/Dataproc/V1/resources/job_controller_descriptor_config.php b/Dataproc/src/V1/resources/job_controller_descriptor_config.php similarity index 100% rename from src/Dataproc/V1/resources/job_controller_descriptor_config.php rename to Dataproc/src/V1/resources/job_controller_descriptor_config.php diff --git a/src/Dataproc/V1/resources/job_controller_rest_client_config.php b/Dataproc/src/V1/resources/job_controller_rest_client_config.php similarity index 100% rename from src/Dataproc/V1/resources/job_controller_rest_client_config.php rename to Dataproc/src/V1/resources/job_controller_rest_client_config.php diff --git a/tests/system/Dataproc/ClusterControllerClientTest.php b/Dataproc/tests/System/ClusterControllerClientTest.php similarity index 93% rename from tests/system/Dataproc/ClusterControllerClientTest.php rename to Dataproc/tests/System/ClusterControllerClientTest.php index 064346ec57a6..277dcc9bd5b7 100644 --- a/tests/system/Dataproc/ClusterControllerClientTest.php +++ b/Dataproc/tests/System/ClusterControllerClientTest.php @@ -15,15 +15,15 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\System\Container; +namespace Google\Cloud\Container\Tests\System; use Google\Auth\CredentialsLoader; use Google\ApiCore\PagedListResponse; -use Google\Cloud\Core\Testing\System\SystemTestCase; use Google\Cloud\Dataproc\V1\ClusterControllerClient; use Google\Cloud\Dataproc\V1\ListClustersResponse; +use PHPUnit\Framework\TestCase; -class ClusterControllerClientTest extends SystemTestCase +class ClusterControllerClientTest extends TestCase { const REGION = 'global'; diff --git a/Dataproc/tests/System/bootstrap.php b/Dataproc/tests/System/bootstrap.php new file mode 100644 index 000000000000..38465605b9a8 --- /dev/null +++ b/Dataproc/tests/System/bootstrap.php @@ -0,0 +1,5 @@ + + + + + tests/Snippet + + + + + src + + src/V[!a-zA-Z]* + + + + diff --git a/Datastore/phpunit-system.xml.dist b/Datastore/phpunit-system.xml.dist new file mode 100644 index 000000000000..f6deee15a036 --- /dev/null +++ b/Datastore/phpunit-system.xml.dist @@ -0,0 +1,16 @@ + + + + + tests/System + + + + + src + + src/V[!a-zA-Z]* + + + + diff --git a/Datastore/phpunit.xml.dist b/Datastore/phpunit.xml.dist new file mode 100644 index 000000000000..1c2b8f6b56d2 --- /dev/null +++ b/Datastore/phpunit.xml.dist @@ -0,0 +1,16 @@ + + + + + tests/Unit + + + + + src + + src/V[!a-zA-Z]* + + + + diff --git a/src/Datastore/Blob.php b/Datastore/src/Blob.php similarity index 100% rename from src/Datastore/Blob.php rename to Datastore/src/Blob.php diff --git a/src/Datastore/Connection/ConnectionInterface.php b/Datastore/src/Connection/ConnectionInterface.php similarity index 100% rename from src/Datastore/Connection/ConnectionInterface.php rename to Datastore/src/Connection/ConnectionInterface.php diff --git a/src/Datastore/Connection/Rest.php b/Datastore/src/Connection/Rest.php similarity index 100% rename from src/Datastore/Connection/Rest.php rename to Datastore/src/Connection/Rest.php diff --git a/src/Datastore/Connection/ServiceDefinition/datastore-v1.json b/Datastore/src/Connection/ServiceDefinition/datastore-v1.json similarity index 100% rename from src/Datastore/Connection/ServiceDefinition/datastore-v1.json rename to Datastore/src/Connection/ServiceDefinition/datastore-v1.json diff --git a/src/Datastore/DatastoreClient.php b/Datastore/src/DatastoreClient.php similarity index 99% rename from src/Datastore/DatastoreClient.php rename to Datastore/src/DatastoreClient.php index e809c6c8ab1f..ee4288bb3280 100644 --- a/src/Datastore/DatastoreClient.php +++ b/Datastore/src/DatastoreClient.php @@ -18,6 +18,7 @@ namespace Google\Cloud\Datastore; use DomainException; +use Google\Auth\FetchAuthTokenInterface; use Google\Cloud\Core\ArrayTrait; use Google\Cloud\Core\ClientTrait; use Google\Cloud\Core\Int64; diff --git a/src/Datastore/DatastoreSessionHandler.php b/Datastore/src/DatastoreSessionHandler.php similarity index 100% rename from src/Datastore/DatastoreSessionHandler.php rename to Datastore/src/DatastoreSessionHandler.php diff --git a/src/Datastore/DatastoreTrait.php b/Datastore/src/DatastoreTrait.php similarity index 100% rename from src/Datastore/DatastoreTrait.php rename to Datastore/src/DatastoreTrait.php diff --git a/src/Datastore/Entity.php b/Datastore/src/Entity.php similarity index 100% rename from src/Datastore/Entity.php rename to Datastore/src/Entity.php diff --git a/src/Datastore/EntityIterator.php b/Datastore/src/EntityIterator.php similarity index 100% rename from src/Datastore/EntityIterator.php rename to Datastore/src/EntityIterator.php diff --git a/src/Datastore/EntityMapper.php b/Datastore/src/EntityMapper.php similarity index 100% rename from src/Datastore/EntityMapper.php rename to Datastore/src/EntityMapper.php diff --git a/src/Datastore/EntityPageIterator.php b/Datastore/src/EntityPageIterator.php similarity index 100% rename from src/Datastore/EntityPageIterator.php rename to Datastore/src/EntityPageIterator.php diff --git a/src/Datastore/GeoPoint.php b/Datastore/src/GeoPoint.php similarity index 100% rename from src/Datastore/GeoPoint.php rename to Datastore/src/GeoPoint.php diff --git a/src/Datastore/Key.php b/Datastore/src/Key.php similarity index 100% rename from src/Datastore/Key.php rename to Datastore/src/Key.php diff --git a/src/Datastore/Operation.php b/Datastore/src/Operation.php similarity index 100% rename from src/Datastore/Operation.php rename to Datastore/src/Operation.php diff --git a/src/Datastore/Query/GqlQuery.php b/Datastore/src/Query/GqlQuery.php similarity index 100% rename from src/Datastore/Query/GqlQuery.php rename to Datastore/src/Query/GqlQuery.php diff --git a/src/Datastore/Query/Query.php b/Datastore/src/Query/Query.php similarity index 100% rename from src/Datastore/Query/Query.php rename to Datastore/src/Query/Query.php diff --git a/src/Datastore/Query/QueryInterface.php b/Datastore/src/Query/QueryInterface.php similarity index 100% rename from src/Datastore/Query/QueryInterface.php rename to Datastore/src/Query/QueryInterface.php diff --git a/src/Datastore/ReadOnlyTransaction.php b/Datastore/src/ReadOnlyTransaction.php similarity index 100% rename from src/Datastore/ReadOnlyTransaction.php rename to Datastore/src/ReadOnlyTransaction.php diff --git a/src/Datastore/Transaction.php b/Datastore/src/Transaction.php similarity index 100% rename from src/Datastore/Transaction.php rename to Datastore/src/Transaction.php diff --git a/src/Datastore/TransactionTrait.php b/Datastore/src/TransactionTrait.php similarity index 100% rename from src/Datastore/TransactionTrait.php rename to Datastore/src/TransactionTrait.php diff --git a/tests/snippets/Datastore/BlobTest.php b/Datastore/tests/Snippet/BlobTest.php similarity index 97% rename from tests/snippets/Datastore/BlobTest.php rename to Datastore/tests/Snippet/BlobTest.php index cf5b4e2d0f0b..0b44490f71b2 100644 --- a/tests/snippets/Datastore/BlobTest.php +++ b/Datastore/tests/Snippet/BlobTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Snippets\Datastore; +namespace Google\Cloud\Datastore\Tests\Snippet; use Google\Cloud\Datastore\Blob; use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; diff --git a/tests/snippets/Datastore/DatastoreClientTest.php b/Datastore/tests/Snippet/DatastoreClientTest.php similarity index 99% rename from tests/snippets/Datastore/DatastoreClientTest.php rename to Datastore/tests/Snippet/DatastoreClientTest.php index 65c37f4952be..4c74c8c75959 100644 --- a/tests/snippets/Datastore/DatastoreClientTest.php +++ b/Datastore/tests/Snippet/DatastoreClientTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Snippets\Datastore; +namespace Google\Cloud\Datastore\Tests\Snippet; use Google\Cloud\Core\Int64; use Google\Cloud\Core\Testing\DatastoreOperationRefreshTrait; diff --git a/tests/snippets/Datastore/EntityTest.php b/Datastore/tests/Snippet/EntityTest.php similarity index 98% rename from tests/snippets/Datastore/EntityTest.php rename to Datastore/tests/Snippet/EntityTest.php index 45c88f3a3dba..afbe2024c228 100644 --- a/tests/snippets/Datastore/EntityTest.php +++ b/Datastore/tests/Snippet/EntityTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Snippets\Datastore; +namespace Google\Cloud\Datastore\Tests\Snippet; use Google\Cloud\Datastore\Entity; use Google\Cloud\Datastore\Key; diff --git a/tests/snippets/Datastore/GeoPointTest.php b/Datastore/tests/Snippet/GeoPointTest.php similarity index 98% rename from tests/snippets/Datastore/GeoPointTest.php rename to Datastore/tests/Snippet/GeoPointTest.php index 444411b3be22..3e169b68b7fb 100644 --- a/tests/snippets/Datastore/GeoPointTest.php +++ b/Datastore/tests/Snippet/GeoPointTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Snippets\Datastore; +namespace Google\Cloud\Datastore\Tests\Snippet; use Google\Cloud\Datastore\GeoPoint; use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; diff --git a/tests/snippets/Datastore/KeyTest.php b/Datastore/tests/Snippet/KeyTest.php similarity index 99% rename from tests/snippets/Datastore/KeyTest.php rename to Datastore/tests/Snippet/KeyTest.php index 44c1f26f1500..215e04437c18 100644 --- a/tests/snippets/Datastore/KeyTest.php +++ b/Datastore/tests/Snippet/KeyTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Snippets\Datastore; +namespace Google\Cloud\Datastore\Tests\Snippet; use Google\Cloud\Datastore\DatastoreClient; use Google\Cloud\Datastore\Key; diff --git a/tests/snippets/Datastore/Query/GqlQueryTest.php b/Datastore/tests/Snippet/Query/GqlQueryTest.php similarity index 98% rename from tests/snippets/Datastore/Query/GqlQueryTest.php rename to Datastore/tests/Snippet/Query/GqlQueryTest.php index 9535e74ea4ba..cc6ea98722dc 100644 --- a/tests/snippets/Datastore/Query/GqlQueryTest.php +++ b/Datastore/tests/Snippet/Query/GqlQueryTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Snippets\Datastore\Query; +namespace Google\Cloud\Datastore\Tests\Snippet\Query; use Google\Cloud\Datastore\Connection\ConnectionInterface; use Google\Cloud\Datastore\DatastoreClient; diff --git a/tests/snippets/Datastore/Query/QueryTest.php b/Datastore/tests/Snippet/Query/QueryTest.php similarity index 99% rename from tests/snippets/Datastore/Query/QueryTest.php rename to Datastore/tests/Snippet/Query/QueryTest.php index 5dd8e5859241..acb5eed0a2f0 100644 --- a/tests/snippets/Datastore/Query/QueryTest.php +++ b/Datastore/tests/Snippet/Query/QueryTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Snippets\Datastore\Query; +namespace Google\Cloud\Datastore\Tests\Snippet\Query; use Google\Cloud\Datastore\Connection\ConnectionInterface; use Google\Cloud\Datastore\DatastoreClient; diff --git a/tests/snippets/Datastore/ReadOnlyTransactionTest.php b/Datastore/tests/Snippet/ReadOnlyTransactionTest.php similarity index 99% rename from tests/snippets/Datastore/ReadOnlyTransactionTest.php rename to Datastore/tests/Snippet/ReadOnlyTransactionTest.php index 57c64d833c10..c8649b503e39 100644 --- a/tests/snippets/Datastore/ReadOnlyTransactionTest.php +++ b/Datastore/tests/Snippet/ReadOnlyTransactionTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Snippets\Datastore; +namespace Google\Cloud\Datastore\Tests\Snippet; use Google\Cloud\Core\Testing\DatastoreOperationRefreshTrait; use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; diff --git a/tests/snippets/Datastore/TransactionTest.php b/Datastore/tests/Snippet/TransactionTest.php similarity index 99% rename from tests/snippets/Datastore/TransactionTest.php rename to Datastore/tests/Snippet/TransactionTest.php index 858aedf0d484..41a1b0953617 100644 --- a/tests/snippets/Datastore/TransactionTest.php +++ b/Datastore/tests/Snippet/TransactionTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Snippets\Datastore; +namespace Google\Cloud\Datastore\Tests\Snippet; use Google\Cloud\Core\Testing\DatastoreOperationRefreshTrait; use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; diff --git a/tests/system/Datastore/AllocateKeyTest.php b/Datastore/tests/System/AllocateKeyTest.php similarity index 96% rename from tests/system/Datastore/AllocateKeyTest.php rename to Datastore/tests/System/AllocateKeyTest.php index 495e640591ff..d9dbba6cef03 100644 --- a/tests/system/Datastore/AllocateKeyTest.php +++ b/Datastore/tests/System/AllocateKeyTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\System\Datastore; +namespace Google\Cloud\Datastore\Tests\System; /** * @group datastore diff --git a/tests/system/Datastore/DatastoreTestCase.php b/Datastore/tests/System/DatastoreTestCase.php similarity index 97% rename from tests/system/Datastore/DatastoreTestCase.php rename to Datastore/tests/System/DatastoreTestCase.php index f12f47aa6b11..bb194b01a56b 100644 --- a/tests/system/Datastore/DatastoreTestCase.php +++ b/Datastore/tests/System/DatastoreTestCase.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\System\Datastore; +namespace Google\Cloud\Datastore\Tests\System; use Google\Cloud\Core\ExponentialBackoff; use Google\Cloud\Datastore\DatastoreClient; diff --git a/tests/system/Datastore/RunQueryTest.php b/Datastore/tests/System/RunQueryTest.php similarity index 99% rename from tests/system/Datastore/RunQueryTest.php rename to Datastore/tests/System/RunQueryTest.php index 4d62dfbf5f8e..4a7c358951cd 100644 --- a/tests/system/Datastore/RunQueryTest.php +++ b/Datastore/tests/System/RunQueryTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\System\Datastore; +namespace Google\Cloud\Datastore\Tests\System; /** * @group datastore diff --git a/tests/system/Datastore/RunTransactionTest.php b/Datastore/tests/System/RunTransactionTest.php similarity index 97% rename from tests/system/Datastore/RunTransactionTest.php rename to Datastore/tests/System/RunTransactionTest.php index 11aaa7a6f664..dba66e473326 100644 --- a/tests/system/Datastore/RunTransactionTest.php +++ b/Datastore/tests/System/RunTransactionTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\System\Datastore; +namespace Google\Cloud\Datastore\Tests\System; /** * @group datastore diff --git a/tests/system/Datastore/SaveAndModifyTest.php b/Datastore/tests/System/SaveAndModifyTest.php similarity index 98% rename from tests/system/Datastore/SaveAndModifyTest.php rename to Datastore/tests/System/SaveAndModifyTest.php index 57996703d773..20cfd34202ee 100644 --- a/tests/system/Datastore/SaveAndModifyTest.php +++ b/Datastore/tests/System/SaveAndModifyTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\System\Datastore; +namespace Google\Cloud\Datastore\Tests\System; use Google\Cloud\Core\Int64; use Google\Cloud\Datastore\Entity; diff --git a/Datastore/tests/System/bootstrap.php b/Datastore/tests/System/bootstrap.php new file mode 100644 index 000000000000..5a6093eab7b7 --- /dev/null +++ b/Datastore/tests/System/bootstrap.php @@ -0,0 +1,9 @@ + + + + + tests/Snippet + + + + + src + + src/V[!a-zA-Z]* + + + + diff --git a/Debugger/phpunit-system.xml.dist b/Debugger/phpunit-system.xml.dist new file mode 100644 index 000000000000..f6deee15a036 --- /dev/null +++ b/Debugger/phpunit-system.xml.dist @@ -0,0 +1,16 @@ + + + + + tests/System + + + + + src + + src/V[!a-zA-Z]* + + + + diff --git a/Debugger/phpunit.xml.dist b/Debugger/phpunit.xml.dist new file mode 100644 index 000000000000..1c2b8f6b56d2 --- /dev/null +++ b/Debugger/phpunit.xml.dist @@ -0,0 +1,16 @@ + + + + + tests/Unit + + + + + src + + src/V[!a-zA-Z]* + + + + diff --git a/src/Debugger/Agent.php b/Debugger/src/Agent.php similarity index 100% rename from src/Debugger/Agent.php rename to Debugger/src/Agent.php diff --git a/src/Debugger/AliasContext.php b/Debugger/src/AliasContext.php similarity index 100% rename from src/Debugger/AliasContext.php rename to Debugger/src/AliasContext.php diff --git a/src/Debugger/Breakpoint.php b/Debugger/src/Breakpoint.php similarity index 98% rename from src/Debugger/Breakpoint.php rename to Debugger/src/Breakpoint.php index e1d0f7de55a7..b8c7e42d15a6 100644 --- a/src/Debugger/Breakpoint.php +++ b/Debugger/src/Breakpoint.php @@ -594,11 +594,13 @@ public function validate() * $found = $breakpoint->resolveLocation(); * ``` * + * @param SourceLocationResolver $resolver [optional] **Defaults to** a + * resolver that uses the current include path. * @return bool */ - public function resolveLocation() + public function resolveLocation(SourceLocationResolver $resolver = null) { - $resolver = new SourceLocationResolver(); + $resolver = $resolver ?: new SourceLocationResolver(); $this->resolvedLocation = $resolver->resolve($this->location); return $this->resolvedLocation !== null; diff --git a/src/Debugger/BreakpointStorage/BreakpointStorageInterface.php b/Debugger/src/BreakpointStorage/BreakpointStorageInterface.php similarity index 100% rename from src/Debugger/BreakpointStorage/BreakpointStorageInterface.php rename to Debugger/src/BreakpointStorage/BreakpointStorageInterface.php diff --git a/src/Debugger/BreakpointStorage/FileBreakpointStorage.php b/Debugger/src/BreakpointStorage/FileBreakpointStorage.php similarity index 100% rename from src/Debugger/BreakpointStorage/FileBreakpointStorage.php rename to Debugger/src/BreakpointStorage/FileBreakpointStorage.php diff --git a/src/Debugger/BreakpointStorage/SysvBreakpointStorage.php b/Debugger/src/BreakpointStorage/SysvBreakpointStorage.php similarity index 100% rename from src/Debugger/BreakpointStorage/SysvBreakpointStorage.php rename to Debugger/src/BreakpointStorage/SysvBreakpointStorage.php diff --git a/src/Debugger/CliDaemon.php b/Debugger/src/CliDaemon.php similarity index 100% rename from src/Debugger/CliDaemon.php rename to Debugger/src/CliDaemon.php diff --git a/src/Debugger/CloudRepoSourceContext.php b/Debugger/src/CloudRepoSourceContext.php similarity index 100% rename from src/Debugger/CloudRepoSourceContext.php rename to Debugger/src/CloudRepoSourceContext.php diff --git a/src/Debugger/CloudWorkspaceId.php b/Debugger/src/CloudWorkspaceId.php similarity index 100% rename from src/Debugger/CloudWorkspaceId.php rename to Debugger/src/CloudWorkspaceId.php diff --git a/src/Debugger/CloudWorkspaceSourceContext.php b/Debugger/src/CloudWorkspaceSourceContext.php similarity index 100% rename from src/Debugger/CloudWorkspaceSourceContext.php rename to Debugger/src/CloudWorkspaceSourceContext.php diff --git a/src/Debugger/Connection/ConnectionInterface.php b/Debugger/src/Connection/ConnectionInterface.php similarity index 100% rename from src/Debugger/Connection/ConnectionInterface.php rename to Debugger/src/Connection/ConnectionInterface.php diff --git a/src/Debugger/Connection/Rest.php b/Debugger/src/Connection/Rest.php similarity index 100% rename from src/Debugger/Connection/Rest.php rename to Debugger/src/Connection/Rest.php diff --git a/src/Debugger/Connection/ServiceDefinition/debugger-v2.json b/Debugger/src/Connection/ServiceDefinition/debugger-v2.json similarity index 100% rename from src/Debugger/Connection/ServiceDefinition/debugger-v2.json rename to Debugger/src/Connection/ServiceDefinition/debugger-v2.json diff --git a/src/Debugger/Daemon.php b/Debugger/src/Daemon.php similarity index 100% rename from src/Debugger/Daemon.php rename to Debugger/src/Daemon.php diff --git a/src/Debugger/Debuggee.php b/Debugger/src/Debuggee.php similarity index 100% rename from src/Debugger/Debuggee.php rename to Debugger/src/Debuggee.php diff --git a/src/Debugger/DebuggerClient.php b/Debugger/src/DebuggerClient.php similarity index 99% rename from src/Debugger/DebuggerClient.php rename to Debugger/src/DebuggerClient.php index 44f87e8fa464..11fb307b0801 100644 --- a/src/Debugger/DebuggerClient.php +++ b/Debugger/src/DebuggerClient.php @@ -20,6 +20,7 @@ use Google\Cloud\Core\ClientTrait; use Google\Cloud\Debugger\Connection\ConnectionInterface; use Google\Cloud\Debugger\Connection\Rest; +use Psr\Cache\CacheItemPoolInterface; /** * Google Stackdriver Debugger allows you to collect variable data from a live application diff --git a/src/Debugger/ExtendedSourceContext.php b/Debugger/src/ExtendedSourceContext.php similarity index 100% rename from src/Debugger/ExtendedSourceContext.php rename to Debugger/src/ExtendedSourceContext.php diff --git a/src/Debugger/FormatMessage.php b/Debugger/src/FormatMessage.php similarity index 100% rename from src/Debugger/FormatMessage.php rename to Debugger/src/FormatMessage.php diff --git a/src/Debugger/GerritSourceContext.php b/Debugger/src/GerritSourceContext.php similarity index 100% rename from src/Debugger/GerritSourceContext.php rename to Debugger/src/GerritSourceContext.php diff --git a/src/Debugger/GitSourceContext.php b/Debugger/src/GitSourceContext.php similarity index 100% rename from src/Debugger/GitSourceContext.php rename to Debugger/src/GitSourceContext.php diff --git a/src/Debugger/MatchingFileIterator.php b/Debugger/src/MatchingFileIterator.php similarity index 96% rename from src/Debugger/MatchingFileIterator.php rename to Debugger/src/MatchingFileIterator.php index 3cefe2028aba..992c3dbda1f5 100644 --- a/src/Debugger/MatchingFileIterator.php +++ b/Debugger/src/MatchingFileIterator.php @@ -23,7 +23,7 @@ * * Example: * ``` - * $iterator = new MatchingFileIterator('.', 'src/Debugger/DebuggerClient.php'); + * $iterator = new MatchingFileIterator('.', 'Debugger/src/DebuggerClient.php'); * $matches = iterator_to_array($iterator); * ``` * diff --git a/src/Debugger/ProjectRepoId.php b/Debugger/src/ProjectRepoId.php similarity index 100% rename from src/Debugger/ProjectRepoId.php rename to Debugger/src/ProjectRepoId.php diff --git a/src/Debugger/RepoId.php b/Debugger/src/RepoId.php similarity index 100% rename from src/Debugger/RepoId.php rename to Debugger/src/RepoId.php diff --git a/src/Debugger/SourceContext.php b/Debugger/src/SourceContext.php similarity index 100% rename from src/Debugger/SourceContext.php rename to Debugger/src/SourceContext.php diff --git a/src/Debugger/SourceLocation.php b/Debugger/src/SourceLocation.php similarity index 100% rename from src/Debugger/SourceLocation.php rename to Debugger/src/SourceLocation.php diff --git a/src/Debugger/SourceLocationResolver.php b/Debugger/src/SourceLocationResolver.php similarity index 82% rename from src/Debugger/SourceLocationResolver.php rename to Debugger/src/SourceLocationResolver.php index 214ab013a220..60f1920db285 100644 --- a/src/Debugger/SourceLocationResolver.php +++ b/Debugger/src/SourceLocationResolver.php @@ -24,13 +24,29 @@ * * Example: * ``` - * $location = new SourceLocation('src/Debugger/DebuggerClient.php', 1); + * $location = new SourceLocation('Debugger/src/DebuggerClient.php', 1); * $resolver = new SourceLocationResolver(); * $resolvedLocation = $resolver->resolve($location); * ``` */ class SourceLocationResolver { + /** + * @var string[] Search paths used to find matching source files. + */ + private $includePaths = []; + + /** + * Create a new SourceLocationResolver. + * + * @param string[]|null $includePaths The search paths used to find matching + * source files. **Defaults to** the configured include path for PHP. + */ + public function __construct($includePaths = null) + { + $this->includePaths = $includePaths ?: explode(PATH_SEPARATOR, get_include_path()); + } + /** * Resolve the full path of an existing file in the application's source. * If no matching source file is found, then return null. If found, the @@ -43,7 +59,7 @@ class SourceLocationResolver * * Example: * ``` - * $location = new SourceLocation('src/Debugger/DebuggerClient.php', 1); + * $location = new SourceLocation('Debugger/src/DebuggerClient.php', 1); * $resolver = new SourceLocationResolver(); * $resolvedLocation = $resolver->resolve($location); * ``` @@ -52,7 +68,7 @@ class SourceLocationResolver * * Example: * ``` - * $location = new SourceLocation('extra/folder/src/Debugger/DebuggerClient.php', 1); + * $location = new SourceLocation('extra/folder/Debugger/src/DebuggerClient.php', 1); * $resolver = new SourceLocationResolver(); * $resolvedLocation = $resolver->resolve($location); * ``` @@ -61,7 +77,7 @@ class SourceLocationResolver * * Example: * ``` - * $location = new SourceLocation('Debugger/DebuggerClient.php', 1); + * $location = new SourceLocation('src/DebuggerClient.php', 1); * $resolver = new SourceLocationResolver(); * $resolvedLocation = $resolver->resolve($location); * @@ -74,7 +90,7 @@ public function resolve(SourceLocation $location) $basename = basename($origPath); $prefixes = $this->searchPrefixes($origPath); - $includePaths = array_filter(explode(PATH_SEPARATOR, get_include_path()), function ($path) { + $includePaths = array_filter($this->includePaths, function ($path) { return file_exists($path); }); diff --git a/src/Debugger/StackFrame.php b/Debugger/src/StackFrame.php similarity index 100% rename from src/Debugger/StackFrame.php rename to Debugger/src/StackFrame.php diff --git a/src/Debugger/StatusMessage.php b/Debugger/src/StatusMessage.php similarity index 100% rename from src/Debugger/StatusMessage.php rename to Debugger/src/StatusMessage.php diff --git a/src/Debugger/V2/Controller2Client.php b/Debugger/src/V2/Controller2Client.php similarity index 100% rename from src/Debugger/V2/Controller2Client.php rename to Debugger/src/V2/Controller2Client.php diff --git a/src/Debugger/V2/Debugger2Client.php b/Debugger/src/V2/Debugger2Client.php similarity index 100% rename from src/Debugger/V2/Debugger2Client.php rename to Debugger/src/V2/Debugger2Client.php diff --git a/src/Debugger/V2/Gapic/Controller2GapicClient.php b/Debugger/src/V2/Gapic/Controller2GapicClient.php similarity index 100% rename from src/Debugger/V2/Gapic/Controller2GapicClient.php rename to Debugger/src/V2/Gapic/Controller2GapicClient.php diff --git a/src/Debugger/V2/Gapic/Debugger2GapicClient.php b/Debugger/src/V2/Gapic/Debugger2GapicClient.php similarity index 100% rename from src/Debugger/V2/Gapic/Debugger2GapicClient.php rename to Debugger/src/V2/Gapic/Debugger2GapicClient.php diff --git a/src/Debugger/V2/resources/controller2_client_config.json b/Debugger/src/V2/resources/controller2_client_config.json similarity index 100% rename from src/Debugger/V2/resources/controller2_client_config.json rename to Debugger/src/V2/resources/controller2_client_config.json diff --git a/src/Debugger/V2/resources/controller2_descriptor_config.php b/Debugger/src/V2/resources/controller2_descriptor_config.php similarity index 100% rename from src/Debugger/V2/resources/controller2_descriptor_config.php rename to Debugger/src/V2/resources/controller2_descriptor_config.php diff --git a/src/Debugger/V2/resources/controller2_rest_client_config.php b/Debugger/src/V2/resources/controller2_rest_client_config.php similarity index 100% rename from src/Debugger/V2/resources/controller2_rest_client_config.php rename to Debugger/src/V2/resources/controller2_rest_client_config.php diff --git a/src/Debugger/V2/resources/debugger2_client_config.json b/Debugger/src/V2/resources/debugger2_client_config.json similarity index 100% rename from src/Debugger/V2/resources/debugger2_client_config.json rename to Debugger/src/V2/resources/debugger2_client_config.json diff --git a/src/Debugger/V2/resources/debugger2_descriptor_config.php b/Debugger/src/V2/resources/debugger2_descriptor_config.php similarity index 100% rename from src/Debugger/V2/resources/debugger2_descriptor_config.php rename to Debugger/src/V2/resources/debugger2_descriptor_config.php diff --git a/src/Debugger/V2/resources/debugger2_rest_client_config.php b/Debugger/src/V2/resources/debugger2_rest_client_config.php similarity index 100% rename from src/Debugger/V2/resources/debugger2_rest_client_config.php rename to Debugger/src/V2/resources/debugger2_rest_client_config.php diff --git a/src/Debugger/Variable.php b/Debugger/src/Variable.php similarity index 100% rename from src/Debugger/Variable.php rename to Debugger/src/Variable.php diff --git a/src/Debugger/VariableTable.php b/Debugger/src/VariableTable.php similarity index 100% rename from src/Debugger/VariableTable.php rename to Debugger/src/VariableTable.php diff --git a/tests/snippets/Debugger/AgentTest.php b/Debugger/tests/Snippet/AgentTest.php similarity index 96% rename from tests/snippets/Debugger/AgentTest.php rename to Debugger/tests/Snippet/AgentTest.php index aa6a71df1927..af249a1c154f 100644 --- a/tests/snippets/Debugger/AgentTest.php +++ b/Debugger/tests/Snippet/AgentTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Snippets\Debugger; +namespace Google\Cloud\Debugger\Tests\Snippet; use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Debugger\Agent; diff --git a/tests/snippets/Debugger/AliasContextTest.php b/Debugger/tests/Snippet/AliasContextTest.php similarity index 95% rename from tests/snippets/Debugger/AliasContextTest.php rename to Debugger/tests/Snippet/AliasContextTest.php index 8e99f4919005..f7ff42091638 100644 --- a/tests/snippets/Debugger/AliasContextTest.php +++ b/Debugger/tests/Snippet/AliasContextTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Snippets\Debugger; +namespace Google\Cloud\Debugger\Tests\Snippet; use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Debugger\AliasContext; diff --git a/tests/snippets/Debugger/BreakpointTest.php b/Debugger/tests/Snippet/BreakpointTest.php similarity index 99% rename from tests/snippets/Debugger/BreakpointTest.php rename to Debugger/tests/Snippet/BreakpointTest.php index bf8ee81574d4..3ba899403bbe 100644 --- a/tests/snippets/Debugger/BreakpointTest.php +++ b/Debugger/tests/Snippet/BreakpointTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Snippets\Debugger; +namespace Google\Cloud\Debugger\Tests\Snippet; use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Debugger\Breakpoint; diff --git a/tests/snippets/Debugger/CloudRepoSourceContextTest.php b/Debugger/tests/Snippet/CloudRepoSourceContextTest.php similarity index 95% rename from tests/snippets/Debugger/CloudRepoSourceContextTest.php rename to Debugger/tests/Snippet/CloudRepoSourceContextTest.php index f03f22efa639..ffeb7c09d444 100644 --- a/tests/snippets/Debugger/CloudRepoSourceContextTest.php +++ b/Debugger/tests/Snippet/CloudRepoSourceContextTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Snippets\Debugger; +namespace Google\Cloud\Debugger\Tests\Snippet; use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Debugger\CloudRepoSourceContext; diff --git a/tests/snippets/Debugger/CloudWorkspaceIdTest.php b/Debugger/tests/Snippet/CloudWorkspaceIdTest.php similarity index 95% rename from tests/snippets/Debugger/CloudWorkspaceIdTest.php rename to Debugger/tests/Snippet/CloudWorkspaceIdTest.php index 482d5c843e4c..464dad622f00 100644 --- a/tests/snippets/Debugger/CloudWorkspaceIdTest.php +++ b/Debugger/tests/Snippet/CloudWorkspaceIdTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Snippets\Debugger; +namespace Google\Cloud\Debugger\Tests\Snippet; use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Debugger\CloudWorkspaceId; diff --git a/tests/snippets/Debugger/CloudWorkspaceSourceContextTest.php b/Debugger/tests/Snippet/CloudWorkspaceSourceContextTest.php similarity index 95% rename from tests/snippets/Debugger/CloudWorkspaceSourceContextTest.php rename to Debugger/tests/Snippet/CloudWorkspaceSourceContextTest.php index 05a68098da0f..8b9285b8f3e9 100644 --- a/tests/snippets/Debugger/CloudWorkspaceSourceContextTest.php +++ b/Debugger/tests/Snippet/CloudWorkspaceSourceContextTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Snippets\Debugger; +namespace Google\Cloud\Debugger\Tests\Snippet; use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Debugger\CloudWorkspaceSourceContext; diff --git a/tests/snippets/Debugger/DaemonTest.php b/Debugger/tests/Snippet/DaemonTest.php similarity index 98% rename from tests/snippets/Debugger/DaemonTest.php rename to Debugger/tests/Snippet/DaemonTest.php index 322367b85ba5..c36e9385e9d2 100644 --- a/tests/snippets/Debugger/DaemonTest.php +++ b/Debugger/tests/Snippet/DaemonTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Snippets\Debugger; +namespace Google\Cloud\Debugger\Tests\Snippet; use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Debugger\Daemon; diff --git a/tests/snippets/Debugger/DebuggeeTest.php b/Debugger/tests/Snippet/DebuggeeTest.php similarity index 99% rename from tests/snippets/Debugger/DebuggeeTest.php rename to Debugger/tests/Snippet/DebuggeeTest.php index 2e448221ce30..4ab91e3d7458 100644 --- a/tests/snippets/Debugger/DebuggeeTest.php +++ b/Debugger/tests/Snippet/DebuggeeTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Snippets\Debugger; +namespace Google\Cloud\Debugger\Tests\Snippet; use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Debugger\Breakpoint; diff --git a/tests/snippets/Debugger/DebuggerClientTest.php b/Debugger/tests/Snippet/DebuggerClientTest.php similarity index 100% rename from tests/snippets/Debugger/DebuggerClientTest.php rename to Debugger/tests/Snippet/DebuggerClientTest.php diff --git a/tests/snippets/Debugger/ExtendedSourceContextTest.php b/Debugger/tests/Snippet/ExtendedSourceContextTest.php similarity index 97% rename from tests/snippets/Debugger/ExtendedSourceContextTest.php rename to Debugger/tests/Snippet/ExtendedSourceContextTest.php index db48558ea6af..41feac3e2877 100644 --- a/tests/snippets/Debugger/ExtendedSourceContextTest.php +++ b/Debugger/tests/Snippet/ExtendedSourceContextTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Snippets\Debugger; +namespace Google\Cloud\Debugger\Tests\Snippet; use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Debugger\ExtendedSourceContext; diff --git a/tests/snippets/Debugger/FormatMessageTest.php b/Debugger/tests/Snippet/FormatMessageTest.php similarity index 96% rename from tests/snippets/Debugger/FormatMessageTest.php rename to Debugger/tests/Snippet/FormatMessageTest.php index f06a5d570f93..9b8bf8ac732f 100644 --- a/tests/snippets/Debugger/FormatMessageTest.php +++ b/Debugger/tests/Snippet/FormatMessageTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Snippets\Debugger; +namespace Google\Cloud\Debugger\Tests\Snippet; use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Debugger\FormatMessage; diff --git a/tests/snippets/Debugger/GerritSourceContextTest.php b/Debugger/tests/Snippet/GerritSourceContextTest.php similarity index 95% rename from tests/snippets/Debugger/GerritSourceContextTest.php rename to Debugger/tests/Snippet/GerritSourceContextTest.php index 8d3a6e97b6df..0fb027aee744 100644 --- a/tests/snippets/Debugger/GerritSourceContextTest.php +++ b/Debugger/tests/Snippet/GerritSourceContextTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Snippets\Debugger; +namespace Google\Cloud\Debugger\Tests\Snippet; use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Debugger\GerritSourceContext; diff --git a/tests/snippets/Debugger/GitSourceContextTest.php b/Debugger/tests/Snippet/GitSourceContextTest.php similarity index 95% rename from tests/snippets/Debugger/GitSourceContextTest.php rename to Debugger/tests/Snippet/GitSourceContextTest.php index 378acd32b256..20f557a85d95 100644 --- a/tests/snippets/Debugger/GitSourceContextTest.php +++ b/Debugger/tests/Snippet/GitSourceContextTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Snippets\Debugger; +namespace Google\Cloud\Debugger\Tests\Snippet; use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Debugger\GitSourceContext; diff --git a/tests/snippets/Debugger/MatchingFileIteratorTest.php b/Debugger/tests/Snippet/MatchingFileIteratorTest.php similarity index 91% rename from tests/snippets/Debugger/MatchingFileIteratorTest.php rename to Debugger/tests/Snippet/MatchingFileIteratorTest.php index 16d3e4af0937..e9bc18f9609d 100644 --- a/tests/snippets/Debugger/MatchingFileIteratorTest.php +++ b/Debugger/tests/Snippet/MatchingFileIteratorTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Snippets\Debugger; +namespace Google\Cloud\Debugger\Tests\Snippet; use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Debugger\MatchingFileIterator; @@ -28,6 +28,9 @@ class MatchingFileIteratorTest extends SnippetTestCase public function testClass() { $snippet = $this->snippetFromClass(MatchingFileIterator::class); + + $this->markTestSkipped('unreliable paths'); + $snippet->addUse(MatchingFileIterator::class); $matches = $snippet->invoke('matches')->returnVal(); $this->assertCount(1, $matches); diff --git a/tests/snippets/Debugger/ProjectRepoIdTest.php b/Debugger/tests/Snippet/ProjectRepoIdTest.php similarity index 95% rename from tests/snippets/Debugger/ProjectRepoIdTest.php rename to Debugger/tests/Snippet/ProjectRepoIdTest.php index d5e47da17db8..72582bc8a4f0 100644 --- a/tests/snippets/Debugger/ProjectRepoIdTest.php +++ b/Debugger/tests/Snippet/ProjectRepoIdTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Snippets\Debugger; +namespace Google\Cloud\Debugger\Tests\Snippet; use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Debugger\ProjectRepoId; diff --git a/tests/snippets/Debugger/RepoIdTest.php b/Debugger/tests/Snippet/RepoIdTest.php similarity index 95% rename from tests/snippets/Debugger/RepoIdTest.php rename to Debugger/tests/Snippet/RepoIdTest.php index bdaa87f4a3c9..fc509cb5e9cb 100644 --- a/tests/snippets/Debugger/RepoIdTest.php +++ b/Debugger/tests/Snippet/RepoIdTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Snippets\Debugger; +namespace Google\Cloud\Debugger\Tests\Snippet; use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Debugger\RepoId; diff --git a/tests/snippets/Debugger/SourceLocationResolverTest.php b/Debugger/tests/Snippet/SourceLocationResolverTest.php similarity index 97% rename from tests/snippets/Debugger/SourceLocationResolverTest.php rename to Debugger/tests/Snippet/SourceLocationResolverTest.php index 3d1a167e970e..5e50fb178d15 100644 --- a/tests/snippets/Debugger/SourceLocationResolverTest.php +++ b/Debugger/tests/Snippet/SourceLocationResolverTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Snippets\Debugger; +namespace Google\Cloud\Debugger\Tests\Snippet; use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Debugger\SourceLocation; diff --git a/tests/snippets/Debugger/SourceLocationTest.php b/Debugger/tests/Snippet/SourceLocationTest.php similarity index 97% rename from tests/snippets/Debugger/SourceLocationTest.php rename to Debugger/tests/Snippet/SourceLocationTest.php index a43a0ab1d21e..88c77eb976d4 100644 --- a/tests/snippets/Debugger/SourceLocationTest.php +++ b/Debugger/tests/Snippet/SourceLocationTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Snippets\Debugger; +namespace Google\Cloud\Debugger\Tests\Snippet; use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Debugger\SourceLocation; diff --git a/tests/snippets/Debugger/StackFrameTest.php b/Debugger/tests/Snippet/StackFrameTest.php similarity index 97% rename from tests/snippets/Debugger/StackFrameTest.php rename to Debugger/tests/Snippet/StackFrameTest.php index b0f27396c176..260ab7ae1d2d 100644 --- a/tests/snippets/Debugger/StackFrameTest.php +++ b/Debugger/tests/Snippet/StackFrameTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Snippets\Debugger; +namespace Google\Cloud\Debugger\Tests\Snippet; use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Debugger\StackFrame; diff --git a/tests/snippets/Debugger/StatusMessageTest.php b/Debugger/tests/Snippet/StatusMessageTest.php similarity index 96% rename from tests/snippets/Debugger/StatusMessageTest.php rename to Debugger/tests/Snippet/StatusMessageTest.php index 570150857c8f..7e959a18e74e 100644 --- a/tests/snippets/Debugger/StatusMessageTest.php +++ b/Debugger/tests/Snippet/StatusMessageTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Snippets\Debugger; +namespace Google\Cloud\Debugger\Tests\Snippet; use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Debugger\StatusMessage; diff --git a/tests/snippets/Debugger/VariableTableTest.php b/Debugger/tests/Snippet/VariableTableTest.php similarity index 97% rename from tests/snippets/Debugger/VariableTableTest.php rename to Debugger/tests/Snippet/VariableTableTest.php index e4726dec903b..d038b8665248 100644 --- a/tests/snippets/Debugger/VariableTableTest.php +++ b/Debugger/tests/Snippet/VariableTableTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Snippets\Debugger; +namespace Google\Cloud\Debugger\Tests\Snippet; use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Debugger\Variable; diff --git a/tests/snippets/Debugger/VariableTest.php b/Debugger/tests/Snippet/VariableTest.php similarity index 96% rename from tests/snippets/Debugger/VariableTest.php rename to Debugger/tests/Snippet/VariableTest.php index 42e63b43a0c0..4ca157e14193 100644 --- a/tests/snippets/Debugger/VariableTest.php +++ b/Debugger/tests/Snippet/VariableTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Snippets\Debugger; +namespace Google\Cloud\Debugger\Tests\Snippet; use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Debugger\Variable; diff --git a/tests/system/Debugger/BasicTest.php b/Debugger/tests/System/BasicTest.php similarity index 98% rename from tests/system/Debugger/BasicTest.php rename to Debugger/tests/System/BasicTest.php index a486311c10ce..852a07f4fb09 100644 --- a/tests/system/Debugger/BasicTest.php +++ b/Debugger/tests/System/BasicTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\System\Debugger; +namespace Google\Cloud\Debugger\Tests\System; use Google\Cloud\Debugger\Breakpoint; use Google\Cloud\Debugger\Debuggee; diff --git a/tests/system/Debugger/E2ETest.php b/Debugger/tests/System/E2ETest.php similarity index 99% rename from tests/system/Debugger/E2ETest.php rename to Debugger/tests/System/E2ETest.php index 6f31e6010d9d..0799ab8517ac 100644 --- a/tests/system/Debugger/E2ETest.php +++ b/Debugger/tests/System/E2ETest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\System\Debugger; +namespace Google\Cloud\Debugger\Tests\System; use Google\Cloud\Debugger\DebuggerClient; use Google\Cloud\Debugger\Breakpoint; diff --git a/tests/system/Debugger/app/.gitignore b/Debugger/tests/System/app/.gitignore similarity index 100% rename from tests/system/Debugger/app/.gitignore rename to Debugger/tests/System/app/.gitignore diff --git a/Debugger/tests/System/app/additional-supervisord.conf b/Debugger/tests/System/app/additional-supervisord.conf new file mode 100644 index 000000000000..bd14ca20a634 --- /dev/null +++ b/Debugger/tests/System/app/additional-supervisord.conf @@ -0,0 +1,11 @@ +[program:debugger-daemon] +command = php -d auto_prepend_file='' -d disable_functions='' /app/vendor/bin/google-cloud-debugger /app +stdout_logfile = /dev/stdout +stdout_logfile_maxbytes=0 +stderr_logfile = /dev/stderr +stderr_logfile_maxbytes=0 +user = www-data +autostart = true +autorestart = true +priority = 5 +stopwaitsecs = 20 diff --git a/tests/system/Debugger/app/app.yaml b/Debugger/tests/System/app/app.yaml similarity index 100% rename from tests/system/Debugger/app/app.yaml rename to Debugger/tests/System/app/app.yaml diff --git a/tests/system/Debugger/app/web/app.php b/Debugger/tests/System/app/web/app.php similarity index 100% rename from tests/system/Debugger/app/web/app.php rename to Debugger/tests/System/app/web/app.php diff --git a/tests/system/Debugger/app/web/index.php b/Debugger/tests/System/app/web/index.php similarity index 100% rename from tests/system/Debugger/app/web/index.php rename to Debugger/tests/System/app/web/index.php diff --git a/Debugger/tests/System/bootstrap.php b/Debugger/tests/System/bootstrap.php new file mode 100644 index 000000000000..38465605b9a8 --- /dev/null +++ b/Debugger/tests/System/bootstrap.php @@ -0,0 +1,5 @@ +markTestSkipped('unreliable paths'); + + $path = 'DebuggerClient.php'; $breakpoint = new Breakpoint([ 'location' => [ 'path' => $path, 'line' => 1 ] ]); - $this->assertTrue($breakpoint->resolveLocation()); + $cwd = realpath(implode(DIRECTORY_SEPARATOR, [__DIR__, '../../'])); + $resolver = new SourceLocationResolver([$cwd]); + $this->assertTrue($breakpoint->resolveLocation($resolver)); // resolved location should have changed the path $this->assertLessThan(strlen($breakpoint->location()->path()), strlen($path)); diff --git a/tests/unit/Debugger/BreakpointValidationTest.php b/Debugger/tests/Unit/BreakpointValidationTest.php similarity index 99% rename from tests/unit/Debugger/BreakpointValidationTest.php rename to Debugger/tests/Unit/BreakpointValidationTest.php index 2d76007adc57..f6373b991f28 100644 --- a/tests/unit/Debugger/BreakpointValidationTest.php +++ b/Debugger/tests/Unit/BreakpointValidationTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Unit\Debugger; +namespace Google\Cloud\Debugger\Tests\Unit; use Google\Cloud\Debugger\StatusMessage; use Google\Cloud\Debugger\Breakpoint; diff --git a/tests/unit/Debugger/CliDaemonTest.php b/Debugger/tests/Unit/CliDaemonTest.php similarity index 97% rename from tests/unit/Debugger/CliDaemonTest.php rename to Debugger/tests/Unit/CliDaemonTest.php index e93aef27956a..35b46a897065 100644 --- a/tests/unit/Debugger/CliDaemonTest.php +++ b/Debugger/tests/Unit/CliDaemonTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Unit\Debugger; +namespace Google\Cloud\Debugger\Tests\Unit; use Google\Cloud\Debugger\CliDaemon; use PHPUnit\Framework\TestCase; diff --git a/tests/unit/Debugger/CloudRepoSourceContextTest.php b/Debugger/tests/Unit/CloudRepoSourceContextTest.php similarity index 97% rename from tests/unit/Debugger/CloudRepoSourceContextTest.php rename to Debugger/tests/Unit/CloudRepoSourceContextTest.php index 56312481f06c..8362cd6bb83d 100644 --- a/tests/unit/Debugger/CloudRepoSourceContextTest.php +++ b/Debugger/tests/Unit/CloudRepoSourceContextTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Unit\Debugger; +namespace Google\Cloud\Debugger\Tests\Unit; use Google\Cloud\Debugger\AliasContext; use Google\Cloud\Debugger\CloudRepoSourceContext; diff --git a/tests/unit/Debugger/CloudWorkspaceIdTest.php b/Debugger/tests/Unit/CloudWorkspaceIdTest.php similarity index 96% rename from tests/unit/Debugger/CloudWorkspaceIdTest.php rename to Debugger/tests/Unit/CloudWorkspaceIdTest.php index bb3677d91c01..dff4a4cddd36 100644 --- a/tests/unit/Debugger/CloudWorkspaceIdTest.php +++ b/Debugger/tests/Unit/CloudWorkspaceIdTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Unit\Debugger; +namespace Google\Cloud\Debugger\Tests\Unit; use Google\Cloud\Debugger\CloudWorkspaceId; use Google\Cloud\Debugger\ProjectRepoId; diff --git a/tests/unit/Debugger/CloudWorkspaceSourceContextTest.php b/Debugger/tests/Unit/CloudWorkspaceSourceContextTest.php similarity index 97% rename from tests/unit/Debugger/CloudWorkspaceSourceContextTest.php rename to Debugger/tests/Unit/CloudWorkspaceSourceContextTest.php index 45a4d7838474..4bdf91e7ae17 100644 --- a/tests/unit/Debugger/CloudWorkspaceSourceContextTest.php +++ b/Debugger/tests/Unit/CloudWorkspaceSourceContextTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Unit\Debugger; +namespace Google\Cloud\Debugger\Tests\Unit; use Google\Cloud\Debugger\CloudWorkspaceId; use Google\Cloud\Debugger\CloudWorkspaceSourceContext; diff --git a/tests/unit/Debugger/Connection/RestTest.php b/Debugger/tests/Unit/Connection/RestTest.php similarity index 97% rename from tests/unit/Debugger/Connection/RestTest.php rename to Debugger/tests/Unit/Connection/RestTest.php index 223029cb95a3..6a0b21283963 100644 --- a/tests/unit/Debugger/Connection/RestTest.php +++ b/Debugger/tests/Unit/Connection/RestTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Unit\Debugger\Connection; +namespace Google\Cloud\Debugger\Tests\Unit\Connection; use Google\Cloud\Debugger\Connection\Rest; use Google\Cloud\Core\RequestBuilder; diff --git a/tests/unit/Debugger/DaemonTest.php b/Debugger/tests/Unit/DaemonTest.php similarity index 99% rename from tests/unit/Debugger/DaemonTest.php rename to Debugger/tests/Unit/DaemonTest.php index e7b143d64fb2..c085572de828 100644 --- a/tests/unit/Debugger/DaemonTest.php +++ b/Debugger/tests/Unit/DaemonTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Unit\Debugger; +namespace Google\Cloud\Debugger\Tests\Unit; use Google\Cloud\Core\Report\SimpleMetadataProvider; use Google\Cloud\Debugger\Breakpoint; diff --git a/tests/unit/Debugger/DebuggeeTest.php b/Debugger/tests/Unit/DebuggeeTest.php similarity index 99% rename from tests/unit/Debugger/DebuggeeTest.php rename to Debugger/tests/Unit/DebuggeeTest.php index 304a8c17a730..c25b4ac8c9bc 100644 --- a/tests/unit/Debugger/DebuggeeTest.php +++ b/Debugger/tests/Unit/DebuggeeTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Unit\Debugger; +namespace Google\Cloud\Debugger\Tests\Unit; use Google\Cloud\Debugger\Breakpoint; use Google\Cloud\Debugger\Debuggee; diff --git a/tests/unit/Debugger/DebuggerClientTest.php b/Debugger/tests/Unit/DebuggerClientTest.php similarity index 98% rename from tests/unit/Debugger/DebuggerClientTest.php rename to Debugger/tests/Unit/DebuggerClientTest.php index 2930e12000c2..11b6fc9796a0 100644 --- a/tests/unit/Debugger/DebuggerClientTest.php +++ b/Debugger/tests/Unit/DebuggerClientTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Unit\Debugger; +namespace Google\Cloud\Debugger\Tests\Unit; use Google\Cloud\Debugger\Connection\ConnectionInterface; use Google\Cloud\Debugger\DebuggerClient; diff --git a/tests/unit/Debugger/ExtendedSourceContextTest.php b/Debugger/tests/Unit/ExtendedSourceContextTest.php similarity index 96% rename from tests/unit/Debugger/ExtendedSourceContextTest.php rename to Debugger/tests/Unit/ExtendedSourceContextTest.php index a2be91e4180d..65cd4ee6863a 100644 --- a/tests/unit/Debugger/ExtendedSourceContextTest.php +++ b/Debugger/tests/Unit/ExtendedSourceContextTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Unit\Debugger; +namespace Google\Cloud\Debugger\Tests\Unit; use Google\Cloud\Debugger\ExtendedSourceContext; use Google\Cloud\Debugger\GitSourceContext; diff --git a/tests/unit/Debugger/FormatMessageTest.php b/Debugger/tests/Unit/FormatMessageTest.php similarity index 96% rename from tests/unit/Debugger/FormatMessageTest.php rename to Debugger/tests/Unit/FormatMessageTest.php index 9fbbafe02505..66ece5dd4d36 100644 --- a/tests/unit/Debugger/FormatMessageTest.php +++ b/Debugger/tests/Unit/FormatMessageTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Unit\Debugger; +namespace Google\Cloud\Debugger\Tests\Unit; use Google\Cloud\Debugger\FormatMessage; use PHPUnit\Framework\TestCase; diff --git a/tests/unit/Debugger/GerritSourceContextTest.php b/Debugger/tests/Unit/GerritSourceContextTest.php similarity index 97% rename from tests/unit/Debugger/GerritSourceContextTest.php rename to Debugger/tests/Unit/GerritSourceContextTest.php index 8020d0958c79..48aba05340e1 100644 --- a/tests/unit/Debugger/GerritSourceContextTest.php +++ b/Debugger/tests/Unit/GerritSourceContextTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Unit\Debugger; +namespace Google\Cloud\Debugger\Tests\Unit; use Google\Cloud\Debugger\AliasContext; use Google\Cloud\Debugger\GerritSourceContext; diff --git a/tests/unit/Debugger/GitSourceContextTest.php b/Debugger/tests/Unit/GitSourceContextTest.php similarity index 96% rename from tests/unit/Debugger/GitSourceContextTest.php rename to Debugger/tests/Unit/GitSourceContextTest.php index 694680b07cd0..6a4b4df329d0 100644 --- a/tests/unit/Debugger/GitSourceContextTest.php +++ b/Debugger/tests/Unit/GitSourceContextTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Unit\Debugger; +namespace Google\Cloud\Debugger\Tests\Unit; use Google\Cloud\Debugger\GitSourceContext; use PHPUnit\Framework\TestCase; diff --git a/tests/unit/Debugger/JsonTestTrait.php b/Debugger/tests/Unit/JsonTestTrait.php similarity index 96% rename from tests/unit/Debugger/JsonTestTrait.php rename to Debugger/tests/Unit/JsonTestTrait.php index fd8e797d0840..5313e349f40e 100644 --- a/tests/unit/Debugger/JsonTestTrait.php +++ b/Debugger/tests/Unit/JsonTestTrait.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Unit\Debugger; +namespace Google\Cloud\Debugger\Tests\Unit; trait JsonTestTrait { diff --git a/tests/unit/Debugger/MatchingFileIteratorTest.php b/Debugger/tests/Unit/MatchingFileIteratorTest.php similarity index 93% rename from tests/unit/Debugger/MatchingFileIteratorTest.php rename to Debugger/tests/Unit/MatchingFileIteratorTest.php index 1a975aba8690..caae22d36680 100644 --- a/tests/unit/Debugger/MatchingFileIteratorTest.php +++ b/Debugger/tests/Unit/MatchingFileIteratorTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Unit\Debugger; +namespace Google\Cloud\Debugger\Tests\Unit; use Google\Cloud\Debugger\MatchingFileIterator; use PHPUnit\Framework\TestCase; @@ -29,7 +29,7 @@ public function testFindsMany() { // There are many files that end in Connection/RestTest.php in the test/unit folder $iterator = new MatchingFileIterator( - realpath($this->sourcePath([__DIR__, '..'])), + realpath($this->sourcePath([__DIR__, '../../..'])), $this->sourcePath(['Connection', 'RestTest.php']) ); $matches = iterator_to_array($iterator); diff --git a/tests/unit/Debugger/ProjectRepoIdTest.php b/Debugger/tests/Unit/ProjectRepoIdTest.php similarity index 96% rename from tests/unit/Debugger/ProjectRepoIdTest.php rename to Debugger/tests/Unit/ProjectRepoIdTest.php index 26c241e45c0e..3ff341cb16ad 100644 --- a/tests/unit/Debugger/ProjectRepoIdTest.php +++ b/Debugger/tests/Unit/ProjectRepoIdTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Unit\Debugger; +namespace Google\Cloud\Debugger\Tests\Unit; use Google\Cloud\Debugger\ProjectRepoId; use PHPUnit\Framework\TestCase; diff --git a/tests/unit/Debugger/RepoIdTest.php b/Debugger/tests/Unit/RepoIdTest.php similarity index 96% rename from tests/unit/Debugger/RepoIdTest.php rename to Debugger/tests/Unit/RepoIdTest.php index 0754e99f95b0..e2626d349ae1 100644 --- a/tests/unit/Debugger/RepoIdTest.php +++ b/Debugger/tests/Unit/RepoIdTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Unit\Debugger; +namespace Google\Cloud\Debugger\Tests\Unit; use Google\Cloud\Debugger\ProjectRepoId; use Google\Cloud\Debugger\RepoId; diff --git a/tests/unit/Debugger/SourceLocationResolverTest.php b/Debugger/tests/Unit/SourceLocationResolverTest.php similarity index 69% rename from tests/unit/Debugger/SourceLocationResolverTest.php rename to Debugger/tests/Unit/SourceLocationResolverTest.php index ab1538cda459..575fb70ab6b7 100644 --- a/tests/unit/Debugger/SourceLocationResolverTest.php +++ b/Debugger/tests/Unit/SourceLocationResolverTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Unit\Debugger; +namespace Google\Cloud\Debugger\Tests\Unit; use Google\Cloud\Debugger\SourceLocation; use Google\Cloud\Debugger\SourceLocationResolver; @@ -26,35 +26,42 @@ */ class SourceLocationResolverTest extends TestCase { + private static $cwd; + + public static function setUpBeforeClass() + { + self::$cwd = realpath(implode(DIRECTORY_SEPARATOR, [__DIR__, '../../'])); + } + public function testExactMatch() { - $location = new SourceLocation('src/Debugger/DebuggerClient.php', 1); - $resolver = new SourceLocationResolver(); + $location = new SourceLocation('src/DebuggerClient.php', 1); + $resolver = new SourceLocationResolver([self::$cwd]); $resolvedLocation = $resolver->resolve($location); $this->assertInstanceOf(SourceLocation::class, $resolvedLocation); - $expectedFile = $this->sourcePath(['src', 'Debugger', 'DebuggerClient.php']); + $expectedFile = $this->sourcePath(['src', 'DebuggerClient.php']); $this->assertEquals($expectedFile, $resolvedLocation->path()); $this->assertEquals(1, $resolvedLocation->line()); } public function testExtraDirectories() { - $location = new SourceLocation('extra/src/Debugger/DebuggerClient.php', 1); - $resolver = new SourceLocationResolver(); + $location = new SourceLocation('extra/src/DebuggerClient.php', 1); + $resolver = new SourceLocationResolver([self::$cwd]); $resolvedLocation = $resolver->resolve($location); $this->assertInstanceOf(SourceLocation::class, $resolvedLocation); - $expectedFile = $this->sourcePath(['src', 'Debugger', 'DebuggerClient.php']); + $expectedFile = $this->sourcePath(['src', 'DebuggerClient.php']); $this->assertEquals($expectedFile, $resolvedLocation->path()); $this->assertEquals(1, $resolvedLocation->line()); } public function testMissingDirectories() { - $location = new SourceLocation('Debugger/DebuggerClient.php', 1); - $resolver = new SourceLocationResolver(); + $location = new SourceLocation('DebuggerClient.php', 1); + $resolver = new SourceLocationResolver([self::$cwd]); $resolvedLocation = $resolver->resolve($location); $this->assertInstanceOf(SourceLocation::class, $resolvedLocation); - $expectedFile = $this->sourcePath(['src', 'Debugger', 'DebuggerClient.php']); + $expectedFile = $this->sourcePath(['src', 'DebuggerClient.php']); $this->assertEquals($expectedFile, $resolvedLocation->path()); $this->assertEquals(1, $resolvedLocation->line()); } diff --git a/tests/unit/Debugger/SourceLocationTest.php b/Debugger/tests/Unit/SourceLocationTest.php similarity index 95% rename from tests/unit/Debugger/SourceLocationTest.php rename to Debugger/tests/Unit/SourceLocationTest.php index d708ccb731e4..23d98b910d1c 100644 --- a/tests/unit/Debugger/SourceLocationTest.php +++ b/Debugger/tests/Unit/SourceLocationTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Unit\Debugger; +namespace Google\Cloud\Debugger\Tests\Unit; use Google\Cloud\Debugger\SourceLocation; use PHPUnit\Framework\TestCase; diff --git a/tests/unit/Debugger/StackFrameTest.php b/Debugger/tests/Unit/StackFrameTest.php similarity index 97% rename from tests/unit/Debugger/StackFrameTest.php rename to Debugger/tests/Unit/StackFrameTest.php index cc638374febe..e3e892cc3b5f 100644 --- a/tests/unit/Debugger/StackFrameTest.php +++ b/Debugger/tests/Unit/StackFrameTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Unit\Debugger; +namespace Google\Cloud\Debugger\Tests\Unit; use Google\Cloud\Debugger\SourceLocation; use Google\Cloud\Debugger\StackFrame; diff --git a/tests/unit/Debugger/StatusMessageTest.php b/Debugger/tests/Unit/StatusMessageTest.php similarity index 96% rename from tests/unit/Debugger/StatusMessageTest.php rename to Debugger/tests/Unit/StatusMessageTest.php index 4bb14c67fff9..79e7cffb6ae3 100644 --- a/tests/unit/Debugger/StatusMessageTest.php +++ b/Debugger/tests/Unit/StatusMessageTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Unit\Debugger; +namespace Google\Cloud\Debugger\Tests\Unit; use Google\Cloud\Debugger\FormatMessage; use Google\Cloud\Debugger\Reference; diff --git a/tests/unit/Debugger/VariableTableTest.php b/Debugger/tests/Unit/VariableTableTest.php similarity index 99% rename from tests/unit/Debugger/VariableTableTest.php rename to Debugger/tests/Unit/VariableTableTest.php index f27cb5871e21..cb7b314efcc4 100644 --- a/tests/unit/Debugger/VariableTableTest.php +++ b/Debugger/tests/Unit/VariableTableTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Unit\Debugger; +namespace Google\Cloud\Debugger\Tests\Unit; use Google\Cloud\Debugger\VariableTable; use Google\Cloud\Core\Int64; diff --git a/tests/unit/Debugger/VariableTest.php b/Debugger/tests/Unit/VariableTest.php similarity index 97% rename from tests/unit/Debugger/VariableTest.php rename to Debugger/tests/Unit/VariableTest.php index 8eaf744f1adb..58d46acd3204 100644 --- a/tests/unit/Debugger/VariableTest.php +++ b/Debugger/tests/Unit/VariableTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Unit\Debugger; +namespace Google\Cloud\Debugger\Tests\Unit; use Google\Cloud\Debugger\Variable; use PHPUnit\Framework\TestCase; diff --git a/tests/unit/Debugger/data/daemon_config.php b/Debugger/tests/Unit/data/daemon_config.php similarity index 100% rename from tests/unit/Debugger/data/daemon_config.php rename to Debugger/tests/Unit/data/daemon_config.php diff --git a/tests/unit/Debugger/data/daemon_config_wrong_return.php b/Debugger/tests/Unit/data/daemon_config_wrong_return.php similarity index 100% rename from tests/unit/Debugger/data/daemon_config_wrong_return.php rename to Debugger/tests/Unit/data/daemon_config_wrong_return.php diff --git a/tests/unit/Debugger/data/file.php b/Debugger/tests/Unit/data/file.php similarity index 100% rename from tests/unit/Debugger/data/file.php rename to Debugger/tests/Unit/data/file.php diff --git a/tests/unit/Debugger/data/nested/folder/file2.php b/Debugger/tests/Unit/data/nested/folder/file2.php similarity index 100% rename from tests/unit/Debugger/data/nested/folder/file2.php rename to Debugger/tests/Unit/data/nested/folder/file2.php diff --git a/tests/unit/Debugger/data/source-context.json b/Debugger/tests/Unit/data/source-context.json similarity index 100% rename from tests/unit/Debugger/data/source-context.json rename to Debugger/tests/Unit/data/source-context.json diff --git a/src/Core/.github/pull_request_template.md b/Dlp/.github/pull_request_template.md similarity index 93% rename from src/Core/.github/pull_request_template.md rename to Dlp/.github/pull_request_template.md index c63e788a6bbc..89f1d319b708 100644 --- a/src/Core/.github/pull_request_template.md +++ b/Dlp/.github/pull_request_template.md @@ -14,7 +14,7 @@ $ git clone git@github.com:GoogleCloudPlatform/google-cloud-php.git ``` * Move your changes into the correct location in that library. Library code -belongs in `src/Core`, and tests in `tests/*/Core`. +belongs in `Dlp/src`, and tests in `Dlp/tests`. * Push the changes in a new branch to a fork, and open a new pull request [here](https://github.com/GoogleCloudPlatform/google-cloud-php). diff --git a/src/Dlp/CONTRIBUTING.md b/Dlp/CONTRIBUTING.md similarity index 100% rename from src/Dlp/CONTRIBUTING.md rename to Dlp/CONTRIBUTING.md diff --git a/src/Dlp/LICENSE b/Dlp/LICENSE similarity index 100% rename from src/Dlp/LICENSE rename to Dlp/LICENSE diff --git a/src/Dlp/README.md b/Dlp/README.md similarity index 100% rename from src/Dlp/README.md rename to Dlp/README.md diff --git a/src/Dlp/VERSION b/Dlp/VERSION similarity index 100% rename from src/Dlp/VERSION rename to Dlp/VERSION diff --git a/src/Dlp/composer.json b/Dlp/composer.json similarity index 76% rename from src/Dlp/composer.json rename to Dlp/composer.json index e7a4b7606558..bb1f96efe45e 100644 --- a/src/Dlp/composer.json +++ b/Dlp/composer.json @@ -7,6 +7,11 @@ "google/proto-client": "^0.34", "google/gax": "^0.30" }, + "require-dev": { + "phpunit/phpunit": "^4.8|^5.0", + "google/cloud-core": "^1.14", + "phpdocumentor/reflection": "^3.0" + }, "suggest": { "ext-protobuf": "Provides a significant increase in throughput over the pure PHP protobuf implementation. See https://cloud.google.com/php/grpc for installation instructions." }, @@ -14,13 +19,13 @@ "component": { "id": "cloud-dlp", "target": "GoogleCloudPlatform/google-cloud-php-dlp.git", - "path": "src/Dlp", + "path": "Dlp", "entry": null } }, "autoload": { "psr-4": { - "Google\\Cloud\\Dlp\\": "" + "Google\\Cloud\\Dlp\\": "src" } } } diff --git a/Dlp/phpunit-snippets.xml.dist b/Dlp/phpunit-snippets.xml.dist new file mode 100644 index 000000000000..b92fd83e3c1b --- /dev/null +++ b/Dlp/phpunit-snippets.xml.dist @@ -0,0 +1,19 @@ + + + + + tests/Snippet + + + + + src + + src/V[!a-zA-Z]* + + + + diff --git a/Dlp/phpunit-system.xml.dist b/Dlp/phpunit-system.xml.dist new file mode 100644 index 000000000000..f6deee15a036 --- /dev/null +++ b/Dlp/phpunit-system.xml.dist @@ -0,0 +1,16 @@ + + + + + tests/System + + + + + src + + src/V[!a-zA-Z]* + + + + diff --git a/Dlp/phpunit.xml.dist b/Dlp/phpunit.xml.dist new file mode 100644 index 000000000000..1c2b8f6b56d2 --- /dev/null +++ b/Dlp/phpunit.xml.dist @@ -0,0 +1,16 @@ + + + + + tests/Unit + + + + + src + + src/V[!a-zA-Z]* + + + + diff --git a/src/Dlp/V2/DlpServiceClient.php b/Dlp/src/V2/DlpServiceClient.php similarity index 100% rename from src/Dlp/V2/DlpServiceClient.php rename to Dlp/src/V2/DlpServiceClient.php diff --git a/src/Dlp/V2/Gapic/DlpServiceGapicClient.php b/Dlp/src/V2/Gapic/DlpServiceGapicClient.php similarity index 100% rename from src/Dlp/V2/Gapic/DlpServiceGapicClient.php rename to Dlp/src/V2/Gapic/DlpServiceGapicClient.php diff --git a/src/Dlp/V2/README.md b/Dlp/src/V2/README.md similarity index 100% rename from src/Dlp/V2/README.md rename to Dlp/src/V2/README.md diff --git a/src/Dlp/V2/resources/dlp_service_client_config.json b/Dlp/src/V2/resources/dlp_service_client_config.json similarity index 100% rename from src/Dlp/V2/resources/dlp_service_client_config.json rename to Dlp/src/V2/resources/dlp_service_client_config.json diff --git a/src/Dlp/V2/resources/dlp_service_descriptor_config.php b/Dlp/src/V2/resources/dlp_service_descriptor_config.php similarity index 100% rename from src/Dlp/V2/resources/dlp_service_descriptor_config.php rename to Dlp/src/V2/resources/dlp_service_descriptor_config.php diff --git a/src/Dlp/V2/resources/dlp_service_rest_client_config.php b/Dlp/src/V2/resources/dlp_service_rest_client_config.php similarity index 100% rename from src/Dlp/V2/resources/dlp_service_rest_client_config.php rename to Dlp/src/V2/resources/dlp_service_rest_client_config.php diff --git a/src/Dlp/V2beta1/DlpServiceClient.php b/Dlp/src/V2beta1/DlpServiceClient.php similarity index 100% rename from src/Dlp/V2beta1/DlpServiceClient.php rename to Dlp/src/V2beta1/DlpServiceClient.php diff --git a/src/Dlp/V2beta1/Gapic/DlpServiceGapicClient.php b/Dlp/src/V2beta1/Gapic/DlpServiceGapicClient.php similarity index 100% rename from src/Dlp/V2beta1/Gapic/DlpServiceGapicClient.php rename to Dlp/src/V2beta1/Gapic/DlpServiceGapicClient.php diff --git a/src/Dlp/V2beta1/README.md b/Dlp/src/V2beta1/README.md similarity index 100% rename from src/Dlp/V2beta1/README.md rename to Dlp/src/V2beta1/README.md diff --git a/src/Dlp/V2beta1/resources/dlp_service_client_config.json b/Dlp/src/V2beta1/resources/dlp_service_client_config.json similarity index 100% rename from src/Dlp/V2beta1/resources/dlp_service_client_config.json rename to Dlp/src/V2beta1/resources/dlp_service_client_config.json diff --git a/src/Dlp/V2beta1/resources/dlp_service_descriptor_config.php b/Dlp/src/V2beta1/resources/dlp_service_descriptor_config.php similarity index 100% rename from src/Dlp/V2beta1/resources/dlp_service_descriptor_config.php rename to Dlp/src/V2beta1/resources/dlp_service_descriptor_config.php diff --git a/src/Dlp/V2beta1/resources/dlp_service_rest_client_config.php b/Dlp/src/V2beta1/resources/dlp_service_rest_client_config.php similarity index 100% rename from src/Dlp/V2beta1/resources/dlp_service_rest_client_config.php rename to Dlp/src/V2beta1/resources/dlp_service_rest_client_config.php diff --git a/Dlp/tests/System/bootstrap.php b/Dlp/tests/System/bootstrap.php new file mode 100644 index 000000000000..38465605b9a8 --- /dev/null +++ b/Dlp/tests/System/bootstrap.php @@ -0,0 +1,5 @@ + + + + + tests/Snippet + + + + + src + + src/V[!a-zA-Z]* + + + + diff --git a/ErrorReporting/phpunit-system.xml.dist b/ErrorReporting/phpunit-system.xml.dist new file mode 100644 index 000000000000..f6deee15a036 --- /dev/null +++ b/ErrorReporting/phpunit-system.xml.dist @@ -0,0 +1,16 @@ + + + + + tests/System + + + + + src + + src/V[!a-zA-Z]* + + + + diff --git a/ErrorReporting/phpunit.xml.dist b/ErrorReporting/phpunit.xml.dist new file mode 100644 index 000000000000..1c2b8f6b56d2 --- /dev/null +++ b/ErrorReporting/phpunit.xml.dist @@ -0,0 +1,16 @@ + + + + + tests/Unit + + + + + src + + src/V[!a-zA-Z]* + + + + diff --git a/src/ErrorReporting/Bootstrap.php b/ErrorReporting/src/Bootstrap.php similarity index 100% rename from src/ErrorReporting/Bootstrap.php rename to ErrorReporting/src/Bootstrap.php diff --git a/src/ErrorReporting/V1beta1/ErrorGroupServiceClient.php b/ErrorReporting/src/V1beta1/ErrorGroupServiceClient.php similarity index 100% rename from src/ErrorReporting/V1beta1/ErrorGroupServiceClient.php rename to ErrorReporting/src/V1beta1/ErrorGroupServiceClient.php diff --git a/src/ErrorReporting/V1beta1/ErrorStatsServiceClient.php b/ErrorReporting/src/V1beta1/ErrorStatsServiceClient.php similarity index 100% rename from src/ErrorReporting/V1beta1/ErrorStatsServiceClient.php rename to ErrorReporting/src/V1beta1/ErrorStatsServiceClient.php diff --git a/src/ErrorReporting/V1beta1/Gapic/ErrorGroupServiceGapicClient.php b/ErrorReporting/src/V1beta1/Gapic/ErrorGroupServiceGapicClient.php similarity index 100% rename from src/ErrorReporting/V1beta1/Gapic/ErrorGroupServiceGapicClient.php rename to ErrorReporting/src/V1beta1/Gapic/ErrorGroupServiceGapicClient.php diff --git a/src/ErrorReporting/V1beta1/Gapic/ErrorStatsServiceGapicClient.php b/ErrorReporting/src/V1beta1/Gapic/ErrorStatsServiceGapicClient.php similarity index 100% rename from src/ErrorReporting/V1beta1/Gapic/ErrorStatsServiceGapicClient.php rename to ErrorReporting/src/V1beta1/Gapic/ErrorStatsServiceGapicClient.php diff --git a/src/ErrorReporting/V1beta1/Gapic/ReportErrorsServiceGapicClient.php b/ErrorReporting/src/V1beta1/Gapic/ReportErrorsServiceGapicClient.php similarity index 100% rename from src/ErrorReporting/V1beta1/Gapic/ReportErrorsServiceGapicClient.php rename to ErrorReporting/src/V1beta1/Gapic/ReportErrorsServiceGapicClient.php diff --git a/src/ErrorReporting/V1beta1/README.md b/ErrorReporting/src/V1beta1/README.md similarity index 100% rename from src/ErrorReporting/V1beta1/README.md rename to ErrorReporting/src/V1beta1/README.md diff --git a/src/ErrorReporting/V1beta1/ReportErrorsServiceClient.php b/ErrorReporting/src/V1beta1/ReportErrorsServiceClient.php similarity index 100% rename from src/ErrorReporting/V1beta1/ReportErrorsServiceClient.php rename to ErrorReporting/src/V1beta1/ReportErrorsServiceClient.php diff --git a/src/ErrorReporting/V1beta1/resources/error_group_service_client_config.json b/ErrorReporting/src/V1beta1/resources/error_group_service_client_config.json similarity index 100% rename from src/ErrorReporting/V1beta1/resources/error_group_service_client_config.json rename to ErrorReporting/src/V1beta1/resources/error_group_service_client_config.json diff --git a/src/ErrorReporting/V1beta1/resources/error_group_service_descriptor_config.php b/ErrorReporting/src/V1beta1/resources/error_group_service_descriptor_config.php similarity index 100% rename from src/ErrorReporting/V1beta1/resources/error_group_service_descriptor_config.php rename to ErrorReporting/src/V1beta1/resources/error_group_service_descriptor_config.php diff --git a/src/ErrorReporting/V1beta1/resources/error_group_service_rest_client_config.php b/ErrorReporting/src/V1beta1/resources/error_group_service_rest_client_config.php similarity index 100% rename from src/ErrorReporting/V1beta1/resources/error_group_service_rest_client_config.php rename to ErrorReporting/src/V1beta1/resources/error_group_service_rest_client_config.php diff --git a/src/ErrorReporting/V1beta1/resources/error_stats_service_client_config.json b/ErrorReporting/src/V1beta1/resources/error_stats_service_client_config.json similarity index 100% rename from src/ErrorReporting/V1beta1/resources/error_stats_service_client_config.json rename to ErrorReporting/src/V1beta1/resources/error_stats_service_client_config.json diff --git a/src/ErrorReporting/V1beta1/resources/error_stats_service_descriptor_config.php b/ErrorReporting/src/V1beta1/resources/error_stats_service_descriptor_config.php similarity index 100% rename from src/ErrorReporting/V1beta1/resources/error_stats_service_descriptor_config.php rename to ErrorReporting/src/V1beta1/resources/error_stats_service_descriptor_config.php diff --git a/src/ErrorReporting/V1beta1/resources/error_stats_service_rest_client_config.php b/ErrorReporting/src/V1beta1/resources/error_stats_service_rest_client_config.php similarity index 100% rename from src/ErrorReporting/V1beta1/resources/error_stats_service_rest_client_config.php rename to ErrorReporting/src/V1beta1/resources/error_stats_service_rest_client_config.php diff --git a/src/ErrorReporting/V1beta1/resources/report_errors_service_client_config.json b/ErrorReporting/src/V1beta1/resources/report_errors_service_client_config.json similarity index 100% rename from src/ErrorReporting/V1beta1/resources/report_errors_service_client_config.json rename to ErrorReporting/src/V1beta1/resources/report_errors_service_client_config.json diff --git a/src/ErrorReporting/V1beta1/resources/report_errors_service_descriptor_config.php b/ErrorReporting/src/V1beta1/resources/report_errors_service_descriptor_config.php similarity index 100% rename from src/ErrorReporting/V1beta1/resources/report_errors_service_descriptor_config.php rename to ErrorReporting/src/V1beta1/resources/report_errors_service_descriptor_config.php diff --git a/src/ErrorReporting/V1beta1/resources/report_errors_service_rest_client_config.php b/ErrorReporting/src/V1beta1/resources/report_errors_service_rest_client_config.php similarity index 100% rename from src/ErrorReporting/V1beta1/resources/report_errors_service_rest_client_config.php rename to ErrorReporting/src/V1beta1/resources/report_errors_service_rest_client_config.php diff --git a/src/ErrorReporting/prepend.php b/ErrorReporting/src/prepend.php similarity index 100% rename from src/ErrorReporting/prepend.php rename to ErrorReporting/src/prepend.php diff --git a/ErrorReporting/tests/System/bootstrap.php b/ErrorReporting/tests/System/bootstrap.php new file mode 100644 index 000000000000..38465605b9a8 --- /dev/null +++ b/ErrorReporting/tests/System/bootstrap.php @@ -0,0 +1,5 @@ + + + + + tests/Conformance + + + + + src + + src/V[!a-zA-Z]* + + + + diff --git a/Firestore/phpunit-snippets.xml.dist b/Firestore/phpunit-snippets.xml.dist new file mode 100644 index 000000000000..b92fd83e3c1b --- /dev/null +++ b/Firestore/phpunit-snippets.xml.dist @@ -0,0 +1,19 @@ + + + + + tests/Snippet + + + + + src + + src/V[!a-zA-Z]* + + + + diff --git a/Firestore/phpunit-system.xml.dist b/Firestore/phpunit-system.xml.dist new file mode 100644 index 000000000000..f6deee15a036 --- /dev/null +++ b/Firestore/phpunit-system.xml.dist @@ -0,0 +1,16 @@ + + + + + tests/System + + + + + src + + src/V[!a-zA-Z]* + + + + diff --git a/Firestore/phpunit.xml.dist b/Firestore/phpunit.xml.dist new file mode 100644 index 000000000000..1c2b8f6b56d2 --- /dev/null +++ b/Firestore/phpunit.xml.dist @@ -0,0 +1,16 @@ + + + + + tests/Unit + + + + + src + + src/V[!a-zA-Z]* + + + + diff --git a/src/Firestore/CollectionReference.php b/Firestore/src/CollectionReference.php similarity index 100% rename from src/Firestore/CollectionReference.php rename to Firestore/src/CollectionReference.php diff --git a/src/Firestore/Connection/ConnectionInterface.php b/Firestore/src/Connection/ConnectionInterface.php similarity index 100% rename from src/Firestore/Connection/ConnectionInterface.php rename to Firestore/src/Connection/ConnectionInterface.php diff --git a/src/Firestore/Connection/Grpc.php b/Firestore/src/Connection/Grpc.php similarity index 100% rename from src/Firestore/Connection/Grpc.php rename to Firestore/src/Connection/Grpc.php diff --git a/src/Firestore/DocumentReference.php b/Firestore/src/DocumentReference.php similarity index 100% rename from src/Firestore/DocumentReference.php rename to Firestore/src/DocumentReference.php diff --git a/src/Firestore/DocumentSnapshot.php b/Firestore/src/DocumentSnapshot.php similarity index 100% rename from src/Firestore/DocumentSnapshot.php rename to Firestore/src/DocumentSnapshot.php diff --git a/src/Firestore/FieldPath.php b/Firestore/src/FieldPath.php similarity index 100% rename from src/Firestore/FieldPath.php rename to Firestore/src/FieldPath.php diff --git a/src/Firestore/FieldValue.php b/Firestore/src/FieldValue.php similarity index 100% rename from src/Firestore/FieldValue.php rename to Firestore/src/FieldValue.php diff --git a/src/Firestore/FirestoreClient.php b/Firestore/src/FirestoreClient.php similarity index 99% rename from src/Firestore/FirestoreClient.php rename to Firestore/src/FirestoreClient.php index 40cb13f56676..687b5df1cc19 100644 --- a/src/Firestore/FirestoreClient.php +++ b/Firestore/src/FirestoreClient.php @@ -28,6 +28,7 @@ use Google\Cloud\Core\Retry; use Google\Cloud\Core\ValidateTrait; use Google\Cloud\Firestore\Connection\Grpc; +use Psr\Cache\CacheItemPoolInterface; /** * Cloud Firestore is a flexible, scalable, realtime database for mobile, web, and server development. diff --git a/src/Firestore/PathTrait.php b/Firestore/src/PathTrait.php similarity index 100% rename from src/Firestore/PathTrait.php rename to Firestore/src/PathTrait.php diff --git a/src/Firestore/Query.php b/Firestore/src/Query.php similarity index 100% rename from src/Firestore/Query.php rename to Firestore/src/Query.php diff --git a/src/Firestore/QuerySnapshot.php b/Firestore/src/QuerySnapshot.php similarity index 100% rename from src/Firestore/QuerySnapshot.php rename to Firestore/src/QuerySnapshot.php diff --git a/src/Firestore/SnapshotTrait.php b/Firestore/src/SnapshotTrait.php similarity index 100% rename from src/Firestore/SnapshotTrait.php rename to Firestore/src/SnapshotTrait.php diff --git a/src/Firestore/Transaction.php b/Firestore/src/Transaction.php similarity index 100% rename from src/Firestore/Transaction.php rename to Firestore/src/Transaction.php diff --git a/src/Firestore/V1beta1/FirestoreClient.php b/Firestore/src/V1beta1/FirestoreClient.php similarity index 100% rename from src/Firestore/V1beta1/FirestoreClient.php rename to Firestore/src/V1beta1/FirestoreClient.php diff --git a/src/Firestore/V1beta1/Gapic/FirestoreGapicClient.php b/Firestore/src/V1beta1/Gapic/FirestoreGapicClient.php similarity index 100% rename from src/Firestore/V1beta1/Gapic/FirestoreGapicClient.php rename to Firestore/src/V1beta1/Gapic/FirestoreGapicClient.php diff --git a/src/Firestore/V1beta1/README.md b/Firestore/src/V1beta1/README.md similarity index 100% rename from src/Firestore/V1beta1/README.md rename to Firestore/src/V1beta1/README.md diff --git a/src/Firestore/V1beta1/resources/firestore_client_config.json b/Firestore/src/V1beta1/resources/firestore_client_config.json similarity index 100% rename from src/Firestore/V1beta1/resources/firestore_client_config.json rename to Firestore/src/V1beta1/resources/firestore_client_config.json diff --git a/src/Firestore/V1beta1/resources/firestore_descriptor_config.php b/Firestore/src/V1beta1/resources/firestore_descriptor_config.php similarity index 100% rename from src/Firestore/V1beta1/resources/firestore_descriptor_config.php rename to Firestore/src/V1beta1/resources/firestore_descriptor_config.php diff --git a/src/Firestore/V1beta1/resources/firestore_rest_client_config.php b/Firestore/src/V1beta1/resources/firestore_rest_client_config.php similarity index 100% rename from src/Firestore/V1beta1/resources/firestore_rest_client_config.php rename to Firestore/src/V1beta1/resources/firestore_rest_client_config.php diff --git a/src/Firestore/ValueMapper.php b/Firestore/src/ValueMapper.php similarity index 100% rename from src/Firestore/ValueMapper.php rename to Firestore/src/ValueMapper.php diff --git a/src/Firestore/WriteBatch.php b/Firestore/src/WriteBatch.php similarity index 100% rename from src/Firestore/WriteBatch.php rename to Firestore/src/WriteBatch.php diff --git a/tests/conformance/FirestoreTest.php b/Firestore/tests/Conformance/FirestoreTest.php similarity index 99% rename from tests/conformance/FirestoreTest.php rename to Firestore/tests/Conformance/FirestoreTest.php index cd73bdc8b042..94650435f0c0 100644 --- a/tests/conformance/FirestoreTest.php +++ b/Firestore/tests/Conformance/FirestoreTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Conformance; +namespace Google\Cloud\Firestore\Tests\Conformance; use Google\Cloud\Core\Timestamp; use Google\Cloud\Firestore\Connection\ConnectionInterface; @@ -37,7 +37,7 @@ class FirestoreTest extends TestCase { use PathTrait; - const TEST_FILE = 'https://raw.githubusercontent.com/GoogleCloudPlatform/google-cloud-common/master/testing/firestore/testdata/tests.binprotos'; + const TEST_FILE = 'https://raw.githubusercontent.com/GoogleCloudPlatform/google-cloud-common/master/testing/firestore/testdata/test-suite.binprotos'; private $client; private $connection; diff --git a/tests/conformance/bootstrap.php b/Firestore/tests/Conformance/bootstrap.php similarity index 100% rename from tests/conformance/bootstrap.php rename to Firestore/tests/Conformance/bootstrap.php diff --git a/tests/snippets/Firestore/CollectionReferenceTest.php b/Firestore/tests/Snippet/CollectionReferenceTest.php similarity index 98% rename from tests/snippets/Firestore/CollectionReferenceTest.php rename to Firestore/tests/Snippet/CollectionReferenceTest.php index 30c6dae08f14..4cbc1b4a6bbd 100644 --- a/tests/snippets/Firestore/CollectionReferenceTest.php +++ b/Firestore/tests/Snippet/CollectionReferenceTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Snippets\Firestore; +namespace Google\Cloud\Firestore\Tests\Snippet; use Prophecy\Argument; use Google\Cloud\Firestore\Query; diff --git a/tests/snippets/Firestore/DocumentReferenceTest.php b/Firestore/tests/Snippet/DocumentReferenceTest.php similarity index 99% rename from tests/snippets/Firestore/DocumentReferenceTest.php rename to Firestore/tests/Snippet/DocumentReferenceTest.php index 435557439208..196d602d5a3e 100644 --- a/tests/snippets/Firestore/DocumentReferenceTest.php +++ b/Firestore/tests/Snippet/DocumentReferenceTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Snippets\Firestore; +namespace Google\Cloud\Firestore\Tests\Snippet; use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Firestore\CollectionReference; diff --git a/tests/snippets/Firestore/DocumentSnapshotTest.php b/Firestore/tests/Snippet/DocumentSnapshotTest.php similarity index 99% rename from tests/snippets/Firestore/DocumentSnapshotTest.php rename to Firestore/tests/Snippet/DocumentSnapshotTest.php index 1b706607c426..d17d794942db 100644 --- a/tests/snippets/Firestore/DocumentSnapshotTest.php +++ b/Firestore/tests/Snippet/DocumentSnapshotTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Snippets\Firestore; +namespace Google\Cloud\Firestore\Tests\Snippet; use Google\Cloud\Core\Timestamp; use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; diff --git a/tests/snippets/Firestore/FieldPathTest.php b/Firestore/tests/Snippet/FieldPathTest.php similarity index 95% rename from tests/snippets/Firestore/FieldPathTest.php rename to Firestore/tests/Snippet/FieldPathTest.php index 6f411b56b4c9..c633db4936b3 100644 --- a/tests/snippets/Firestore/FieldPathTest.php +++ b/Firestore/tests/Snippet/FieldPathTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Snippets\Firestore; +namespace Google\Cloud\Firestore\Tests\Snippet; use Google\Cloud\Firestore\FieldPath; use Google\Cloud\Core\Testing\GrpcTestTrait; diff --git a/tests/snippets/Firestore/FieldValueTest.php b/Firestore/tests/Snippet/FieldValueTest.php similarity index 98% rename from tests/snippets/Firestore/FieldValueTest.php rename to Firestore/tests/Snippet/FieldValueTest.php index 0b66884aff79..25ae6c9773d3 100644 --- a/tests/snippets/Firestore/FieldValueTest.php +++ b/Firestore/tests/Snippet/FieldValueTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Snippets\Firestore; +namespace Google\Cloud\Firestore\Tests\Snippet; use Prophecy\Argument; use Google\Cloud\Core\Testing\GrpcTestTrait; diff --git a/tests/snippets/Firestore/FirestoreClientTest.php b/Firestore/tests/Snippet/FirestoreClientTest.php similarity index 99% rename from tests/snippets/Firestore/FirestoreClientTest.php rename to Firestore/tests/Snippet/FirestoreClientTest.php index 697b3ad4d2fd..e77bd682b541 100644 --- a/tests/snippets/Firestore/FirestoreClientTest.php +++ b/Firestore/tests/Snippet/FirestoreClientTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Snippets\Firestore; +namespace Google\Cloud\Firestore\Tests\Snippet; use Prophecy\Argument; use Google\Cloud\Core\Blob; diff --git a/tests/snippets/Firestore/QuerySnapshotTest.php b/Firestore/tests/Snippet/QuerySnapshotTest.php similarity index 98% rename from tests/snippets/Firestore/QuerySnapshotTest.php rename to Firestore/tests/Snippet/QuerySnapshotTest.php index 84a758c7c262..b061b72f7300 100644 --- a/tests/snippets/Firestore/QuerySnapshotTest.php +++ b/Firestore/tests/Snippet/QuerySnapshotTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Snippets\Firestore; +namespace Google\Cloud\Firestore\Tests\Snippet; use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Firestore\Connection\ConnectionInterface; diff --git a/tests/snippets/Firestore/QueryTest.php b/Firestore/tests/Snippet/QueryTest.php similarity index 99% rename from tests/snippets/Firestore/QueryTest.php rename to Firestore/tests/Snippet/QueryTest.php index df16e766dfff..66f46ffbb6cb 100644 --- a/tests/snippets/Firestore/QueryTest.php +++ b/Firestore/tests/Snippet/QueryTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Snippets\Firestore; +namespace Google\Cloud\Firestore\Tests\Snippet; use Prophecy\Argument; use Google\Cloud\Firestore\Query; diff --git a/tests/snippets/Firestore/TransactionTest.php b/Firestore/tests/Snippet/TransactionTest.php similarity index 99% rename from tests/snippets/Firestore/TransactionTest.php rename to Firestore/tests/Snippet/TransactionTest.php index 8a81465e3ea9..9003ffe77368 100644 --- a/tests/snippets/Firestore/TransactionTest.php +++ b/Firestore/tests/Snippet/TransactionTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Snippets\Firestore; +namespace Google\Cloud\Firestore\Tests\Snippet; use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Firestore\CollectionReference; diff --git a/tests/snippets/Firestore/WriteBatchTest.php b/Firestore/tests/Snippet/WriteBatchTest.php similarity index 99% rename from tests/snippets/Firestore/WriteBatchTest.php rename to Firestore/tests/Snippet/WriteBatchTest.php index ccfa5f3797b2..c2076f282635 100644 --- a/tests/snippets/Firestore/WriteBatchTest.php +++ b/Firestore/tests/Snippet/WriteBatchTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Snippets\Firestore; +namespace Google\Cloud\Firestore\Tests\Snippet; use Google\Cloud\Core\Testing\Snippet\Parser\Snippet; use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; diff --git a/tests/system/Firestore/DocumentAndCollectionTest.php b/Firestore/tests/System/DocumentAndCollectionTest.php similarity index 99% rename from tests/system/Firestore/DocumentAndCollectionTest.php rename to Firestore/tests/System/DocumentAndCollectionTest.php index 3c0a2d428746..093568c0508e 100644 --- a/tests/system/Firestore/DocumentAndCollectionTest.php +++ b/Firestore/tests/System/DocumentAndCollectionTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\System\Firestore; +namespace Google\Cloud\Firestore\Tests\System; use Google\Cloud\Core\Timestamp; use Google\Cloud\Firestore\FieldValue; diff --git a/tests/system/Firestore/FirestoreTestCase.php b/Firestore/tests/System/FirestoreTestCase.php similarity index 96% rename from tests/system/Firestore/FirestoreTestCase.php rename to Firestore/tests/System/FirestoreTestCase.php index f7de0a36cc89..8f2105f5bd6c 100644 --- a/tests/system/Firestore/FirestoreTestCase.php +++ b/Firestore/tests/System/FirestoreTestCase.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\System\Firestore; +namespace Google\Cloud\Firestore\Tests\System; use Google\Cloud\Firestore\FirestoreClient; use Google\Cloud\Core\Testing\System\SystemTestCase; diff --git a/tests/system/Firestore/QueryTest.php b/Firestore/tests/System/QueryTest.php similarity index 98% rename from tests/system/Firestore/QueryTest.php rename to Firestore/tests/System/QueryTest.php index c65ff08ad728..cd7190cdac5d 100644 --- a/tests/system/Firestore/QueryTest.php +++ b/Firestore/tests/System/QueryTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\System\Firestore; +namespace Google\Cloud\Firestore\Tests\System; /** * @group firestore diff --git a/tests/system/Firestore/TransactionTest.php b/Firestore/tests/System/TransactionTest.php similarity index 98% rename from tests/system/Firestore/TransactionTest.php rename to Firestore/tests/System/TransactionTest.php index 060f831ae778..475ce0093a62 100644 --- a/tests/system/Firestore/TransactionTest.php +++ b/Firestore/tests/System/TransactionTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\System\Firestore; +namespace Google\Cloud\Firestore\Tests\System; /** * @group firestore diff --git a/tests/system/Firestore/ValueMapperTest.php b/Firestore/tests/System/ValueMapperTest.php similarity index 98% rename from tests/system/Firestore/ValueMapperTest.php rename to Firestore/tests/System/ValueMapperTest.php index 17b821035d60..ec1854888ec2 100644 --- a/tests/system/Firestore/ValueMapperTest.php +++ b/Firestore/tests/System/ValueMapperTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\System\Firestore; +namespace Google\Cloud\Firestore\Tests\System; use Google\Cloud\Core\Blob; use Google\Cloud\Core\GeoPoint; diff --git a/Firestore/tests/System/bootstrap.php b/Firestore/tests/System/bootstrap.php new file mode 100644 index 000000000000..125389a2712a --- /dev/null +++ b/Firestore/tests/System/bootstrap.php @@ -0,0 +1,5 @@ +checkAndSkipGrpcTests(); $this->connection = $this->prophesize(ConnectionInterface::class); - $this->client = \Google\Cloud\Core\Testing\TestHelpers::stub(FirestoreClient::class); + $this->client = \Google\Cloud\Core\Testing\TestHelpers::stub( + FirestoreClient::class, + [['projectId' => self::PROJECT]] + ); } public function testBatch() diff --git a/tests/unit/Firestore/PathTraitTest.php b/Firestore/tests/Unit/PathTraitTest.php similarity index 99% rename from tests/unit/Firestore/PathTraitTest.php rename to Firestore/tests/Unit/PathTraitTest.php index 2851fd4cb957..8fd65e28c1fe 100644 --- a/tests/unit/Firestore/PathTraitTest.php +++ b/Firestore/tests/Unit/PathTraitTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Unit\Firestore; +namespace Google\Cloud\Firestore\Tests\Unit; use Google\Cloud\Firestore\PathTrait; use PHPUnit\Framework\TestCase; diff --git a/tests/unit/Firestore/QuerySnapshotTest.php b/Firestore/tests/Unit/QuerySnapshotTest.php similarity index 98% rename from tests/unit/Firestore/QuerySnapshotTest.php rename to Firestore/tests/Unit/QuerySnapshotTest.php index e9f2c4984c15..ed07475f0671 100644 --- a/tests/unit/Firestore/QuerySnapshotTest.php +++ b/Firestore/tests/Unit/QuerySnapshotTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Unit\Firestore; +namespace Google\Cloud\Firestore\Tests\Unit; use Google\Cloud\Core\Exception\AbortedException; use Google\Cloud\Firestore\Connection\ConnectionInterface; diff --git a/tests/unit/Firestore/QueryTest.php b/Firestore/tests/Unit/QueryTest.php similarity index 99% rename from tests/unit/Firestore/QueryTest.php rename to Firestore/tests/Unit/QueryTest.php index ed759fb40642..4b80a2548567 100644 --- a/tests/unit/Firestore/QueryTest.php +++ b/Firestore/tests/Unit/QueryTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Unit\Firestore; +namespace Google\Cloud\Firestore\Tests\Unit; use Google\Cloud\Firestore\CollectionReference; use Google\Cloud\Firestore\Connection\ConnectionInterface; diff --git a/tests/unit/Firestore/SnapshotTraitTest.php b/Firestore/tests/Unit/SnapshotTraitTest.php similarity index 99% rename from tests/unit/Firestore/SnapshotTraitTest.php rename to Firestore/tests/Unit/SnapshotTraitTest.php index a6008badd652..43d3d95bf1e9 100644 --- a/tests/unit/Firestore/SnapshotTraitTest.php +++ b/Firestore/tests/Unit/SnapshotTraitTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Unit\Firestore; +namespace Google\Cloud\Firestore\Tests\Unit; use Google\Cloud\Core\Timestamp; use Google\Cloud\Firestore\Connection\ConnectionInterface; diff --git a/tests/unit/Firestore/TransactionTest.php b/Firestore/tests/Unit/TransactionTest.php similarity index 99% rename from tests/unit/Firestore/TransactionTest.php rename to Firestore/tests/Unit/TransactionTest.php index 1ba97daff306..3049d1847892 100644 --- a/tests/unit/Firestore/TransactionTest.php +++ b/Firestore/tests/Unit/TransactionTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Unit\Firestore; +namespace Google\Cloud\Firestore\Tests\Unit; use Google\Cloud\Firestore\Connection\ConnectionInterface; use Google\Cloud\Firestore\DocumentReference; diff --git a/tests/unit/Firestore/ValueMapperTest.php b/Firestore/tests/Unit/ValueMapperTest.php similarity index 99% rename from tests/unit/Firestore/ValueMapperTest.php rename to Firestore/tests/Unit/ValueMapperTest.php index 7b073de4a0f0..34ae00944ab1 100644 --- a/tests/unit/Firestore/ValueMapperTest.php +++ b/Firestore/tests/Unit/ValueMapperTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Unit\Firestore; +namespace Google\Cloud\Firestore\Tests\Unit; use Google\Cloud\Core\Blob; use Google\Cloud\Core\GeoPoint; diff --git a/tests/unit/Firestore/WriteBatchTest.php b/Firestore/tests/Unit/WriteBatchTest.php similarity index 99% rename from tests/unit/Firestore/WriteBatchTest.php rename to Firestore/tests/Unit/WriteBatchTest.php index f2c66b017d00..4f163f3f2163 100644 --- a/tests/unit/Firestore/WriteBatchTest.php +++ b/Firestore/tests/Unit/WriteBatchTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Unit\Firestore; +namespace Google\Cloud\Firestore\Tests\Unit; use Google\Cloud\Core\Timestamp; use Google\Cloud\Firestore\Connection\ConnectionInterface; diff --git a/tests/conformance-fixtures/Firestore/GPBMetadata/Test.php b/Firestore/tests/conformance-fixtures/GPBMetadata/Test.php similarity index 100% rename from tests/conformance-fixtures/Firestore/GPBMetadata/Test.php rename to Firestore/tests/conformance-fixtures/GPBMetadata/Test.php diff --git a/tests/conformance-fixtures/Firestore/Tests/CreateTest.php b/Firestore/tests/conformance-fixtures/Tests/CreateTest.php similarity index 100% rename from tests/conformance-fixtures/Firestore/Tests/CreateTest.php rename to Firestore/tests/conformance-fixtures/Tests/CreateTest.php diff --git a/tests/conformance-fixtures/Firestore/Tests/DeleteTest.php b/Firestore/tests/conformance-fixtures/Tests/DeleteTest.php similarity index 100% rename from tests/conformance-fixtures/Firestore/Tests/DeleteTest.php rename to Firestore/tests/conformance-fixtures/Tests/DeleteTest.php diff --git a/tests/conformance-fixtures/Firestore/Tests/FieldPath.php b/Firestore/tests/conformance-fixtures/Tests/FieldPath.php similarity index 100% rename from tests/conformance-fixtures/Firestore/Tests/FieldPath.php rename to Firestore/tests/conformance-fixtures/Tests/FieldPath.php diff --git a/tests/conformance-fixtures/Firestore/Tests/GetTest.php b/Firestore/tests/conformance-fixtures/Tests/GetTest.php similarity index 100% rename from tests/conformance-fixtures/Firestore/Tests/GetTest.php rename to Firestore/tests/conformance-fixtures/Tests/GetTest.php diff --git a/tests/conformance-fixtures/Firestore/Tests/SetOption.php b/Firestore/tests/conformance-fixtures/Tests/SetOption.php similarity index 100% rename from tests/conformance-fixtures/Firestore/Tests/SetOption.php rename to Firestore/tests/conformance-fixtures/Tests/SetOption.php diff --git a/tests/conformance-fixtures/Firestore/Tests/SetTest.php b/Firestore/tests/conformance-fixtures/Tests/SetTest.php similarity index 100% rename from tests/conformance-fixtures/Firestore/Tests/SetTest.php rename to Firestore/tests/conformance-fixtures/Tests/SetTest.php diff --git a/tests/conformance-fixtures/Firestore/Tests/Test.php b/Firestore/tests/conformance-fixtures/Tests/Test.php similarity index 100% rename from tests/conformance-fixtures/Firestore/Tests/Test.php rename to Firestore/tests/conformance-fixtures/Tests/Test.php diff --git a/tests/conformance-fixtures/Firestore/Tests/UpdatePathsTest.php b/Firestore/tests/conformance-fixtures/Tests/UpdatePathsTest.php similarity index 100% rename from tests/conformance-fixtures/Firestore/Tests/UpdatePathsTest.php rename to Firestore/tests/conformance-fixtures/Tests/UpdatePathsTest.php diff --git a/tests/conformance-fixtures/Firestore/Tests/UpdateTest.php b/Firestore/tests/conformance-fixtures/Tests/UpdateTest.php similarity index 100% rename from tests/conformance-fixtures/Firestore/Tests/UpdateTest.php rename to Firestore/tests/conformance-fixtures/Tests/UpdateTest.php diff --git a/tests/conformance-fixtures/VarInt.php b/Firestore/tests/conformance-fixtures/VarInt.php similarity index 100% rename from tests/conformance-fixtures/VarInt.php rename to Firestore/tests/conformance-fixtures/VarInt.php diff --git a/Language/.github/pull_request_template.md b/Language/.github/pull_request_template.md new file mode 100644 index 000000000000..3da604d93626 --- /dev/null +++ b/Language/.github/pull_request_template.md @@ -0,0 +1,24 @@ +**PLEASE READ THIS ENTIRE MESSAGE** + +Hello, and thank you for your contribution! Please note that this repository is +a read-only split of `GoogleCloudPlatform/google-cloud-php`. As such, we are +unable to accept pull requests to this repository. + +We welcome your pull request and would be happy to consider it for inclusion in +our library if you follow these steps: + +* Clone the parent client library repository: + +```sh +$ git clone git@github.com:GoogleCloudPlatform/google-cloud-php.git +``` + +* Move your changes into the correct location in that library. Library code +belongs in `Language/src`, and tests in `Language/tests`. + +* Push the changes in a new branch to a fork, and open a new pull request +[here](https://github.com/GoogleCloudPlatform/google-cloud-php). + +Thanks again, and we look forward to seeing your proposed change! + +The Google Cloud PHP team diff --git a/src/Language/CONTRIBUTING.md b/Language/CONTRIBUTING.md similarity index 100% rename from src/Language/CONTRIBUTING.md rename to Language/CONTRIBUTING.md diff --git a/src/Language/LICENSE b/Language/LICENSE similarity index 100% rename from src/Language/LICENSE rename to Language/LICENSE diff --git a/src/Language/README.md b/Language/README.md similarity index 100% rename from src/Language/README.md rename to Language/README.md diff --git a/src/Language/VERSION b/Language/VERSION similarity index 100% rename from src/Language/VERSION rename to Language/VERSION diff --git a/src/Language/composer.json b/Language/composer.json similarity index 65% rename from src/Language/composer.json rename to Language/composer.json index 03dab2f99ac4..bfd07c09a76b 100644 --- a/src/Language/composer.json +++ b/Language/composer.json @@ -8,6 +8,13 @@ "google/proto-client": "^0.34", "google/gax": "^0.30" }, + "require-dev": { + "phpunit/phpunit": "^4.8|^5.0", + "squizlabs/php_codesniffer": "2.*", + "phpdocumentor/reflection": "^3.0", + "erusev/parsedown": "^1.6", + "google/cloud-storage": "^1.3" + }, "suggest": { "google/cloud-storage": "Analyze documents stored in Google Cloud Storage", "ext-grpc": "The gRPC extension enables use of the performant gRPC transport", @@ -17,13 +24,18 @@ "component": { "id": "cloud-language", "target": "GoogleCloudPlatform/google-cloud-php-language.git", - "path": "src/Language", - "entry": "LanguageClient.php" + "path": "Language", + "entry": "src/LanguageClient.php" } }, "autoload": { "psr-4": { - "Google\\Cloud\\Language\\": "" + "Google\\Cloud\\Language\\": "src" + } + }, + "autoload-dev": { + "psr-4": { + "Google\\Cloud\\Language\\Tests\\": "tests" } } } diff --git a/Language/phpunit-snippets.xml.dist b/Language/phpunit-snippets.xml.dist new file mode 100644 index 000000000000..b92fd83e3c1b --- /dev/null +++ b/Language/phpunit-snippets.xml.dist @@ -0,0 +1,19 @@ + + + + + tests/Snippet + + + + + src + + src/V[!a-zA-Z]* + + + + diff --git a/Language/phpunit-system.xml.dist b/Language/phpunit-system.xml.dist new file mode 100644 index 000000000000..f6deee15a036 --- /dev/null +++ b/Language/phpunit-system.xml.dist @@ -0,0 +1,16 @@ + + + + + tests/System + + + + + src + + src/V[!a-zA-Z]* + + + + diff --git a/Language/phpunit.xml.dist b/Language/phpunit.xml.dist new file mode 100644 index 000000000000..1c2b8f6b56d2 --- /dev/null +++ b/Language/phpunit.xml.dist @@ -0,0 +1,16 @@ + + + + + tests/Unit + + + + + src + + src/V[!a-zA-Z]* + + + + diff --git a/src/Language/Annotation.php b/Language/src/Annotation.php similarity index 100% rename from src/Language/Annotation.php rename to Language/src/Annotation.php diff --git a/src/Language/Connection/ConnectionInterface.php b/Language/src/Connection/ConnectionInterface.php similarity index 100% rename from src/Language/Connection/ConnectionInterface.php rename to Language/src/Connection/ConnectionInterface.php diff --git a/src/Language/Connection/Rest.php b/Language/src/Connection/Rest.php similarity index 100% rename from src/Language/Connection/Rest.php rename to Language/src/Connection/Rest.php diff --git a/src/Language/Connection/ServiceDefinition/language-v1.json b/Language/src/Connection/ServiceDefinition/language-v1.json similarity index 100% rename from src/Language/Connection/ServiceDefinition/language-v1.json rename to Language/src/Connection/ServiceDefinition/language-v1.json diff --git a/src/Language/LanguageClient.php b/Language/src/LanguageClient.php similarity index 99% rename from src/Language/LanguageClient.php rename to Language/src/LanguageClient.php index b6891f1e97ff..81d62d50bb4d 100644 --- a/src/Language/LanguageClient.php +++ b/Language/src/LanguageClient.php @@ -17,6 +17,7 @@ namespace Google\Cloud\Language; +use Google\Auth\FetchAuthTokenInterface; use Google\Cloud\Core\ClientTrait; use Google\Cloud\Core\RetryDeciderTrait; use Google\Cloud\Language\Connection\ConnectionInterface; diff --git a/src/Language/V1beta2/Gapic/LanguageServiceGapicClient.php b/Language/src/V1beta2/Gapic/LanguageServiceGapicClient.php similarity index 100% rename from src/Language/V1beta2/Gapic/LanguageServiceGapicClient.php rename to Language/src/V1beta2/Gapic/LanguageServiceGapicClient.php diff --git a/src/Language/V1beta2/LanguageServiceClient.php b/Language/src/V1beta2/LanguageServiceClient.php similarity index 100% rename from src/Language/V1beta2/LanguageServiceClient.php rename to Language/src/V1beta2/LanguageServiceClient.php diff --git a/src/Language/V1beta2/README.md b/Language/src/V1beta2/README.md similarity index 100% rename from src/Language/V1beta2/README.md rename to Language/src/V1beta2/README.md diff --git a/src/Language/V1beta2/resources/language_service_client_config.json b/Language/src/V1beta2/resources/language_service_client_config.json similarity index 100% rename from src/Language/V1beta2/resources/language_service_client_config.json rename to Language/src/V1beta2/resources/language_service_client_config.json diff --git a/src/Language/V1beta2/resources/language_service_descriptor_config.php b/Language/src/V1beta2/resources/language_service_descriptor_config.php similarity index 100% rename from src/Language/V1beta2/resources/language_service_descriptor_config.php rename to Language/src/V1beta2/resources/language_service_descriptor_config.php diff --git a/src/Language/V1beta2/resources/language_service_rest_client_config.php b/Language/src/V1beta2/resources/language_service_rest_client_config.php similarity index 100% rename from src/Language/V1beta2/resources/language_service_rest_client_config.php rename to Language/src/V1beta2/resources/language_service_rest_client_config.php diff --git a/tests/snippets/Language/AnnotationTest.php b/Language/tests/Snippet/AnnotationTest.php similarity index 99% rename from tests/snippets/Language/AnnotationTest.php rename to Language/tests/Snippet/AnnotationTest.php index 5a871c5068a5..747067d51cb8 100644 --- a/tests/snippets/Language/AnnotationTest.php +++ b/Language/tests/Snippet/AnnotationTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Snippets\Language; +namespace Google\Cloud\Language\Tests\Snippet; use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Language\Annotation; diff --git a/tests/snippets/Language/LanguageClientTest.php b/Language/tests/Snippet/LanguageClientTest.php similarity index 99% rename from tests/snippets/Language/LanguageClientTest.php rename to Language/tests/Snippet/LanguageClientTest.php index 7bdfc8c8ca12..960a6a8da9b7 100644 --- a/tests/snippets/Language/LanguageClientTest.php +++ b/Language/tests/Snippet/LanguageClientTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Snippets\Language; +namespace Google\Cloud\Language\Tests\Snippet; use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Language\Connection\ConnectionInterface; diff --git a/tests/system/Language/AnalyzeTest.php b/Language/tests/System/AnalyzeTest.php similarity index 99% rename from tests/system/Language/AnalyzeTest.php rename to Language/tests/System/AnalyzeTest.php index 3d57ba21823e..77cfd5004d0b 100644 --- a/tests/system/Language/AnalyzeTest.php +++ b/Language/tests/System/AnalyzeTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\System\Language; +namespace Google\Cloud\Language\Tests\System; /** * @group language diff --git a/tests/system/Language/LanguageTestCase.php b/Language/tests/System/LanguageTestCase.php similarity index 96% rename from tests/system/Language/LanguageTestCase.php rename to Language/tests/System/LanguageTestCase.php index 94a23de1a7f5..3cec58320b41 100644 --- a/tests/system/Language/LanguageTestCase.php +++ b/Language/tests/System/LanguageTestCase.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\System\Language; +namespace Google\Cloud\Language\Tests\System; use Google\Cloud\Core\ExponentialBackoff; use Google\Cloud\BigQuery\BigQueryClient; diff --git a/Language/tests/System/bootstrap.php b/Language/tests/System/bootstrap.php new file mode 100644 index 000000000000..38465605b9a8 --- /dev/null +++ b/Language/tests/System/bootstrap.php @@ -0,0 +1,5 @@ + + + + + tests/Snippet + + + + + src + + src/V[!a-zA-Z]* + + + + diff --git a/Logging/phpunit-system.xml.dist b/Logging/phpunit-system.xml.dist new file mode 100644 index 000000000000..f6deee15a036 --- /dev/null +++ b/Logging/phpunit-system.xml.dist @@ -0,0 +1,16 @@ + + + + + tests/System + + + + + src + + src/V[!a-zA-Z]* + + + + diff --git a/Logging/phpunit.xml.dist b/Logging/phpunit.xml.dist new file mode 100644 index 000000000000..1c2b8f6b56d2 --- /dev/null +++ b/Logging/phpunit.xml.dist @@ -0,0 +1,16 @@ + + + + + tests/Unit + + + + + src + + src/V[!a-zA-Z]* + + + + diff --git a/src/Logging/Connection/ConnectionInterface.php b/Logging/src/Connection/ConnectionInterface.php similarity index 100% rename from src/Logging/Connection/ConnectionInterface.php rename to Logging/src/Connection/ConnectionInterface.php diff --git a/src/Logging/Connection/Grpc.php b/Logging/src/Connection/Grpc.php similarity index 100% rename from src/Logging/Connection/Grpc.php rename to Logging/src/Connection/Grpc.php diff --git a/src/Logging/Connection/Rest.php b/Logging/src/Connection/Rest.php similarity index 100% rename from src/Logging/Connection/Rest.php rename to Logging/src/Connection/Rest.php diff --git a/src/Logging/Connection/ServiceDefinition/logging-v2.json b/Logging/src/Connection/ServiceDefinition/logging-v2.json similarity index 100% rename from src/Logging/Connection/ServiceDefinition/logging-v2.json rename to Logging/src/Connection/ServiceDefinition/logging-v2.json diff --git a/src/Logging/Entry.php b/Logging/src/Entry.php similarity index 100% rename from src/Logging/Entry.php rename to Logging/src/Entry.php diff --git a/src/Logging/Logger.php b/Logging/src/Logger.php similarity index 100% rename from src/Logging/Logger.php rename to Logging/src/Logger.php diff --git a/src/Logging/LoggingClient.php b/Logging/src/LoggingClient.php similarity index 99% rename from src/Logging/LoggingClient.php rename to Logging/src/LoggingClient.php index 7b5dbb7606d2..eacfddef7860 100644 --- a/src/Logging/LoggingClient.php +++ b/Logging/src/LoggingClient.php @@ -17,6 +17,7 @@ namespace Google\Cloud\Logging; +use Google\Auth\FetchAuthTokenInterface; use Google\Cloud\Core\ArrayTrait; use Google\Cloud\Core\Batch\ClosureSerializerInterface; use Google\Cloud\Core\ClientTrait; diff --git a/src/Logging/Metric.php b/Logging/src/Metric.php similarity index 100% rename from src/Logging/Metric.php rename to Logging/src/Metric.php diff --git a/src/Logging/PsrLogger.php b/Logging/src/PsrLogger.php similarity index 100% rename from src/Logging/PsrLogger.php rename to Logging/src/PsrLogger.php diff --git a/src/Logging/Sink.php b/Logging/src/Sink.php similarity index 100% rename from src/Logging/Sink.php rename to Logging/src/Sink.php diff --git a/src/Logging/V2/ConfigServiceV2Client.php b/Logging/src/V2/ConfigServiceV2Client.php similarity index 100% rename from src/Logging/V2/ConfigServiceV2Client.php rename to Logging/src/V2/ConfigServiceV2Client.php diff --git a/src/Logging/V2/Gapic/ConfigServiceV2GapicClient.php b/Logging/src/V2/Gapic/ConfigServiceV2GapicClient.php similarity index 100% rename from src/Logging/V2/Gapic/ConfigServiceV2GapicClient.php rename to Logging/src/V2/Gapic/ConfigServiceV2GapicClient.php diff --git a/src/Logging/V2/Gapic/LoggingServiceV2GapicClient.php b/Logging/src/V2/Gapic/LoggingServiceV2GapicClient.php similarity index 100% rename from src/Logging/V2/Gapic/LoggingServiceV2GapicClient.php rename to Logging/src/V2/Gapic/LoggingServiceV2GapicClient.php diff --git a/src/Logging/V2/Gapic/MetricsServiceV2GapicClient.php b/Logging/src/V2/Gapic/MetricsServiceV2GapicClient.php similarity index 100% rename from src/Logging/V2/Gapic/MetricsServiceV2GapicClient.php rename to Logging/src/V2/Gapic/MetricsServiceV2GapicClient.php diff --git a/src/Logging/V2/LoggingServiceV2Client.php b/Logging/src/V2/LoggingServiceV2Client.php similarity index 100% rename from src/Logging/V2/LoggingServiceV2Client.php rename to Logging/src/V2/LoggingServiceV2Client.php diff --git a/src/Logging/V2/MetricsServiceV2Client.php b/Logging/src/V2/MetricsServiceV2Client.php similarity index 100% rename from src/Logging/V2/MetricsServiceV2Client.php rename to Logging/src/V2/MetricsServiceV2Client.php diff --git a/src/Logging/V2/README.md b/Logging/src/V2/README.md similarity index 100% rename from src/Logging/V2/README.md rename to Logging/src/V2/README.md diff --git a/src/Logging/V2/resources/config_service_v2_client_config.json b/Logging/src/V2/resources/config_service_v2_client_config.json similarity index 100% rename from src/Logging/V2/resources/config_service_v2_client_config.json rename to Logging/src/V2/resources/config_service_v2_client_config.json diff --git a/src/Logging/V2/resources/config_service_v2_descriptor_config.php b/Logging/src/V2/resources/config_service_v2_descriptor_config.php similarity index 100% rename from src/Logging/V2/resources/config_service_v2_descriptor_config.php rename to Logging/src/V2/resources/config_service_v2_descriptor_config.php diff --git a/src/Logging/V2/resources/config_service_v2_rest_client_config.php b/Logging/src/V2/resources/config_service_v2_rest_client_config.php similarity index 100% rename from src/Logging/V2/resources/config_service_v2_rest_client_config.php rename to Logging/src/V2/resources/config_service_v2_rest_client_config.php diff --git a/src/Logging/V2/resources/logging_service_v2_client_config.json b/Logging/src/V2/resources/logging_service_v2_client_config.json similarity index 100% rename from src/Logging/V2/resources/logging_service_v2_client_config.json rename to Logging/src/V2/resources/logging_service_v2_client_config.json diff --git a/src/Logging/V2/resources/logging_service_v2_descriptor_config.php b/Logging/src/V2/resources/logging_service_v2_descriptor_config.php similarity index 100% rename from src/Logging/V2/resources/logging_service_v2_descriptor_config.php rename to Logging/src/V2/resources/logging_service_v2_descriptor_config.php diff --git a/src/Logging/V2/resources/logging_service_v2_rest_client_config.php b/Logging/src/V2/resources/logging_service_v2_rest_client_config.php similarity index 100% rename from src/Logging/V2/resources/logging_service_v2_rest_client_config.php rename to Logging/src/V2/resources/logging_service_v2_rest_client_config.php diff --git a/src/Logging/V2/resources/metrics_service_v2_client_config.json b/Logging/src/V2/resources/metrics_service_v2_client_config.json similarity index 100% rename from src/Logging/V2/resources/metrics_service_v2_client_config.json rename to Logging/src/V2/resources/metrics_service_v2_client_config.json diff --git a/src/Logging/V2/resources/metrics_service_v2_descriptor_config.php b/Logging/src/V2/resources/metrics_service_v2_descriptor_config.php similarity index 100% rename from src/Logging/V2/resources/metrics_service_v2_descriptor_config.php rename to Logging/src/V2/resources/metrics_service_v2_descriptor_config.php diff --git a/src/Logging/V2/resources/metrics_service_v2_rest_client_config.php b/Logging/src/V2/resources/metrics_service_v2_rest_client_config.php similarity index 100% rename from src/Logging/V2/resources/metrics_service_v2_rest_client_config.php rename to Logging/src/V2/resources/metrics_service_v2_rest_client_config.php diff --git a/tests/perf/LoggingPerfTest.php b/Logging/tests/Perf/LoggingPerfTest.php similarity index 100% rename from tests/perf/LoggingPerfTest.php rename to Logging/tests/Perf/LoggingPerfTest.php diff --git a/Logging/tests/Perf/bootstrap.php b/Logging/tests/Perf/bootstrap.php new file mode 100644 index 000000000000..38465605b9a8 --- /dev/null +++ b/Logging/tests/Perf/bootstrap.php @@ -0,0 +1,5 @@ + [ + 'projectId' => 'project', + ] + ] + ); $this->assertInstanceOf(PsrLogger::class, $psrBatchLogger); $r = new \ReflectionObject($psrBatchLogger); $p = $r->getProperty('batchEnabled'); diff --git a/tests/unit/Logging/MetricTest.php b/Logging/tests/Unit/MetricTest.php similarity index 99% rename from tests/unit/Logging/MetricTest.php rename to Logging/tests/Unit/MetricTest.php index 6c048d5f6d2a..1341a697884e 100644 --- a/tests/unit/Logging/MetricTest.php +++ b/Logging/tests/Unit/MetricTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Unit\Logging; +namespace Google\Cloud\Logging\Tests\Unit; use Google\Cloud\Core\Exception\NotFoundException; use Google\Cloud\Logging\Metric; diff --git a/tests/unit/Logging/PsrLoggerBatchTest.php b/Logging/tests/Unit/PsrLoggerBatchTest.php similarity index 99% rename from tests/unit/Logging/PsrLoggerBatchTest.php rename to Logging/tests/Unit/PsrLoggerBatchTest.php index 97b7f6e2f5cb..f9ba10198836 100644 --- a/tests/unit/Logging/PsrLoggerBatchTest.php +++ b/Logging/tests/Unit/PsrLoggerBatchTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Unit\Logging; +namespace Google\Cloud\Logging\Tests\Unit; use Google\Cloud\Core\Batch\BatchRunner; use Google\Cloud\Core\Report\GAEFlexMetadataProvider; diff --git a/tests/unit/Logging/PsrLoggerCompatibilityTest.php b/Logging/tests/Unit/PsrLoggerCompatibilityTest.php similarity index 97% rename from tests/unit/Logging/PsrLoggerCompatibilityTest.php rename to Logging/tests/Unit/PsrLoggerCompatibilityTest.php index 6f1f768862b9..f23c2ca983d7 100644 --- a/tests/unit/Logging/PsrLoggerCompatibilityTest.php +++ b/Logging/tests/Unit/PsrLoggerCompatibilityTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Unit\Logging; +namespace Google\Cloud\Logging\Tests\Unit; use Google\Cloud\Logging\Connection\ConnectionInterface; use Google\Cloud\Logging\Logger; diff --git a/tests/unit/Logging/PsrLoggerTest.php b/Logging/tests/Unit/PsrLoggerTest.php similarity index 99% rename from tests/unit/Logging/PsrLoggerTest.php rename to Logging/tests/Unit/PsrLoggerTest.php index 10554e6f26a4..fecd2c0aac10 100644 --- a/tests/unit/Logging/PsrLoggerTest.php +++ b/Logging/tests/Unit/PsrLoggerTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Unit\Logging; +namespace Google\Cloud\Logging\Tests\Unit; use Google\Cloud\Core\Report\EmptyMetadataProvider; use Google\Cloud\Logging\Logger; diff --git a/tests/unit/Logging/SinkTest.php b/Logging/tests/Unit/SinkTest.php similarity index 99% rename from tests/unit/Logging/SinkTest.php rename to Logging/tests/Unit/SinkTest.php index 45f937bc8413..1329fc939f6d 100644 --- a/tests/unit/Logging/SinkTest.php +++ b/Logging/tests/Unit/SinkTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Unit\Logging; +namespace Google\Cloud\Logging\Tests\Unit; use Google\Cloud\Core\Exception\NotFoundException; use Google\Cloud\Logging\Sink; diff --git a/src/Container/.github/pull_request_template.md b/Monitoring/.github/pull_request_template.md similarity index 92% rename from src/Container/.github/pull_request_template.md rename to Monitoring/.github/pull_request_template.md index b440ed63c035..2647e3d1c39c 100644 --- a/src/Container/.github/pull_request_template.md +++ b/Monitoring/.github/pull_request_template.md @@ -14,7 +14,7 @@ $ git clone git@github.com:GoogleCloudPlatform/google-cloud-php.git ``` * Move your changes into the correct location in that library. Library code -belongs in `src/Container`, and tests in `tests/*/Container`. +belongs in `Monitoring/src`, and tests in `Monitoring/tests`. * Push the changes in a new branch to a fork, and open a new pull request [here](https://github.com/GoogleCloudPlatform/google-cloud-php). diff --git a/src/Monitoring/CONTRIBUTING.md b/Monitoring/CONTRIBUTING.md similarity index 100% rename from src/Monitoring/CONTRIBUTING.md rename to Monitoring/CONTRIBUTING.md diff --git a/src/Monitoring/LICENSE b/Monitoring/LICENSE similarity index 100% rename from src/Monitoring/LICENSE rename to Monitoring/LICENSE diff --git a/src/Monitoring/README.md b/Monitoring/README.md similarity index 100% rename from src/Monitoring/README.md rename to Monitoring/README.md diff --git a/src/Monitoring/VERSION b/Monitoring/VERSION similarity index 100% rename from src/Monitoring/VERSION rename to Monitoring/VERSION diff --git a/src/Monitoring/composer.json b/Monitoring/composer.json similarity index 75% rename from src/Monitoring/composer.json rename to Monitoring/composer.json index f8cb3558679c..38557e7ecd25 100644 --- a/src/Monitoring/composer.json +++ b/Monitoring/composer.json @@ -7,6 +7,11 @@ "google/proto-client": "^0.34", "google/gax": "^0.30" }, + "require-dev": { + "phpunit/phpunit": "^4.8|^5.0", + "google/cloud-core": "^1.14", + "phpdocumentor/reflection": "^3.0" + }, "suggest": { "ext-protobuf": "Provides a significant increase in throughput over the pure PHP protobuf implementation. See https://cloud.google.com/php/grpc for installation instructions." }, @@ -14,13 +19,13 @@ "component": { "id": "cloud-monitoring", "target": "GoogleCloudPlatform/google-cloud-php-monitoring.git", - "path": "src/Monitoring", + "path": "Monitoring", "entry": null } }, "autoload": { "psr-4": { - "Google\\Cloud\\Monitoring\\": "" + "Google\\Cloud\\Monitoring\\": "src" } } } diff --git a/Monitoring/phpunit-snippets.xml.dist b/Monitoring/phpunit-snippets.xml.dist new file mode 100644 index 000000000000..b92fd83e3c1b --- /dev/null +++ b/Monitoring/phpunit-snippets.xml.dist @@ -0,0 +1,19 @@ + + + + + tests/Snippet + + + + + src + + src/V[!a-zA-Z]* + + + + diff --git a/Monitoring/phpunit-system.xml.dist b/Monitoring/phpunit-system.xml.dist new file mode 100644 index 000000000000..f6deee15a036 --- /dev/null +++ b/Monitoring/phpunit-system.xml.dist @@ -0,0 +1,16 @@ + + + + + tests/System + + + + + src + + src/V[!a-zA-Z]* + + + + diff --git a/Monitoring/phpunit.xml.dist b/Monitoring/phpunit.xml.dist new file mode 100644 index 000000000000..1c2b8f6b56d2 --- /dev/null +++ b/Monitoring/phpunit.xml.dist @@ -0,0 +1,16 @@ + + + + + tests/Unit + + + + + src + + src/V[!a-zA-Z]* + + + + diff --git a/src/Monitoring/V3/Gapic/GroupServiceGapicClient.php b/Monitoring/src/V3/Gapic/GroupServiceGapicClient.php similarity index 100% rename from src/Monitoring/V3/Gapic/GroupServiceGapicClient.php rename to Monitoring/src/V3/Gapic/GroupServiceGapicClient.php diff --git a/src/Monitoring/V3/Gapic/MetricServiceGapicClient.php b/Monitoring/src/V3/Gapic/MetricServiceGapicClient.php similarity index 100% rename from src/Monitoring/V3/Gapic/MetricServiceGapicClient.php rename to Monitoring/src/V3/Gapic/MetricServiceGapicClient.php diff --git a/src/Monitoring/V3/Gapic/UptimeCheckServiceGapicClient.php b/Monitoring/src/V3/Gapic/UptimeCheckServiceGapicClient.php similarity index 100% rename from src/Monitoring/V3/Gapic/UptimeCheckServiceGapicClient.php rename to Monitoring/src/V3/Gapic/UptimeCheckServiceGapicClient.php diff --git a/src/Monitoring/V3/GroupServiceClient.php b/Monitoring/src/V3/GroupServiceClient.php similarity index 100% rename from src/Monitoring/V3/GroupServiceClient.php rename to Monitoring/src/V3/GroupServiceClient.php diff --git a/src/Monitoring/V3/MetricServiceClient.php b/Monitoring/src/V3/MetricServiceClient.php similarity index 100% rename from src/Monitoring/V3/MetricServiceClient.php rename to Monitoring/src/V3/MetricServiceClient.php diff --git a/src/Monitoring/V3/README.md b/Monitoring/src/V3/README.md similarity index 100% rename from src/Monitoring/V3/README.md rename to Monitoring/src/V3/README.md diff --git a/src/Monitoring/V3/UptimeCheckServiceClient.php b/Monitoring/src/V3/UptimeCheckServiceClient.php similarity index 100% rename from src/Monitoring/V3/UptimeCheckServiceClient.php rename to Monitoring/src/V3/UptimeCheckServiceClient.php diff --git a/src/Monitoring/V3/resources/group_service_client_config.json b/Monitoring/src/V3/resources/group_service_client_config.json similarity index 100% rename from src/Monitoring/V3/resources/group_service_client_config.json rename to Monitoring/src/V3/resources/group_service_client_config.json diff --git a/src/Monitoring/V3/resources/group_service_descriptor_config.php b/Monitoring/src/V3/resources/group_service_descriptor_config.php similarity index 100% rename from src/Monitoring/V3/resources/group_service_descriptor_config.php rename to Monitoring/src/V3/resources/group_service_descriptor_config.php diff --git a/src/Monitoring/V3/resources/group_service_rest_client_config.php b/Monitoring/src/V3/resources/group_service_rest_client_config.php similarity index 100% rename from src/Monitoring/V3/resources/group_service_rest_client_config.php rename to Monitoring/src/V3/resources/group_service_rest_client_config.php diff --git a/src/Monitoring/V3/resources/metric_service_client_config.json b/Monitoring/src/V3/resources/metric_service_client_config.json similarity index 100% rename from src/Monitoring/V3/resources/metric_service_client_config.json rename to Monitoring/src/V3/resources/metric_service_client_config.json diff --git a/src/Monitoring/V3/resources/metric_service_descriptor_config.php b/Monitoring/src/V3/resources/metric_service_descriptor_config.php similarity index 100% rename from src/Monitoring/V3/resources/metric_service_descriptor_config.php rename to Monitoring/src/V3/resources/metric_service_descriptor_config.php diff --git a/src/Monitoring/V3/resources/metric_service_rest_client_config.php b/Monitoring/src/V3/resources/metric_service_rest_client_config.php similarity index 100% rename from src/Monitoring/V3/resources/metric_service_rest_client_config.php rename to Monitoring/src/V3/resources/metric_service_rest_client_config.php diff --git a/src/Monitoring/V3/resources/uptime_check_service_client_config.json b/Monitoring/src/V3/resources/uptime_check_service_client_config.json similarity index 100% rename from src/Monitoring/V3/resources/uptime_check_service_client_config.json rename to Monitoring/src/V3/resources/uptime_check_service_client_config.json diff --git a/src/Monitoring/V3/resources/uptime_check_service_descriptor_config.php b/Monitoring/src/V3/resources/uptime_check_service_descriptor_config.php similarity index 100% rename from src/Monitoring/V3/resources/uptime_check_service_descriptor_config.php rename to Monitoring/src/V3/resources/uptime_check_service_descriptor_config.php diff --git a/src/Monitoring/V3/resources/uptime_check_service_rest_client_config.php b/Monitoring/src/V3/resources/uptime_check_service_rest_client_config.php similarity index 100% rename from src/Monitoring/V3/resources/uptime_check_service_rest_client_config.php rename to Monitoring/src/V3/resources/uptime_check_service_rest_client_config.php diff --git a/Monitoring/tests/System/bootstrap.php b/Monitoring/tests/System/bootstrap.php new file mode 100644 index 000000000000..38465605b9a8 --- /dev/null +++ b/Monitoring/tests/System/bootstrap.php @@ -0,0 +1,5 @@ + + + + + tests/Snippet + + + + + src + + src/V[!a-zA-Z]* + + + + diff --git a/OsLogin/phpunit-system.xml.dist b/OsLogin/phpunit-system.xml.dist new file mode 100644 index 000000000000..f6deee15a036 --- /dev/null +++ b/OsLogin/phpunit-system.xml.dist @@ -0,0 +1,16 @@ + + + + + tests/System + + + + + src + + src/V[!a-zA-Z]* + + + + diff --git a/OsLogin/phpunit.xml.dist b/OsLogin/phpunit.xml.dist new file mode 100644 index 000000000000..1c2b8f6b56d2 --- /dev/null +++ b/OsLogin/phpunit.xml.dist @@ -0,0 +1,16 @@ + + + + + tests/Unit + + + + + src + + src/V[!a-zA-Z]* + + + + diff --git a/src/OsLogin/V1beta/Gapic/OsLoginServiceGapicClient.php b/OsLogin/src/V1beta/Gapic/OsLoginServiceGapicClient.php similarity index 100% rename from src/OsLogin/V1beta/Gapic/OsLoginServiceGapicClient.php rename to OsLogin/src/V1beta/Gapic/OsLoginServiceGapicClient.php diff --git a/src/OsLogin/V1beta/OsLoginServiceClient.php b/OsLogin/src/V1beta/OsLoginServiceClient.php similarity index 100% rename from src/OsLogin/V1beta/OsLoginServiceClient.php rename to OsLogin/src/V1beta/OsLoginServiceClient.php diff --git a/src/OsLogin/V1beta/README.md b/OsLogin/src/V1beta/README.md similarity index 100% rename from src/OsLogin/V1beta/README.md rename to OsLogin/src/V1beta/README.md diff --git a/src/OsLogin/V1beta/resources/os_login_service_client_config.json b/OsLogin/src/V1beta/resources/os_login_service_client_config.json similarity index 100% rename from src/OsLogin/V1beta/resources/os_login_service_client_config.json rename to OsLogin/src/V1beta/resources/os_login_service_client_config.json diff --git a/src/OsLogin/V1beta/resources/os_login_service_descriptor_config.php b/OsLogin/src/V1beta/resources/os_login_service_descriptor_config.php similarity index 100% rename from src/OsLogin/V1beta/resources/os_login_service_descriptor_config.php rename to OsLogin/src/V1beta/resources/os_login_service_descriptor_config.php diff --git a/src/OsLogin/V1beta/resources/os_login_service_rest_client_config.php b/OsLogin/src/V1beta/resources/os_login_service_rest_client_config.php similarity index 100% rename from src/OsLogin/V1beta/resources/os_login_service_rest_client_config.php rename to OsLogin/src/V1beta/resources/os_login_service_rest_client_config.php diff --git a/tests/system/OsLogin/OsLoginServiceClientTest.php b/OsLogin/tests/System/OsLoginServiceClientTest.php similarity index 93% rename from tests/system/OsLogin/OsLoginServiceClientTest.php rename to OsLogin/tests/System/OsLoginServiceClientTest.php index 41a4583d5ece..0dbef8aabff8 100644 --- a/tests/system/OsLogin/OsLoginServiceClientTest.php +++ b/OsLogin/tests/System/OsLoginServiceClientTest.php @@ -15,14 +15,14 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\System\Container; +namespace Google\Cloud\Container\Tests\System; use Google\Auth\CredentialsLoader; -use Google\Cloud\Core\Testing\System\SystemTestCase; use Google\Cloud\OsLogin\V1beta\OsLoginServiceClient; use Google\Cloud\OsLogin\V1beta\LoginProfile; +use PHPUnit\Framework\TestCase; -class OsLoginServiceClientTest extends SystemTestCase +class OsLoginServiceClientTest extends TestCase { protected static $grpcClient; protected static $restClient; diff --git a/OsLogin/tests/System/bootstrap.php b/OsLogin/tests/System/bootstrap.php new file mode 100644 index 000000000000..38465605b9a8 --- /dev/null +++ b/OsLogin/tests/System/bootstrap.php @@ -0,0 +1,5 @@ + + + + + tests/Snippet + + + + + src + + src/V[!a-zA-Z]* + + + + diff --git a/PubSub/phpunit-system.xml.dist b/PubSub/phpunit-system.xml.dist new file mode 100644 index 000000000000..f6deee15a036 --- /dev/null +++ b/PubSub/phpunit-system.xml.dist @@ -0,0 +1,16 @@ + + + + + tests/System + + + + + src + + src/V[!a-zA-Z]* + + + + diff --git a/PubSub/phpunit.xml.dist b/PubSub/phpunit.xml.dist new file mode 100644 index 000000000000..1c2b8f6b56d2 --- /dev/null +++ b/PubSub/phpunit.xml.dist @@ -0,0 +1,16 @@ + + + + + tests/Unit + + + + + src + + src/V[!a-zA-Z]* + + + + diff --git a/src/PubSub/BatchPublisher.php b/PubSub/src/BatchPublisher.php similarity index 100% rename from src/PubSub/BatchPublisher.php rename to PubSub/src/BatchPublisher.php diff --git a/src/PubSub/Connection/ConnectionInterface.php b/PubSub/src/Connection/ConnectionInterface.php similarity index 100% rename from src/PubSub/Connection/ConnectionInterface.php rename to PubSub/src/Connection/ConnectionInterface.php diff --git a/src/PubSub/Connection/Grpc.php b/PubSub/src/Connection/Grpc.php similarity index 100% rename from src/PubSub/Connection/Grpc.php rename to PubSub/src/Connection/Grpc.php diff --git a/src/PubSub/Connection/IamSubscription.php b/PubSub/src/Connection/IamSubscription.php similarity index 100% rename from src/PubSub/Connection/IamSubscription.php rename to PubSub/src/Connection/IamSubscription.php diff --git a/src/PubSub/Connection/IamTopic.php b/PubSub/src/Connection/IamTopic.php similarity index 100% rename from src/PubSub/Connection/IamTopic.php rename to PubSub/src/Connection/IamTopic.php diff --git a/src/PubSub/Connection/Rest.php b/PubSub/src/Connection/Rest.php similarity index 100% rename from src/PubSub/Connection/Rest.php rename to PubSub/src/Connection/Rest.php diff --git a/src/PubSub/Connection/ServiceDefinition/pubsub-v1.json b/PubSub/src/Connection/ServiceDefinition/pubsub-v1.json similarity index 100% rename from src/PubSub/Connection/ServiceDefinition/pubsub-v1.json rename to PubSub/src/Connection/ServiceDefinition/pubsub-v1.json diff --git a/src/PubSub/IncomingMessageTrait.php b/PubSub/src/IncomingMessageTrait.php similarity index 100% rename from src/PubSub/IncomingMessageTrait.php rename to PubSub/src/IncomingMessageTrait.php diff --git a/src/PubSub/Message.php b/PubSub/src/Message.php similarity index 100% rename from src/PubSub/Message.php rename to PubSub/src/Message.php diff --git a/src/PubSub/PubSubClient.php b/PubSub/src/PubSubClient.php similarity index 99% rename from src/PubSub/PubSubClient.php rename to PubSub/src/PubSubClient.php index 6539ad37ae6c..f383c18655da 100644 --- a/src/PubSub/PubSubClient.php +++ b/PubSub/src/PubSubClient.php @@ -17,6 +17,7 @@ namespace Google\Cloud\PubSub; +use Google\Auth\FetchAuthTokenInterface; use Google\Cloud\Core\ArrayTrait; use Google\Cloud\Core\ClientTrait; use Google\Cloud\Core\Duration; diff --git a/src/PubSub/ResourceNameTrait.php b/PubSub/src/ResourceNameTrait.php similarity index 100% rename from src/PubSub/ResourceNameTrait.php rename to PubSub/src/ResourceNameTrait.php diff --git a/src/PubSub/Snapshot.php b/PubSub/src/Snapshot.php similarity index 100% rename from src/PubSub/Snapshot.php rename to PubSub/src/Snapshot.php diff --git a/src/PubSub/Subscription.php b/PubSub/src/Subscription.php similarity index 100% rename from src/PubSub/Subscription.php rename to PubSub/src/Subscription.php diff --git a/src/PubSub/Topic.php b/PubSub/src/Topic.php similarity index 100% rename from src/PubSub/Topic.php rename to PubSub/src/Topic.php diff --git a/src/PubSub/V1/Gapic/PublisherGapicClient.php b/PubSub/src/V1/Gapic/PublisherGapicClient.php similarity index 100% rename from src/PubSub/V1/Gapic/PublisherGapicClient.php rename to PubSub/src/V1/Gapic/PublisherGapicClient.php diff --git a/src/PubSub/V1/Gapic/SubscriberGapicClient.php b/PubSub/src/V1/Gapic/SubscriberGapicClient.php similarity index 100% rename from src/PubSub/V1/Gapic/SubscriberGapicClient.php rename to PubSub/src/V1/Gapic/SubscriberGapicClient.php diff --git a/src/PubSub/V1/PublisherClient.php b/PubSub/src/V1/PublisherClient.php similarity index 100% rename from src/PubSub/V1/PublisherClient.php rename to PubSub/src/V1/PublisherClient.php diff --git a/src/PubSub/V1/README.md b/PubSub/src/V1/README.md similarity index 100% rename from src/PubSub/V1/README.md rename to PubSub/src/V1/README.md diff --git a/src/PubSub/V1/SubscriberClient.php b/PubSub/src/V1/SubscriberClient.php similarity index 100% rename from src/PubSub/V1/SubscriberClient.php rename to PubSub/src/V1/SubscriberClient.php diff --git a/src/PubSub/V1/resources/publisher_client_config.json b/PubSub/src/V1/resources/publisher_client_config.json similarity index 100% rename from src/PubSub/V1/resources/publisher_client_config.json rename to PubSub/src/V1/resources/publisher_client_config.json diff --git a/src/PubSub/V1/resources/publisher_descriptor_config.php b/PubSub/src/V1/resources/publisher_descriptor_config.php similarity index 100% rename from src/PubSub/V1/resources/publisher_descriptor_config.php rename to PubSub/src/V1/resources/publisher_descriptor_config.php diff --git a/src/PubSub/V1/resources/publisher_rest_client_config.php b/PubSub/src/V1/resources/publisher_rest_client_config.php similarity index 100% rename from src/PubSub/V1/resources/publisher_rest_client_config.php rename to PubSub/src/V1/resources/publisher_rest_client_config.php diff --git a/src/PubSub/V1/resources/subscriber_client_config.json b/PubSub/src/V1/resources/subscriber_client_config.json similarity index 100% rename from src/PubSub/V1/resources/subscriber_client_config.json rename to PubSub/src/V1/resources/subscriber_client_config.json diff --git a/src/PubSub/V1/resources/subscriber_descriptor_config.php b/PubSub/src/V1/resources/subscriber_descriptor_config.php similarity index 100% rename from src/PubSub/V1/resources/subscriber_descriptor_config.php rename to PubSub/src/V1/resources/subscriber_descriptor_config.php diff --git a/src/PubSub/V1/resources/subscriber_rest_client_config.php b/PubSub/src/V1/resources/subscriber_rest_client_config.php similarity index 100% rename from src/PubSub/V1/resources/subscriber_rest_client_config.php rename to PubSub/src/V1/resources/subscriber_rest_client_config.php diff --git a/tests/snippets/PubSub/BatchPublisherTest.php b/PubSub/tests/Snippet/BatchPublisherTest.php similarity index 97% rename from tests/snippets/PubSub/BatchPublisherTest.php rename to PubSub/tests/Snippet/BatchPublisherTest.php index 226d136b0106..17b55cae428c 100644 --- a/tests/snippets/PubSub/BatchPublisherTest.php +++ b/PubSub/tests/Snippet/BatchPublisherTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Snippets\PubSub; +namespace Google\Cloud\PubSub\Tests\Snippet; use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\PubSub\BatchPublisher; diff --git a/tests/snippets/PubSub/MessageTest.php b/PubSub/tests/Snippet/MessageTest.php similarity index 99% rename from tests/snippets/PubSub/MessageTest.php rename to PubSub/tests/Snippet/MessageTest.php index 459e1d1c0b9b..4a9697ab24dd 100644 --- a/tests/snippets/PubSub/MessageTest.php +++ b/PubSub/tests/Snippet/MessageTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Snippets\PubSub; +namespace Google\Cloud\PubSub\Tests\Snippet; use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\PubSub\Connection\ConnectionInterface; diff --git a/tests/snippets/PubSub/PubSubClientTest.php b/PubSub/tests/Snippet/PubSubClientTest.php similarity index 99% rename from tests/snippets/PubSub/PubSubClientTest.php rename to PubSub/tests/Snippet/PubSubClientTest.php index 768e1025bc5d..e17f930b1e35 100644 --- a/tests/snippets/PubSub/PubSubClientTest.php +++ b/PubSub/tests/Snippet/PubSubClientTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Snippets\PubSub; +namespace Google\Cloud\PubSub\Tests\Snippet; use Google\Cloud\Core\Duration; use Google\Cloud\Core\Iterator\ItemIterator; diff --git a/tests/snippets/PubSub/SnapshotTest.php b/PubSub/tests/Snippet/SnapshotTest.php similarity index 98% rename from tests/snippets/PubSub/SnapshotTest.php rename to PubSub/tests/Snippet/SnapshotTest.php index d498c8d2c988..42e75eefac68 100644 --- a/tests/snippets/PubSub/SnapshotTest.php +++ b/PubSub/tests/Snippet/SnapshotTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Snippets\PubSub; +namespace Google\Cloud\PubSub\Tests\Snippet; use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\PubSub\Connection\ConnectionInterface; diff --git a/tests/snippets/PubSub/SubscriptionTest.php b/PubSub/tests/Snippet/SubscriptionTest.php similarity index 99% rename from tests/snippets/PubSub/SubscriptionTest.php rename to PubSub/tests/Snippet/SubscriptionTest.php index 8a641ef8d509..e0c7c15a2cb8 100644 --- a/tests/snippets/PubSub/SubscriptionTest.php +++ b/PubSub/tests/Snippet/SubscriptionTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Snippets\PubSub; +namespace Google\Cloud\PubSub\Tests\Snippet; use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Core\Iam\Iam; diff --git a/tests/snippets/PubSub/TopicTest.php b/PubSub/tests/Snippet/TopicTest.php similarity index 99% rename from tests/snippets/PubSub/TopicTest.php rename to PubSub/tests/Snippet/TopicTest.php index 1aa0efb08d3e..c83bf5641544 100644 --- a/tests/snippets/PubSub/TopicTest.php +++ b/PubSub/tests/Snippet/TopicTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Snippets\PubSub; +namespace Google\Cloud\PubSub\Tests\Snippet; use Google\Cloud\Core\Iam\Iam; use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; diff --git a/tests/system/PubSub/ManageIAMPoliciesTest.php b/PubSub/tests/System/ManageIAMPoliciesTest.php similarity index 97% rename from tests/system/PubSub/ManageIAMPoliciesTest.php rename to PubSub/tests/System/ManageIAMPoliciesTest.php index 95bd81826842..822870de8a46 100644 --- a/tests/system/PubSub/ManageIAMPoliciesTest.php +++ b/PubSub/tests/System/ManageIAMPoliciesTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\System\PubSub; +namespace Google\Cloud\PubSub\Tests\System; /** * @group pubsub diff --git a/tests/system/PubSub/ManageSubscriptionsTest.php b/PubSub/tests/System/ManageSubscriptionsTest.php similarity index 98% rename from tests/system/PubSub/ManageSubscriptionsTest.php rename to PubSub/tests/System/ManageSubscriptionsTest.php index b40f084dd6a8..60499ab0bb3d 100644 --- a/tests/system/PubSub/ManageSubscriptionsTest.php +++ b/PubSub/tests/System/ManageSubscriptionsTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\System\PubSub; +namespace Google\Cloud\PubSub\Tests\System; use Google\Cloud\PubSub\Snapshot; use Google\Cloud\Core\ExponentialBackoff; diff --git a/tests/system/PubSub/ManageTopicsTest.php b/PubSub/tests/System/ManageTopicsTest.php similarity index 98% rename from tests/system/PubSub/ManageTopicsTest.php rename to PubSub/tests/System/ManageTopicsTest.php index 9fc33ebc4130..c16df3956c90 100644 --- a/tests/system/PubSub/ManageTopicsTest.php +++ b/PubSub/tests/System/ManageTopicsTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\System\PubSub; +namespace Google\Cloud\PubSub\Tests\System; use Google\Cloud\Core\ExponentialBackoff; diff --git a/tests/system/PubSub/PubSubTestCase.php b/PubSub/tests/System/PubSubTestCase.php similarity index 97% rename from tests/system/PubSub/PubSubTestCase.php rename to PubSub/tests/System/PubSubTestCase.php index c7cfb0d67a85..e846dee8d7bd 100644 --- a/tests/system/PubSub/PubSubTestCase.php +++ b/PubSub/tests/System/PubSubTestCase.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\System\PubSub; +namespace Google\Cloud\PubSub\Tests\System; use Google\Cloud\PubSub\PubSubClient; use Google\Cloud\Core\Testing\System\SystemTestCase; diff --git a/tests/system/PubSub/PublishAndPullTest.php b/PubSub/tests/System/PublishAndPullTest.php similarity index 98% rename from tests/system/PubSub/PublishAndPullTest.php rename to PubSub/tests/System/PublishAndPullTest.php index 6364b2a04e43..b2361ad21dfc 100644 --- a/tests/system/PubSub/PublishAndPullTest.php +++ b/PubSub/tests/System/PublishAndPullTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\System\PubSub; +namespace Google\Cloud\PubSub\Tests\System; /** * @group pubsub diff --git a/PubSub/tests/System/bootstrap.php b/PubSub/tests/System/bootstrap.php new file mode 100644 index 000000000000..38465605b9a8 --- /dev/null +++ b/PubSub/tests/System/bootstrap.php @@ -0,0 +1,5 @@ + ['projectId' => 'example_project']])) ->getCallbackArray(); $this->assertInstanceOf(Topic::class, $callbackArray[0]); diff --git a/tests/unit/PubSub/Connection/GrpcTest.php b/PubSub/tests/Unit/Connection/GrpcTest.php similarity index 99% rename from tests/unit/PubSub/Connection/GrpcTest.php rename to PubSub/tests/Unit/Connection/GrpcTest.php index 1644c94244b9..5822b9d7e8f6 100644 --- a/tests/unit/PubSub/Connection/GrpcTest.php +++ b/PubSub/tests/Unit/Connection/GrpcTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Unit\PubSub\Connection; +namespace Google\Cloud\PubSub\Tests\Unit\Connection; use Google\Cloud\Core\GrpcRequestWrapper; use Google\Cloud\Core\GrpcTrait; diff --git a/tests/unit/PubSub/Connection/IamSubscriptionTest.php b/PubSub/tests/Unit/Connection/IamSubscriptionTest.php similarity index 96% rename from tests/unit/PubSub/Connection/IamSubscriptionTest.php rename to PubSub/tests/Unit/Connection/IamSubscriptionTest.php index b04cfcc9b350..3886e14f7d20 100644 --- a/tests/unit/PubSub/Connection/IamSubscriptionTest.php +++ b/PubSub/tests/Unit/Connection/IamSubscriptionTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Unit\PubSub\Connection; +namespace Google\Cloud\PubSub\Tests\Unit\Connection; use Google\Cloud\PubSub\Connection\ConnectionInterface; use Google\Cloud\PubSub\Connection\IamSubscription; diff --git a/tests/unit/PubSub/Connection/IamTopicTest.php b/PubSub/tests/Unit/Connection/IamTopicTest.php similarity index 96% rename from tests/unit/PubSub/Connection/IamTopicTest.php rename to PubSub/tests/Unit/Connection/IamTopicTest.php index 3cc7b6db18ab..0b959bae856d 100644 --- a/tests/unit/PubSub/Connection/IamTopicTest.php +++ b/PubSub/tests/Unit/Connection/IamTopicTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Unit\PubSub\Connection; +namespace Google\Cloud\PubSub\Tests\Unit\Connection; use Google\Cloud\PubSub\Connection\ConnectionInterface; use Google\Cloud\PubSub\Connection\IamTopic; diff --git a/tests/unit/PubSub/Connection/RestTest.php b/PubSub/tests/Unit/Connection/RestTest.php similarity index 98% rename from tests/unit/PubSub/Connection/RestTest.php rename to PubSub/tests/Unit/Connection/RestTest.php index c0f371e1fd5a..6e65985cbc2d 100644 --- a/tests/unit/PubSub/Connection/RestTest.php +++ b/PubSub/tests/Unit/Connection/RestTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Unit\PubSub\Connection; +namespace Google\Cloud\PubSub\Tests\Unit\Connection; use Google\Cloud\Core\RequestBuilder; use Google\Cloud\Core\RequestWrapper; diff --git a/tests/unit/PubSub/IncomingMessageTraitTest.php b/PubSub/tests/Unit/IncomingMessageTraitTest.php similarity index 98% rename from tests/unit/PubSub/IncomingMessageTraitTest.php rename to PubSub/tests/Unit/IncomingMessageTraitTest.php index 8436ec9bf837..cc6811f40338 100644 --- a/tests/unit/PubSub/IncomingMessageTraitTest.php +++ b/PubSub/tests/Unit/IncomingMessageTraitTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Unit\PubSub; +namespace Google\Cloud\PubSub\Tests\Unit; use Google\Cloud\PubSub\Connection\ConnectionInterface; use Google\Cloud\PubSub\IncomingMessageTrait; diff --git a/tests/unit/PubSub/MessageTest.php b/PubSub/tests/Unit/MessageTest.php similarity index 98% rename from tests/unit/PubSub/MessageTest.php rename to PubSub/tests/Unit/MessageTest.php index 20ed4f0f903a..2dca32d19dc6 100644 --- a/tests/unit/PubSub/MessageTest.php +++ b/PubSub/tests/Unit/MessageTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Unit\PubSub; +namespace Google\Cloud\PubSub\Tests\Unit; use Google\Cloud\PubSub\Message; use Google\Cloud\PubSub\Subscription; diff --git a/tests/unit/PubSub/PubSubClientTest.php b/PubSub/tests/Unit/PubSubClientTest.php similarity index 99% rename from tests/unit/PubSub/PubSubClientTest.php rename to PubSub/tests/Unit/PubSubClientTest.php index 2aa9294565ba..9ee23156ebd6 100644 --- a/tests/unit/PubSub/PubSubClientTest.php +++ b/PubSub/tests/Unit/PubSubClientTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Unit\PubSub; +namespace Google\Cloud\PubSub\Tests\Unit; use Google\Cloud\Core\Duration; use Google\Cloud\Core\Iterator\ItemIterator; diff --git a/tests/unit/PubSub/ResourceNameTraitTest.php b/PubSub/tests/Unit/ResourceNameTraitTest.php similarity index 98% rename from tests/unit/PubSub/ResourceNameTraitTest.php rename to PubSub/tests/Unit/ResourceNameTraitTest.php index 994fc28ffb23..22b5cf804bd6 100644 --- a/tests/unit/PubSub/ResourceNameTraitTest.php +++ b/PubSub/tests/Unit/ResourceNameTraitTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Unit\PubSub; +namespace Google\Cloud\PubSub\Tests\Unit; use Google\Cloud\PubSub\ResourceNameTrait; use PHPUnit\Framework\TestCase; diff --git a/tests/unit/PubSub/SnapshotTest.php b/PubSub/tests/Unit/SnapshotTest.php similarity index 100% rename from tests/unit/PubSub/SnapshotTest.php rename to PubSub/tests/Unit/SnapshotTest.php diff --git a/tests/unit/PubSub/SubscriptionTest.php b/PubSub/tests/Unit/SubscriptionTest.php similarity index 99% rename from tests/unit/PubSub/SubscriptionTest.php rename to PubSub/tests/Unit/SubscriptionTest.php index 248eb58c10da..1ed4dd247bd2 100644 --- a/tests/unit/PubSub/SubscriptionTest.php +++ b/PubSub/tests/Unit/SubscriptionTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Unit\PubSub; +namespace Google\Cloud\PubSub\Tests\Unit; use Google\Cloud\Core\Exception\NotFoundException; use Google\Cloud\Core\Iam\Iam; diff --git a/tests/unit/PubSub/TopicTest.php b/PubSub/tests/Unit/TopicTest.php similarity index 99% rename from tests/unit/PubSub/TopicTest.php rename to PubSub/tests/Unit/TopicTest.php index 6260f2467b53..f079122b2f52 100644 --- a/tests/unit/PubSub/TopicTest.php +++ b/PubSub/tests/Unit/TopicTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Unit\PubSub; +namespace Google\Cloud\PubSub\Tests\Unit; use Google\Cloud\Core\Exception\NotFoundException; use Google\Cloud\Core\Iam\Iam; diff --git a/Spanner/.github/pull_request_template.md b/Spanner/.github/pull_request_template.md new file mode 100644 index 000000000000..3515c7aa689a --- /dev/null +++ b/Spanner/.github/pull_request_template.md @@ -0,0 +1,24 @@ +**PLEASE READ THIS ENTIRE MESSAGE** + +Hello, and thank you for your contribution! Please note that this repository is +a read-only split of `GoogleCloudPlatform/google-cloud-php`. As such, we are +unable to accept pull requests to this repository. + +We welcome your pull request and would be happy to consider it for inclusion in +our library if you follow these steps: + +* Clone the parent client library repository: + +```sh +$ git clone git@github.com:GoogleCloudPlatform/google-cloud-php.git +``` + +* Move your changes into the correct location in that library. Library code +belongs in `Spanner/src`, and tests in `Spanner/tests`. + +* Push the changes in a new branch to a fork, and open a new pull request +[here](https://github.com/GoogleCloudPlatform/google-cloud-php). + +Thanks again, and we look forward to seeing your proposed change! + +The Google Cloud PHP team diff --git a/src/Spanner/CONTRIBUTING.md b/Spanner/CONTRIBUTING.md similarity index 100% rename from src/Spanner/CONTRIBUTING.md rename to Spanner/CONTRIBUTING.md diff --git a/src/Spanner/LICENSE b/Spanner/LICENSE similarity index 100% rename from src/Spanner/LICENSE rename to Spanner/LICENSE diff --git a/src/Spanner/README.md b/Spanner/README.md similarity index 100% rename from src/Spanner/README.md rename to Spanner/README.md diff --git a/src/Spanner/VERSION b/Spanner/VERSION similarity index 100% rename from src/Spanner/VERSION rename to Spanner/VERSION diff --git a/src/Spanner/composer.json b/Spanner/composer.json similarity index 61% rename from src/Spanner/composer.json rename to Spanner/composer.json index e8f93b3771b2..ce249a8e1f19 100644 --- a/src/Spanner/composer.json +++ b/Spanner/composer.json @@ -9,6 +9,13 @@ "google/gax": "^0.30", "google/proto-client": "^0.34" }, + "require-dev": { + "phpunit/phpunit": "^4.8|^5.0", + "squizlabs/php_codesniffer": "2.*", + "phpdocumentor/reflection": "^3.0", + "erusev/parsedown": "^1.6", + "google/cloud-pubsub": "^1.0" + }, "suggest": { "ext-protobuf": "Provides a significant increase in throughput over the pure PHP protobuf implementation. See https://cloud.google.com/php/grpc for installation instructions." }, @@ -16,13 +23,18 @@ "component": { "id": "cloud-spanner", "target": "GoogleCloudPlatform/google-cloud-php-spanner.git", - "path": "src/Spanner", - "entry": "SpannerClient.php" + "path": "Spanner", + "entry": "src/SpannerClient.php" } }, "autoload": { "psr-4": { - "Google\\Cloud\\Spanner\\": "" + "Google\\Cloud\\Spanner\\": "src" + } + }, + "autoload-dev": { + "psr-4": { + "Google\\Cloud\\Spanner\\Tests\\": "tests" } } } diff --git a/Spanner/phpunit-snippets.xml.dist b/Spanner/phpunit-snippets.xml.dist new file mode 100644 index 000000000000..b92fd83e3c1b --- /dev/null +++ b/Spanner/phpunit-snippets.xml.dist @@ -0,0 +1,19 @@ + + + + + tests/Snippet + + + + + src + + src/V[!a-zA-Z]* + + + + diff --git a/Spanner/phpunit-system.xml.dist b/Spanner/phpunit-system.xml.dist new file mode 100644 index 000000000000..f6deee15a036 --- /dev/null +++ b/Spanner/phpunit-system.xml.dist @@ -0,0 +1,16 @@ + + + + + tests/System + + + + + src + + src/V[!a-zA-Z]* + + + + diff --git a/Spanner/phpunit.xml.dist b/Spanner/phpunit.xml.dist new file mode 100644 index 000000000000..fa7e3dc0adbb --- /dev/null +++ b/Spanner/phpunit.xml.dist @@ -0,0 +1,18 @@ + + + + + tests/Unit + + + + + src + + src/V[!a-zA-Z]* + src/*/V[!a-zA-Z]* + src/*/*/V[!a-zA-Z]* + + + + diff --git a/src/Spanner/Admin/Database/V1/DatabaseAdminClient.php b/Spanner/src/Admin/Database/V1/DatabaseAdminClient.php similarity index 100% rename from src/Spanner/Admin/Database/V1/DatabaseAdminClient.php rename to Spanner/src/Admin/Database/V1/DatabaseAdminClient.php diff --git a/src/Spanner/Admin/Database/V1/Gapic/DatabaseAdminGapicClient.php b/Spanner/src/Admin/Database/V1/Gapic/DatabaseAdminGapicClient.php similarity index 100% rename from src/Spanner/Admin/Database/V1/Gapic/DatabaseAdminGapicClient.php rename to Spanner/src/Admin/Database/V1/Gapic/DatabaseAdminGapicClient.php diff --git a/src/Spanner/Admin/Database/V1/resources/database_admin_client_config.json b/Spanner/src/Admin/Database/V1/resources/database_admin_client_config.json similarity index 100% rename from src/Spanner/Admin/Database/V1/resources/database_admin_client_config.json rename to Spanner/src/Admin/Database/V1/resources/database_admin_client_config.json diff --git a/src/Spanner/Admin/Database/V1/resources/database_admin_descriptor_config.php b/Spanner/src/Admin/Database/V1/resources/database_admin_descriptor_config.php similarity index 100% rename from src/Spanner/Admin/Database/V1/resources/database_admin_descriptor_config.php rename to Spanner/src/Admin/Database/V1/resources/database_admin_descriptor_config.php diff --git a/src/Spanner/Admin/Database/V1/resources/database_admin_rest_client_config.php b/Spanner/src/Admin/Database/V1/resources/database_admin_rest_client_config.php similarity index 100% rename from src/Spanner/Admin/Database/V1/resources/database_admin_rest_client_config.php rename to Spanner/src/Admin/Database/V1/resources/database_admin_rest_client_config.php diff --git a/src/Spanner/Admin/Instance/V1/Gapic/InstanceAdminGapicClient.php b/Spanner/src/Admin/Instance/V1/Gapic/InstanceAdminGapicClient.php similarity index 100% rename from src/Spanner/Admin/Instance/V1/Gapic/InstanceAdminGapicClient.php rename to Spanner/src/Admin/Instance/V1/Gapic/InstanceAdminGapicClient.php diff --git a/src/Spanner/Admin/Instance/V1/InstanceAdminClient.php b/Spanner/src/Admin/Instance/V1/InstanceAdminClient.php similarity index 100% rename from src/Spanner/Admin/Instance/V1/InstanceAdminClient.php rename to Spanner/src/Admin/Instance/V1/InstanceAdminClient.php diff --git a/src/Spanner/Admin/Instance/V1/resources/instance_admin_client_config.json b/Spanner/src/Admin/Instance/V1/resources/instance_admin_client_config.json similarity index 100% rename from src/Spanner/Admin/Instance/V1/resources/instance_admin_client_config.json rename to Spanner/src/Admin/Instance/V1/resources/instance_admin_client_config.json diff --git a/src/Spanner/Admin/Instance/V1/resources/instance_admin_descriptor_config.php b/Spanner/src/Admin/Instance/V1/resources/instance_admin_descriptor_config.php similarity index 100% rename from src/Spanner/Admin/Instance/V1/resources/instance_admin_descriptor_config.php rename to Spanner/src/Admin/Instance/V1/resources/instance_admin_descriptor_config.php diff --git a/src/Spanner/Admin/Instance/V1/resources/instance_admin_rest_client_config.php b/Spanner/src/Admin/Instance/V1/resources/instance_admin_rest_client_config.php similarity index 100% rename from src/Spanner/Admin/Instance/V1/resources/instance_admin_rest_client_config.php rename to Spanner/src/Admin/Instance/V1/resources/instance_admin_rest_client_config.php diff --git a/src/Spanner/Batch/BatchClient.php b/Spanner/src/Batch/BatchClient.php similarity index 100% rename from src/Spanner/Batch/BatchClient.php rename to Spanner/src/Batch/BatchClient.php diff --git a/src/Spanner/Batch/BatchSnapshot.php b/Spanner/src/Batch/BatchSnapshot.php similarity index 100% rename from src/Spanner/Batch/BatchSnapshot.php rename to Spanner/src/Batch/BatchSnapshot.php diff --git a/src/Spanner/Batch/PartitionInterface.php b/Spanner/src/Batch/PartitionInterface.php similarity index 100% rename from src/Spanner/Batch/PartitionInterface.php rename to Spanner/src/Batch/PartitionInterface.php diff --git a/src/Spanner/Batch/PartitionTrait.php b/Spanner/src/Batch/PartitionTrait.php similarity index 100% rename from src/Spanner/Batch/PartitionTrait.php rename to Spanner/src/Batch/PartitionTrait.php diff --git a/src/Spanner/Batch/QueryPartition.php b/Spanner/src/Batch/QueryPartition.php similarity index 100% rename from src/Spanner/Batch/QueryPartition.php rename to Spanner/src/Batch/QueryPartition.php diff --git a/src/Spanner/Batch/ReadPartition.php b/Spanner/src/Batch/ReadPartition.php similarity index 100% rename from src/Spanner/Batch/ReadPartition.php rename to Spanner/src/Batch/ReadPartition.php diff --git a/src/Spanner/Bytes.php b/Spanner/src/Bytes.php similarity index 100% rename from src/Spanner/Bytes.php rename to Spanner/src/Bytes.php diff --git a/src/Spanner/Connection/ConnectionInterface.php b/Spanner/src/Connection/ConnectionInterface.php similarity index 100% rename from src/Spanner/Connection/ConnectionInterface.php rename to Spanner/src/Connection/ConnectionInterface.php diff --git a/src/Spanner/Connection/Grpc.php b/Spanner/src/Connection/Grpc.php similarity index 100% rename from src/Spanner/Connection/Grpc.php rename to Spanner/src/Connection/Grpc.php diff --git a/src/Spanner/Connection/IamDatabase.php b/Spanner/src/Connection/IamDatabase.php similarity index 100% rename from src/Spanner/Connection/IamDatabase.php rename to Spanner/src/Connection/IamDatabase.php diff --git a/src/Spanner/Connection/IamInstance.php b/Spanner/src/Connection/IamInstance.php similarity index 100% rename from src/Spanner/Connection/IamInstance.php rename to Spanner/src/Connection/IamInstance.php diff --git a/src/Spanner/Connection/LongRunningConnection.php b/Spanner/src/Connection/LongRunningConnection.php similarity index 100% rename from src/Spanner/Connection/LongRunningConnection.php rename to Spanner/src/Connection/LongRunningConnection.php diff --git a/src/Spanner/Database.php b/Spanner/src/Database.php similarity index 100% rename from src/Spanner/Database.php rename to Spanner/src/Database.php diff --git a/src/Spanner/Date.php b/Spanner/src/Date.php similarity index 100% rename from src/Spanner/Date.php rename to Spanner/src/Date.php diff --git a/src/Spanner/Duration.php b/Spanner/src/Duration.php similarity index 100% rename from src/Spanner/Duration.php rename to Spanner/src/Duration.php diff --git a/src/Spanner/Instance.php b/Spanner/src/Instance.php similarity index 100% rename from src/Spanner/Instance.php rename to Spanner/src/Instance.php diff --git a/src/Spanner/InstanceConfiguration.php b/Spanner/src/InstanceConfiguration.php similarity index 100% rename from src/Spanner/InstanceConfiguration.php rename to Spanner/src/InstanceConfiguration.php diff --git a/src/Spanner/KeyRange.php b/Spanner/src/KeyRange.php similarity index 100% rename from src/Spanner/KeyRange.php rename to Spanner/src/KeyRange.php diff --git a/src/Spanner/KeySet.php b/Spanner/src/KeySet.php similarity index 100% rename from src/Spanner/KeySet.php rename to Spanner/src/KeySet.php diff --git a/src/Spanner/Operation.php b/Spanner/src/Operation.php similarity index 100% rename from src/Spanner/Operation.php rename to Spanner/src/Operation.php diff --git a/src/Spanner/Result.php b/Spanner/src/Result.php similarity index 100% rename from src/Spanner/Result.php rename to Spanner/src/Result.php diff --git a/src/Spanner/Session/CacheSessionPool.php b/Spanner/src/Session/CacheSessionPool.php similarity index 100% rename from src/Spanner/Session/CacheSessionPool.php rename to Spanner/src/Session/CacheSessionPool.php diff --git a/src/Spanner/Session/Session.php b/Spanner/src/Session/Session.php similarity index 100% rename from src/Spanner/Session/Session.php rename to Spanner/src/Session/Session.php diff --git a/src/Spanner/Session/SessionPoolInterface.php b/Spanner/src/Session/SessionPoolInterface.php similarity index 100% rename from src/Spanner/Session/SessionPoolInterface.php rename to Spanner/src/Session/SessionPoolInterface.php diff --git a/src/Spanner/Snapshot.php b/Spanner/src/Snapshot.php similarity index 100% rename from src/Spanner/Snapshot.php rename to Spanner/src/Snapshot.php diff --git a/src/Spanner/SnapshotTrait.php b/Spanner/src/SnapshotTrait.php similarity index 100% rename from src/Spanner/SnapshotTrait.php rename to Spanner/src/SnapshotTrait.php diff --git a/src/Spanner/SpannerClient.php b/Spanner/src/SpannerClient.php similarity index 99% rename from src/Spanner/SpannerClient.php rename to Spanner/src/SpannerClient.php index 9e1d198ab44c..def430d98d3f 100644 --- a/src/Spanner/SpannerClient.php +++ b/Spanner/src/SpannerClient.php @@ -17,6 +17,7 @@ namespace Google\Cloud\Spanner; +use Google\Auth\FetchAuthTokenInterface; use Google\Cloud\Core\ArrayTrait; use Google\Cloud\Core\ClientTrait; use Google\Cloud\Core\Exception\GoogleException; diff --git a/src/Spanner/Timestamp.php b/Spanner/src/Timestamp.php similarity index 100% rename from src/Spanner/Timestamp.php rename to Spanner/src/Timestamp.php diff --git a/src/Spanner/Transaction.php b/Spanner/src/Transaction.php similarity index 100% rename from src/Spanner/Transaction.php rename to Spanner/src/Transaction.php diff --git a/src/Spanner/TransactionConfigurationTrait.php b/Spanner/src/TransactionConfigurationTrait.php similarity index 100% rename from src/Spanner/TransactionConfigurationTrait.php rename to Spanner/src/TransactionConfigurationTrait.php diff --git a/src/Spanner/TransactionalReadInterface.php b/Spanner/src/TransactionalReadInterface.php similarity index 100% rename from src/Spanner/TransactionalReadInterface.php rename to Spanner/src/TransactionalReadInterface.php diff --git a/src/Spanner/TransactionalReadTrait.php b/Spanner/src/TransactionalReadTrait.php similarity index 100% rename from src/Spanner/TransactionalReadTrait.php rename to Spanner/src/TransactionalReadTrait.php diff --git a/src/Spanner/V1/Gapic/SpannerGapicClient.php b/Spanner/src/V1/Gapic/SpannerGapicClient.php similarity index 100% rename from src/Spanner/V1/Gapic/SpannerGapicClient.php rename to Spanner/src/V1/Gapic/SpannerGapicClient.php diff --git a/src/Spanner/V1/README.md b/Spanner/src/V1/README.md similarity index 100% rename from src/Spanner/V1/README.md rename to Spanner/src/V1/README.md diff --git a/src/Spanner/V1/SpannerClient.php b/Spanner/src/V1/SpannerClient.php similarity index 100% rename from src/Spanner/V1/SpannerClient.php rename to Spanner/src/V1/SpannerClient.php diff --git a/src/Spanner/V1/resources/spanner_client_config.json b/Spanner/src/V1/resources/spanner_client_config.json similarity index 100% rename from src/Spanner/V1/resources/spanner_client_config.json rename to Spanner/src/V1/resources/spanner_client_config.json diff --git a/src/Spanner/V1/resources/spanner_descriptor_config.php b/Spanner/src/V1/resources/spanner_descriptor_config.php similarity index 100% rename from src/Spanner/V1/resources/spanner_descriptor_config.php rename to Spanner/src/V1/resources/spanner_descriptor_config.php diff --git a/src/Spanner/V1/resources/spanner_rest_client_config.php b/Spanner/src/V1/resources/spanner_rest_client_config.php similarity index 100% rename from src/Spanner/V1/resources/spanner_rest_client_config.php rename to Spanner/src/V1/resources/spanner_rest_client_config.php diff --git a/src/Spanner/ValueInterface.php b/Spanner/src/ValueInterface.php similarity index 100% rename from src/Spanner/ValueInterface.php rename to Spanner/src/ValueInterface.php diff --git a/src/Spanner/ValueMapper.php b/Spanner/src/ValueMapper.php similarity index 100% rename from src/Spanner/ValueMapper.php rename to Spanner/src/ValueMapper.php diff --git a/tests/snippets/Spanner/Batch/BatchClientTest.php b/Spanner/tests/Snippet/Batch/BatchClientTest.php similarity index 99% rename from tests/snippets/Spanner/Batch/BatchClientTest.php rename to Spanner/tests/Snippet/Batch/BatchClientTest.php index ad480b9002f6..66a6b1b82e38 100644 --- a/tests/snippets/Spanner/Batch/BatchClientTest.php +++ b/Spanner/tests/Snippet/Batch/BatchClientTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Snippets\Spanner\Batch; +namespace Google\Cloud\Spanner\Tests\Snippet\Batch; use Google\Cloud\Core\Testing\GrpcTestTrait; use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; diff --git a/tests/snippets/Spanner/Batch/BatchSnapshotTest.php b/Spanner/tests/Snippet/Batch/BatchSnapshotTest.php similarity index 99% rename from tests/snippets/Spanner/Batch/BatchSnapshotTest.php rename to Spanner/tests/Snippet/Batch/BatchSnapshotTest.php index 8189e7566452..d46720df4412 100644 --- a/tests/snippets/Spanner/Batch/BatchSnapshotTest.php +++ b/Spanner/tests/Snippet/Batch/BatchSnapshotTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Snippets\Spanner\Batch; +namespace Google\Cloud\Spanner\Tests\Snippet\Batch; use Google\Cloud\Core\Testing\GrpcTestTrait; use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; diff --git a/tests/snippets/Spanner/Batch/PartitionSharedSnippetTestTrait.php b/Spanner/tests/Snippet/Batch/PartitionSharedSnippetTestTrait.php similarity index 97% rename from tests/snippets/Spanner/Batch/PartitionSharedSnippetTestTrait.php rename to Spanner/tests/Snippet/Batch/PartitionSharedSnippetTestTrait.php index e69d27a7740e..bddfd783e140 100644 --- a/tests/snippets/Spanner/Batch/PartitionSharedSnippetTestTrait.php +++ b/Spanner/tests/Snippet/Batch/PartitionSharedSnippetTestTrait.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Snippets\Spanner\Batch; +namespace Google\Cloud\Spanner\Tests\Snippet\Batch; /** * Shared snippet tests for partitions. diff --git a/tests/snippets/Spanner/Batch/QueryPartitionTest.php b/Spanner/tests/Snippet/Batch/QueryPartitionTest.php similarity index 98% rename from tests/snippets/Spanner/Batch/QueryPartitionTest.php rename to Spanner/tests/Snippet/Batch/QueryPartitionTest.php index 9134c24d6d0f..feef4e33fd91 100644 --- a/tests/snippets/Spanner/Batch/QueryPartitionTest.php +++ b/Spanner/tests/Snippet/Batch/QueryPartitionTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Snippets\Spanner\Batch; +namespace Google\Cloud\Spanner\Tests\Snippet\Batch; use Google\Cloud\Core\Testing\GrpcTestTrait; use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; diff --git a/tests/snippets/Spanner/Batch/ReadPartitionTest.php b/Spanner/tests/Snippet/Batch/ReadPartitionTest.php similarity index 98% rename from tests/snippets/Spanner/Batch/ReadPartitionTest.php rename to Spanner/tests/Snippet/Batch/ReadPartitionTest.php index 25f0499bb911..edde662c31c9 100644 --- a/tests/snippets/Spanner/Batch/ReadPartitionTest.php +++ b/Spanner/tests/Snippet/Batch/ReadPartitionTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Snippets\Spanner\Batch; +namespace Google\Cloud\Spanner\Tests\Snippet\Batch; use Google\Cloud\Core\Testing\GrpcTestTrait; use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; diff --git a/tests/snippets/Spanner/BytesTest.php b/Spanner/tests/Snippet/BytesTest.php similarity index 98% rename from tests/snippets/Spanner/BytesTest.php rename to Spanner/tests/Snippet/BytesTest.php index 1698e2e26e62..dacd56110b84 100644 --- a/tests/snippets/Spanner/BytesTest.php +++ b/Spanner/tests/Snippet/BytesTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Snippets\Spanner; +namespace Google\Cloud\Spanner\Tests\Snippet; use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Spanner\Bytes; diff --git a/tests/snippets/Spanner/DatabaseTest.php b/Spanner/tests/Snippet/DatabaseTest.php similarity index 99% rename from tests/snippets/Spanner/DatabaseTest.php rename to Spanner/tests/Snippet/DatabaseTest.php index c7b4faa6a6b6..0d34d32df734 100644 --- a/tests/snippets/Spanner/DatabaseTest.php +++ b/Spanner/tests/Snippet/DatabaseTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Snippets\Spanner; +namespace Google\Cloud\Spanner\Tests\Snippet; use Google\Cloud\Core\Iam\Iam; use Google\Cloud\Core\Iterator\ItemIterator; diff --git a/tests/snippets/Spanner/DateTest.php b/Spanner/tests/Snippet/DateTest.php similarity index 98% rename from tests/snippets/Spanner/DateTest.php rename to Spanner/tests/Snippet/DateTest.php index 3514d074c1ee..304dcaa294f8 100644 --- a/tests/snippets/Spanner/DateTest.php +++ b/Spanner/tests/Snippet/DateTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Snippets\Spanner; +namespace Google\Cloud\Spanner\Tests\Snippet; use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Spanner\Database; diff --git a/tests/snippets/Spanner/DurationTest.php b/Spanner/tests/Snippet/DurationTest.php similarity index 98% rename from tests/snippets/Spanner/DurationTest.php rename to Spanner/tests/Snippet/DurationTest.php index 84078b42dfc1..a3c68d323d4d 100644 --- a/tests/snippets/Spanner/DurationTest.php +++ b/Spanner/tests/Snippet/DurationTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Snippets\Spanner; +namespace Google\Cloud\Spanner\Tests\Snippet; use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Spanner\Duration; diff --git a/tests/snippets/Spanner/InstanceConfigurationTest.php b/Spanner/tests/Snippet/InstanceConfigurationTest.php similarity index 98% rename from tests/snippets/Spanner/InstanceConfigurationTest.php rename to Spanner/tests/Snippet/InstanceConfigurationTest.php index 798d88598972..68bba77841a0 100644 --- a/tests/snippets/Spanner/InstanceConfigurationTest.php +++ b/Spanner/tests/Snippet/InstanceConfigurationTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Snippets\Spanner; +namespace Google\Cloud\Spanner\Tests\Snippet; use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Spanner\Admin\Instance\V1\InstanceAdminClient; diff --git a/tests/snippets/Spanner/InstanceTest.php b/Spanner/tests/Snippet/InstanceTest.php similarity index 99% rename from tests/snippets/Spanner/InstanceTest.php rename to Spanner/tests/Snippet/InstanceTest.php index 9741cbd24509..b10fd64abdaa 100644 --- a/tests/snippets/Spanner/InstanceTest.php +++ b/Spanner/tests/Snippet/InstanceTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Snippets\Spanner; +namespace Google\Cloud\Spanner\Tests\Snippet; use Google\Cloud\Core\Iam\Iam; use Google\Cloud\Core\Iterator\ItemIterator; diff --git a/tests/snippets/Spanner/KeyRangeTest.php b/Spanner/tests/Snippet/KeyRangeTest.php similarity index 98% rename from tests/snippets/Spanner/KeyRangeTest.php rename to Spanner/tests/Snippet/KeyRangeTest.php index 521872ac8d73..d8822a175016 100644 --- a/tests/snippets/Spanner/KeyRangeTest.php +++ b/Spanner/tests/Snippet/KeyRangeTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Snippets\Spanner; +namespace Google\Cloud\Spanner\Tests\Snippet; use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Spanner\KeyRange; diff --git a/tests/snippets/Spanner/KeySetTest.php b/Spanner/tests/Snippet/KeySetTest.php similarity index 98% rename from tests/snippets/Spanner/KeySetTest.php rename to Spanner/tests/Snippet/KeySetTest.php index b8eb0221846d..b365d8b27bae 100644 --- a/tests/snippets/Spanner/KeySetTest.php +++ b/Spanner/tests/Snippet/KeySetTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Snippets\Spanner; +namespace Google\Cloud\Spanner\Tests\Snippet; use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Spanner\KeyRange; diff --git a/tests/snippets/Spanner/ResultTest.php b/Spanner/tests/Snippet/ResultTest.php similarity index 99% rename from tests/snippets/Spanner/ResultTest.php rename to Spanner/tests/Snippet/ResultTest.php index 162cfaff943c..9821a58388b9 100644 --- a/tests/snippets/Spanner/ResultTest.php +++ b/Spanner/tests/Snippet/ResultTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Snippets\Spanner; +namespace Google\Cloud\Spanner\Tests\Snippet; use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Spanner\Database; diff --git a/tests/snippets/Spanner/Session/CacheSessionPoolTest.php b/Spanner/tests/Snippet/Session/CacheSessionPoolTest.php similarity index 96% rename from tests/snippets/Spanner/Session/CacheSessionPoolTest.php rename to Spanner/tests/Snippet/Session/CacheSessionPoolTest.php index 302670c59991..89afad9a5f3a 100644 --- a/tests/snippets/Spanner/Session/CacheSessionPoolTest.php +++ b/Spanner/tests/Snippet/Session/CacheSessionPoolTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Snippets\Spanner; +namespace Google\Cloud\Spanner\Tests\Snippet; use Google\Auth\Cache\MemoryCacheItemPool; use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; diff --git a/tests/snippets/Spanner/SnapshotTest.php b/Spanner/tests/Snippet/SnapshotTest.php similarity index 99% rename from tests/snippets/Spanner/SnapshotTest.php rename to Spanner/tests/Snippet/SnapshotTest.php index 5733abc9b6ed..406de1f17767 100644 --- a/tests/snippets/Spanner/SnapshotTest.php +++ b/Spanner/tests/Snippet/SnapshotTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Snippets\Spanner; +namespace Google\Cloud\Spanner\Tests\Snippet; use Google\Cloud\Core\Testing\GrpcTestTrait; use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; diff --git a/tests/snippets/Spanner/SpannerClientTest.php b/Spanner/tests/Snippet/SpannerClientTest.php similarity index 99% rename from tests/snippets/Spanner/SpannerClientTest.php rename to Spanner/tests/Snippet/SpannerClientTest.php index 96a5bef0cc58..b9c462443f46 100644 --- a/tests/snippets/Spanner/SpannerClientTest.php +++ b/Spanner/tests/Snippet/SpannerClientTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Snippets\Spanner; +namespace Google\Cloud\Spanner\Tests\Snippet; use Google\Cloud\Core\Int64; use Google\Cloud\Core\Iterator\ItemIterator; diff --git a/tests/snippets/Spanner/TimestampTest.php b/Spanner/tests/Snippet/TimestampTest.php similarity index 98% rename from tests/snippets/Spanner/TimestampTest.php rename to Spanner/tests/Snippet/TimestampTest.php index 59650b7e7151..4328f5e32e83 100644 --- a/tests/snippets/Spanner/TimestampTest.php +++ b/Spanner/tests/Snippet/TimestampTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Snippets\Spanner; +namespace Google\Cloud\Spanner\Tests\Snippet; use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Spanner\Database; diff --git a/tests/snippets/Spanner/TransactionTest.php b/Spanner/tests/Snippet/TransactionTest.php similarity index 99% rename from tests/snippets/Spanner/TransactionTest.php rename to Spanner/tests/Snippet/TransactionTest.php index f61cca4a4cdd..166df20fcd05 100644 --- a/tests/snippets/Spanner/TransactionTest.php +++ b/Spanner/tests/Snippet/TransactionTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Snippets\Spanner; +namespace Google\Cloud\Spanner\Tests\Snippet; use Google\Cloud\Core\Testing\GrpcTestTrait; use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; diff --git a/tests/system/Spanner/AdminTest.php b/Spanner/tests/System/AdminTest.php similarity index 98% rename from tests/system/Spanner/AdminTest.php rename to Spanner/tests/System/AdminTest.php index c699721c12b4..5d559b66ab9c 100644 --- a/tests/system/Spanner/AdminTest.php +++ b/Spanner/tests/System/AdminTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\System\Spanner; +namespace Google\Cloud\Spanner\Tests\System; use Google\Cloud\Core\LongRunning\LongRunningOperation; use Google\Cloud\Spanner\Admin\Database\V1\DatabaseAdminClient; diff --git a/tests/system/Spanner/BatchTest.php b/Spanner/tests/System/BatchTest.php similarity index 98% rename from tests/system/Spanner/BatchTest.php rename to Spanner/tests/System/BatchTest.php index aed48f5f7432..72e82927693f 100644 --- a/tests/system/Spanner/BatchTest.php +++ b/Spanner/tests/System/BatchTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\System\Spanner; +namespace Google\Cloud\Spanner\Tests\System; use Google\Cloud\Spanner\Batch\BatchClient; use Google\Cloud\Spanner\Batch\BatchSnapshot; diff --git a/tests/system/Spanner/LargeReadTest.php b/Spanner/tests/System/LargeReadTest.php similarity index 98% rename from tests/system/Spanner/LargeReadTest.php rename to Spanner/tests/System/LargeReadTest.php index 230f36223d9a..cd9211748e05 100644 --- a/tests/system/Spanner/LargeReadTest.php +++ b/Spanner/tests/System/LargeReadTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\System\Spanner; +namespace Google\Cloud\Spanner\Tests\System; use Google\Cloud\Spanner\Bytes; use Google\Cloud\Spanner\KeySet; diff --git a/tests/system/Spanner/OperationsTest.php b/Spanner/tests/System/OperationsTest.php similarity index 99% rename from tests/system/Spanner/OperationsTest.php rename to Spanner/tests/System/OperationsTest.php index 9214fdedbd1d..29cc0d08cff0 100644 --- a/tests/system/Spanner/OperationsTest.php +++ b/Spanner/tests/System/OperationsTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\System\Spanner; +namespace Google\Cloud\Spanner\Tests\System; use Google\Cloud\Core\Exception\ServiceException; use Google\Cloud\Spanner\Date; diff --git a/tests/system/Spanner/QueryTest.php b/Spanner/tests/System/QueryTest.php similarity index 99% rename from tests/system/Spanner/QueryTest.php rename to Spanner/tests/System/QueryTest.php index b1e10e0b5208..ea74b84a73e1 100644 --- a/tests/system/Spanner/QueryTest.php +++ b/Spanner/tests/System/QueryTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\System\Spanner; +namespace Google\Cloud\Spanner\Tests\System; use Google\Cloud\Core\Int64; use Google\Cloud\Spanner\Bytes; diff --git a/tests/system/Spanner/ReadTest.php b/Spanner/tests/System/ReadTest.php similarity index 99% rename from tests/system/Spanner/ReadTest.php rename to Spanner/tests/System/ReadTest.php index ef2df2523521..7521ce7721c7 100644 --- a/tests/system/Spanner/ReadTest.php +++ b/Spanner/tests/System/ReadTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\System\Spanner; +namespace Google\Cloud\Spanner\Tests\System; use Google\Cloud\Core\Int64; use Google\Cloud\Spanner\Bytes; diff --git a/tests/system/Spanner/SnapshotTest.php b/Spanner/tests/System/SnapshotTest.php similarity index 99% rename from tests/system/Spanner/SnapshotTest.php rename to Spanner/tests/System/SnapshotTest.php index 7667a2bc84b8..f479925e68c3 100644 --- a/tests/system/Spanner/SnapshotTest.php +++ b/Spanner/tests/System/SnapshotTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\System\Spanner; +namespace Google\Cloud\Spanner\Tests\System; use Google\Cloud\Spanner\Date; use Google\Cloud\Spanner\Duration; diff --git a/tests/system/Spanner/SpannerTestCase.php b/Spanner/tests/System/SpannerTestCase.php similarity index 98% rename from tests/system/Spanner/SpannerTestCase.php rename to Spanner/tests/System/SpannerTestCase.php index 27974636c968..e7f0aa2fe7d0 100644 --- a/tests/system/Spanner/SpannerTestCase.php +++ b/Spanner/tests/System/SpannerTestCase.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\System\Spanner; +namespace Google\Cloud\Spanner\Tests\System; use Google\Cloud\Core\ExponentialBackoff; use Google\Cloud\Spanner\SpannerClient; diff --git a/tests/system/Spanner/TransactionTest.php b/Spanner/tests/System/TransactionTest.php similarity index 99% rename from tests/system/Spanner/TransactionTest.php rename to Spanner/tests/System/TransactionTest.php index a2bcb9fe3450..82619313a382 100644 --- a/tests/system/Spanner/TransactionTest.php +++ b/Spanner/tests/System/TransactionTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\System\Spanner; +namespace Google\Cloud\Spanner\Tests\System; use Google\Cloud\Spanner\Database; use Google\Cloud\Spanner\Date; diff --git a/tests/system/Spanner/WriteTest.php b/Spanner/tests/System/WriteTest.php similarity index 99% rename from tests/system/Spanner/WriteTest.php rename to Spanner/tests/System/WriteTest.php index 7f4899e4e419..50dfc3831963 100644 --- a/tests/system/Spanner/WriteTest.php +++ b/Spanner/tests/System/WriteTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\System\Spanner; +namespace Google\Cloud\Spanner\Tests\System; use Google\Cloud\Spanner\Bytes; use Google\Cloud\Spanner\Date; diff --git a/Spanner/tests/System/bootstrap.php b/Spanner/tests/System/bootstrap.php new file mode 100644 index 000000000000..f45f59500ebb --- /dev/null +++ b/Spanner/tests/System/bootstrap.php @@ -0,0 +1,8 @@ + + + + + tests/Snippet + + + + + src + + src/V[!a-zA-Z]* + + + + diff --git a/Speech/phpunit-system.xml.dist b/Speech/phpunit-system.xml.dist new file mode 100644 index 000000000000..f6deee15a036 --- /dev/null +++ b/Speech/phpunit-system.xml.dist @@ -0,0 +1,16 @@ + + + + + tests/System + + + + + src + + src/V[!a-zA-Z]* + + + + diff --git a/Speech/phpunit.xml.dist b/Speech/phpunit.xml.dist new file mode 100644 index 000000000000..1c2b8f6b56d2 --- /dev/null +++ b/Speech/phpunit.xml.dist @@ -0,0 +1,16 @@ + + + + + tests/Unit + + + + + src + + src/V[!a-zA-Z]* + + + + diff --git a/src/Speech/Connection/ConnectionInterface.php b/Speech/src/Connection/ConnectionInterface.php similarity index 100% rename from src/Speech/Connection/ConnectionInterface.php rename to Speech/src/Connection/ConnectionInterface.php diff --git a/src/Speech/Connection/Rest.php b/Speech/src/Connection/Rest.php similarity index 100% rename from src/Speech/Connection/Rest.php rename to Speech/src/Connection/Rest.php diff --git a/src/Speech/Connection/ServiceDefinition/speech-v1.json b/Speech/src/Connection/ServiceDefinition/speech-v1.json similarity index 100% rename from src/Speech/Connection/ServiceDefinition/speech-v1.json rename to Speech/src/Connection/ServiceDefinition/speech-v1.json diff --git a/src/Speech/Operation.php b/Speech/src/Operation.php similarity index 100% rename from src/Speech/Operation.php rename to Speech/src/Operation.php diff --git a/src/Speech/Result.php b/Speech/src/Result.php similarity index 100% rename from src/Speech/Result.php rename to Speech/src/Result.php diff --git a/src/Speech/SpeechClient.php b/Speech/src/SpeechClient.php similarity index 99% rename from src/Speech/SpeechClient.php rename to Speech/src/SpeechClient.php index b904084d78e9..8189235a3691 100644 --- a/src/Speech/SpeechClient.php +++ b/Speech/src/SpeechClient.php @@ -17,6 +17,7 @@ namespace Google\Cloud\Speech; +use Google\Auth\FetchAuthTokenInterface; use Google\Cloud\Core\ClientTrait; use Google\Cloud\Speech\Connection\ConnectionInterface; use Google\Cloud\Speech\Connection\Rest; diff --git a/src/Speech/V1/Gapic/SpeechGapicClient.php b/Speech/src/V1/Gapic/SpeechGapicClient.php similarity index 100% rename from src/Speech/V1/Gapic/SpeechGapicClient.php rename to Speech/src/V1/Gapic/SpeechGapicClient.php diff --git a/src/Speech/V1/README.md b/Speech/src/V1/README.md similarity index 100% rename from src/Speech/V1/README.md rename to Speech/src/V1/README.md diff --git a/src/Speech/V1/SpeechClient.php b/Speech/src/V1/SpeechClient.php similarity index 100% rename from src/Speech/V1/SpeechClient.php rename to Speech/src/V1/SpeechClient.php diff --git a/src/Speech/V1/resources/speech_client_config.json b/Speech/src/V1/resources/speech_client_config.json similarity index 100% rename from src/Speech/V1/resources/speech_client_config.json rename to Speech/src/V1/resources/speech_client_config.json diff --git a/src/Speech/V1/resources/speech_descriptor_config.php b/Speech/src/V1/resources/speech_descriptor_config.php similarity index 100% rename from src/Speech/V1/resources/speech_descriptor_config.php rename to Speech/src/V1/resources/speech_descriptor_config.php diff --git a/src/Speech/V1/resources/speech_rest_client_config.php b/Speech/src/V1/resources/speech_rest_client_config.php similarity index 100% rename from src/Speech/V1/resources/speech_rest_client_config.php rename to Speech/src/V1/resources/speech_rest_client_config.php diff --git a/src/Speech/V1beta1/Gapic/SpeechGapicClient.php b/Speech/src/V1beta1/Gapic/SpeechGapicClient.php similarity index 100% rename from src/Speech/V1beta1/Gapic/SpeechGapicClient.php rename to Speech/src/V1beta1/Gapic/SpeechGapicClient.php diff --git a/src/Speech/V1beta1/README.md b/Speech/src/V1beta1/README.md similarity index 100% rename from src/Speech/V1beta1/README.md rename to Speech/src/V1beta1/README.md diff --git a/src/Speech/V1beta1/SpeechClient.php b/Speech/src/V1beta1/SpeechClient.php similarity index 100% rename from src/Speech/V1beta1/SpeechClient.php rename to Speech/src/V1beta1/SpeechClient.php diff --git a/src/Speech/V1beta1/resources/speech_client_config.json b/Speech/src/V1beta1/resources/speech_client_config.json similarity index 100% rename from src/Speech/V1beta1/resources/speech_client_config.json rename to Speech/src/V1beta1/resources/speech_client_config.json diff --git a/src/Speech/V1beta1/resources/speech_descriptor_config.php b/Speech/src/V1beta1/resources/speech_descriptor_config.php similarity index 100% rename from src/Speech/V1beta1/resources/speech_descriptor_config.php rename to Speech/src/V1beta1/resources/speech_descriptor_config.php diff --git a/src/Speech/V1beta1/resources/speech_rest_client_config.php b/Speech/src/V1beta1/resources/speech_rest_client_config.php similarity index 100% rename from src/Speech/V1beta1/resources/speech_rest_client_config.php rename to Speech/src/V1beta1/resources/speech_rest_client_config.php diff --git a/tests/snippets/Speech/OperationTest.php b/Speech/tests/Snippet/OperationTest.php similarity index 98% rename from tests/snippets/Speech/OperationTest.php rename to Speech/tests/Snippet/OperationTest.php index cdd0e115d15c..4b814ec8f316 100644 --- a/tests/snippets/Speech/OperationTest.php +++ b/Speech/tests/Snippet/OperationTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Snippets\Speech; +namespace Google\Cloud\Speech\Tests\Snippet; use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Speech\Connection\ConnectionInterface; diff --git a/tests/snippets/Speech/ResultTest.php b/Speech/tests/Snippet/ResultTest.php similarity index 98% rename from tests/snippets/Speech/ResultTest.php rename to Speech/tests/Snippet/ResultTest.php index c46c84182553..8b55f0262c3c 100644 --- a/tests/snippets/Speech/ResultTest.php +++ b/Speech/tests/Snippet/ResultTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Snippets\Speech; +namespace Google\Cloud\Speech\Tests\Snippet; use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Speech\Connection\ConnectionInterface; diff --git a/tests/snippets/Speech/SpeechClientTest.php b/Speech/tests/Snippet/SpeechClientTest.php similarity index 97% rename from tests/snippets/Speech/SpeechClientTest.php rename to Speech/tests/Snippet/SpeechClientTest.php index 09a5c6c2fb17..2d18e0221ab8 100644 --- a/tests/snippets/Speech/SpeechClientTest.php +++ b/Speech/tests/Snippet/SpeechClientTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Snippets\Speech; +namespace Google\Cloud\Speech\Tests\Snippet; use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Speech\Connection\ConnectionInterface; @@ -34,7 +34,7 @@ class SpeechClientTest extends SnippetTestCase public function setUp() { - $this->testFile = "'" . __DIR__ . '/../fixtures/Speech/demo.flac' . "'"; + $this->testFile = "'" . __DIR__ . '/fixtures/demo.flac' . "'"; $this->connection = $this->prophesize(ConnectionInterface::class); $this->client = \Google\Cloud\Core\Testing\TestHelpers::stub(SpeechClient::class, [ ['languageCode' => 'en-US'] diff --git a/tests/snippets/fixtures/Speech/demo.flac b/Speech/tests/Snippet/fixtures/demo.flac similarity index 100% rename from tests/snippets/fixtures/Speech/demo.flac rename to Speech/tests/Snippet/fixtures/demo.flac diff --git a/Speech/tests/System/bootstrap.php b/Speech/tests/System/bootstrap.php new file mode 100644 index 000000000000..38465605b9a8 --- /dev/null +++ b/Speech/tests/System/bootstrap.php @@ -0,0 +1,5 @@ +gcsUri(Argument::any())->willReturn(self::GCS_URI . '.amr'); $awbMock = $this->prophesize(StorageObject::class); $awbMock->gcsUri(Argument::any())->willReturn(self::GCS_URI . '.awb'); - $audioPath = __DIR__ . '/../data/brooklyn.flac'; + $audioPath = __DIR__ . '/data/brooklyn.flac'; return [ [ diff --git a/tests/unit/data/brooklyn.flac b/Speech/tests/Unit/data/brooklyn.flac similarity index 100% rename from tests/unit/data/brooklyn.flac rename to Speech/tests/Unit/data/brooklyn.flac diff --git a/Storage/.github/pull_request_template.md b/Storage/.github/pull_request_template.md new file mode 100644 index 000000000000..9299c9800132 --- /dev/null +++ b/Storage/.github/pull_request_template.md @@ -0,0 +1,24 @@ +**PLEASE READ THIS ENTIRE MESSAGE** + +Hello, and thank you for your contribution! Please note that this repository is +a read-only split of `GoogleCloudPlatform/google-cloud-php`. As such, we are +unable to accept pull requests to this repository. + +We welcome your pull request and would be happy to consider it for inclusion in +our library if you follow these steps: + +* Clone the parent client library repository: + +```sh +$ git clone git@github.com:GoogleCloudPlatform/google-cloud-php.git +``` + +* Move your changes into the correct location in that library. Library code +belongs in `Storage/src`, and tests in `Storage/tests`. + +* Push the changes in a new branch to a fork, and open a new pull request +[here](https://github.com/GoogleCloudPlatform/google-cloud-php). + +Thanks again, and we look forward to seeing your proposed change! + +The Google Cloud PHP team diff --git a/src/Storage/CONTRIBUTING.md b/Storage/CONTRIBUTING.md similarity index 100% rename from src/Storage/CONTRIBUTING.md rename to Storage/CONTRIBUTING.md diff --git a/src/Storage/LICENSE b/Storage/LICENSE similarity index 100% rename from src/Storage/LICENSE rename to Storage/LICENSE diff --git a/src/Storage/README.md b/Storage/README.md similarity index 100% rename from src/Storage/README.md rename to Storage/README.md diff --git a/src/Storage/VERSION b/Storage/VERSION similarity index 100% rename from src/Storage/VERSION rename to Storage/VERSION diff --git a/src/Storage/composer.json b/Storage/composer.json similarity index 57% rename from src/Storage/composer.json rename to Storage/composer.json index b39f05c26368..96b3fff14ac6 100644 --- a/src/Storage/composer.json +++ b/Storage/composer.json @@ -6,6 +6,14 @@ "require": { "google/cloud-core": "^1.14" }, + "require-dev": { + "phpunit/phpunit": "^4.8|^5.0", + "squizlabs/php_codesniffer": "2.*", + "phpdocumentor/reflection": "^3.0", + "erusev/parsedown": "^1.6", + "phpseclib/phpseclib": "^2", + "google/cloud-pubsub": "^1.0" + }, "suggest": { "phpseclib/phpseclib": "May be used in place of OpenSSL for creating signed Cloud Storage URLs. Please require version ^2.", "google/cloud-pubsub": "May be used to register a topic to receive bucket notifications." @@ -14,13 +22,18 @@ "component": { "id": "cloud-storage", "target": "GoogleCloudPlatform/google-cloud-php-storage.git", - "path": "src/Storage", - "entry": "StorageClient.php" + "path": "Storage", + "entry": "src/StorageClient.php" } }, "autoload": { "psr-4": { - "Google\\Cloud\\Storage\\": "" + "Google\\Cloud\\Storage\\": "src" + } + }, + "autoload-dev": { + "psr-4": { + "Google\\Cloud\\Storage\\Tests\\": "tests" } } } diff --git a/Storage/phpunit-snippets.xml.dist b/Storage/phpunit-snippets.xml.dist new file mode 100644 index 000000000000..b92fd83e3c1b --- /dev/null +++ b/Storage/phpunit-snippets.xml.dist @@ -0,0 +1,19 @@ + + + + + tests/Snippet + + + + + src + + src/V[!a-zA-Z]* + + + + diff --git a/Storage/phpunit-system.xml.dist b/Storage/phpunit-system.xml.dist new file mode 100644 index 000000000000..f6deee15a036 --- /dev/null +++ b/Storage/phpunit-system.xml.dist @@ -0,0 +1,16 @@ + + + + + tests/System + + + + + src + + src/V[!a-zA-Z]* + + + + diff --git a/Storage/phpunit.xml.dist b/Storage/phpunit.xml.dist new file mode 100644 index 000000000000..1c2b8f6b56d2 --- /dev/null +++ b/Storage/phpunit.xml.dist @@ -0,0 +1,16 @@ + + + + + tests/Unit + + + + + src + + src/V[!a-zA-Z]* + + + + diff --git a/src/Storage/Acl.php b/Storage/src/Acl.php similarity index 100% rename from src/Storage/Acl.php rename to Storage/src/Acl.php diff --git a/src/Storage/Bucket.php b/Storage/src/Bucket.php similarity index 100% rename from src/Storage/Bucket.php rename to Storage/src/Bucket.php diff --git a/src/Storage/Connection/ConnectionInterface.php b/Storage/src/Connection/ConnectionInterface.php similarity index 100% rename from src/Storage/Connection/ConnectionInterface.php rename to Storage/src/Connection/ConnectionInterface.php diff --git a/src/Storage/Connection/IamBucket.php b/Storage/src/Connection/IamBucket.php similarity index 100% rename from src/Storage/Connection/IamBucket.php rename to Storage/src/Connection/IamBucket.php diff --git a/src/Storage/Connection/Rest.php b/Storage/src/Connection/Rest.php similarity index 100% rename from src/Storage/Connection/Rest.php rename to Storage/src/Connection/Rest.php diff --git a/src/Storage/Connection/ServiceDefinition/storage-v1.json b/Storage/src/Connection/ServiceDefinition/storage-v1.json similarity index 100% rename from src/Storage/Connection/ServiceDefinition/storage-v1.json rename to Storage/src/Connection/ServiceDefinition/storage-v1.json diff --git a/src/Storage/EncryptionTrait.php b/Storage/src/EncryptionTrait.php similarity index 100% rename from src/Storage/EncryptionTrait.php rename to Storage/src/EncryptionTrait.php diff --git a/src/Storage/Notification.php b/Storage/src/Notification.php similarity index 100% rename from src/Storage/Notification.php rename to Storage/src/Notification.php diff --git a/src/Storage/ObjectIterator.php b/Storage/src/ObjectIterator.php similarity index 100% rename from src/Storage/ObjectIterator.php rename to Storage/src/ObjectIterator.php diff --git a/src/Storage/ObjectPageIterator.php b/Storage/src/ObjectPageIterator.php similarity index 100% rename from src/Storage/ObjectPageIterator.php rename to Storage/src/ObjectPageIterator.php diff --git a/src/Storage/ReadStream.php b/Storage/src/ReadStream.php similarity index 100% rename from src/Storage/ReadStream.php rename to Storage/src/ReadStream.php diff --git a/src/Storage/StorageClient.php b/Storage/src/StorageClient.php similarity index 99% rename from src/Storage/StorageClient.php rename to Storage/src/StorageClient.php index cd50cf9fcd9c..e39fab782613 100644 --- a/src/Storage/StorageClient.php +++ b/Storage/src/StorageClient.php @@ -17,6 +17,7 @@ namespace Google\Cloud\Storage; +use Google\Auth\FetchAuthTokenInterface; use Google\Cloud\Core\ArrayTrait; use Google\Cloud\Core\ClientTrait; use Google\Cloud\Core\Exception\GoogleException; diff --git a/src/Storage/StorageObject.php b/Storage/src/StorageObject.php similarity index 100% rename from src/Storage/StorageObject.php rename to Storage/src/StorageObject.php diff --git a/src/Storage/StreamWrapper.php b/Storage/src/StreamWrapper.php similarity index 100% rename from src/Storage/StreamWrapper.php rename to Storage/src/StreamWrapper.php diff --git a/src/Storage/WriteStream.php b/Storage/src/WriteStream.php similarity index 100% rename from src/Storage/WriteStream.php rename to Storage/src/WriteStream.php diff --git a/tests/snippets/Storage/AclTest.php b/Storage/tests/Snippet/AclTest.php similarity index 98% rename from tests/snippets/Storage/AclTest.php rename to Storage/tests/Snippet/AclTest.php index b0f78b957a9f..9c4e42950e3d 100644 --- a/tests/snippets/Storage/AclTest.php +++ b/Storage/tests/Snippet/AclTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Snippets\Storage; +namespace Google\Cloud\Storage\Tests\Snippet; use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Storage\Acl; diff --git a/tests/snippets/Storage/BucketTest.php b/Storage/tests/Snippet/BucketTest.php similarity index 99% rename from tests/snippets/Storage/BucketTest.php rename to Storage/tests/Snippet/BucketTest.php index 0bc28de43ed1..74b8a3cd3243 100644 --- a/tests/snippets/Storage/BucketTest.php +++ b/Storage/tests/Snippet/BucketTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Snippets\Storage; +namespace Google\Cloud\Storage\Tests\Snippet; use Google\Cloud\Core\Exception\GoogleException; use Google\Cloud\Core\Iam\Iam; diff --git a/tests/snippets/Storage/NotificationTest.php b/Storage/tests/Snippet/NotificationTest.php similarity index 98% rename from tests/snippets/Storage/NotificationTest.php rename to Storage/tests/Snippet/NotificationTest.php index c59f65201d1d..63c81d2dee25 100644 --- a/tests/snippets/Storage/NotificationTest.php +++ b/Storage/tests/Snippet/NotificationTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Snippets\Storage; +namespace Google\Cloud\Storage\Tests\Snippet; use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\PubSub\PubSubClient; diff --git a/tests/snippets/Storage/StorageClientTest.php b/Storage/tests/Snippet/StorageClientTest.php similarity index 99% rename from tests/snippets/Storage/StorageClientTest.php rename to Storage/tests/Snippet/StorageClientTest.php index 0ebd2a2c6134..9630b0e4bb50 100644 --- a/tests/snippets/Storage/StorageClientTest.php +++ b/Storage/tests/Snippet/StorageClientTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Snippets\Storage; +namespace Google\Cloud\Storage\Tests\Snippet; use Google\Cloud\Core\Iterator\ItemIterator; use Google\Cloud\Core\RequestWrapper; diff --git a/tests/snippets/Storage/StorageObjectTest.php b/Storage/tests/Snippet/StorageObjectTest.php similarity index 99% rename from tests/snippets/Storage/StorageObjectTest.php rename to Storage/tests/Snippet/StorageObjectTest.php index cc0e222f721c..55bee7bacf45 100644 --- a/tests/snippets/Storage/StorageObjectTest.php +++ b/Storage/tests/Snippet/StorageObjectTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Snippets\Storage; +namespace Google\Cloud\Storage\Tests\Snippet; use Google\Cloud\Core\RequestWrapper; use Google\Cloud\Core\Timestamp; diff --git a/tests/system/Storage/ManageAclTest.php b/Storage/tests/System/ManageAclTest.php similarity index 97% rename from tests/system/Storage/ManageAclTest.php rename to Storage/tests/System/ManageAclTest.php index 3be7513b4651..0531b5bd66ae 100644 --- a/tests/system/Storage/ManageAclTest.php +++ b/Storage/tests/System/ManageAclTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\System\Storage; +namespace Google\Cloud\Storage\Tests\System; use Google\Cloud\Storage\Acl; use Google\Cloud\Core\Exception\NotFoundException; diff --git a/tests/system/Storage/ManageBucketsTest.php b/Storage/tests/System/ManageBucketsTest.php similarity index 99% rename from tests/system/Storage/ManageBucketsTest.php rename to Storage/tests/System/ManageBucketsTest.php index b856a9587efe..43aa2db09da7 100644 --- a/tests/system/Storage/ManageBucketsTest.php +++ b/Storage/tests/System/ManageBucketsTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\System\Storage; +namespace Google\Cloud\Storage\Tests\System; /** * @group storage diff --git a/tests/system/Storage/ManageNotificationsTest.php b/Storage/tests/System/ManageNotificationsTest.php similarity index 97% rename from tests/system/Storage/ManageNotificationsTest.php rename to Storage/tests/System/ManageNotificationsTest.php index 8d5f15d8802a..a16a7fc59277 100644 --- a/tests/system/Storage/ManageNotificationsTest.php +++ b/Storage/tests/System/ManageNotificationsTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\System\Storage; +namespace Google\Cloud\Storage\Tests\System; /** * @group storage diff --git a/tests/system/Storage/ManageObjectsTest.php b/Storage/tests/System/ManageObjectsTest.php similarity index 99% rename from tests/system/Storage/ManageObjectsTest.php rename to Storage/tests/System/ManageObjectsTest.php index dd4fd3e518d4..d535dcdf37e4 100644 --- a/tests/system/Storage/ManageObjectsTest.php +++ b/Storage/tests/System/ManageObjectsTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\System\Storage; +namespace Google\Cloud\Storage\Tests\System; use Psr\Http\Message\StreamInterface; diff --git a/tests/system/Storage/README.md b/Storage/tests/System/README.md similarity index 100% rename from tests/system/Storage/README.md rename to Storage/tests/System/README.md diff --git a/tests/system/Storage/RequesterPaysTest.php b/Storage/tests/System/RequesterPaysTest.php similarity index 86% rename from tests/system/Storage/RequesterPaysTest.php rename to Storage/tests/System/RequesterPaysTest.php index c669cd6e2ee5..748652aa3935 100644 --- a/tests/system/Storage/RequesterPaysTest.php +++ b/Storage/tests/System/RequesterPaysTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\System\Storage; +namespace Google\Cloud\Storage\Tests\System; use GuzzleHttp\Client; use Google\Cloud\Storage\Acl; @@ -34,7 +34,7 @@ class RequesterPaysTest extends StorageTestCase private $keyFilePath; private $requesterPaysClient; private $requesterProject; - private $user; + private $keyfileUser; private static $bucketName; private static $ownerBucketInstance; @@ -71,13 +71,13 @@ public static function setupBeforeClass() public function setUp() { - if (!defined('GOOGLE_CLOUD_WHITELIST_KEY_PATH')) { - $this->markTestSkipped('Missing whitelist keyfile path for whitelist system tests.'); - } + $this->keyFilePath = getenv('GOOGLE_CLOUD_PHP_TESTS_WHITELIST_KEY_PATH'); + + $keyfile = json_decode(file_get_contents(getenv('GOOGLE_CLOUD_PHP_TESTS_WHITELIST_KEY_PATH')), true); + $this->keyfileUser = $keyfile['client_email']; - $this->keyFilePath = GOOGLE_CLOUD_WHITELIST_KEY_PATH; $this->requesterPaysClient = new StorageClient([ - 'keyFilePath' => $this->keyFilePath + 'keyFile' => $keyfile ]); $parentKeyfile = json_decode(file_get_contents(getenv('GOOGLE_CLOUD_PHP_TESTS_KEY_PATH')), true); @@ -175,49 +175,48 @@ public function testRequesterPaysWithUserProject(callable $call) public function requesterPaysMethods() { - $keyfile = json_decode(file_get_contents(GOOGLE_CLOUD_WHITELIST_KEY_PATH), true); - $user = $keyfile['client_email']; + $this->setup(); return [ [ - function (Bucket $bucket) use ($user) { + function (Bucket $bucket) { $acl = $bucket->acl(); - $acl->add('user-'. $user, Acl::ROLE_READER); + $acl->add('user-'. $this->keyfileUser, Acl::ROLE_READER); } ], [ - function (Bucket $bucket) use ($user) { + function (Bucket $bucket) { $acl = $bucket->acl(); - $item = $acl->get(['entity' => 'user-'. $user]); + $item = $acl->get(['entity' => 'user-'. $this->keyfileUser]); } ], [ - function (Bucket $bucket) use ($user) { + function (Bucket $bucket) { $acl = $bucket->acl(); - $acl->update('user-'. $user, Acl::ROLE_OWNER); + $acl->update('user-'. $this->keyfileUser, Acl::ROLE_OWNER); } ], [ - function (Bucket $bucket) use ($user) { + function (Bucket $bucket) { $acl = $bucket->acl(); - $acl->delete('user-'. $user); + $acl->delete('user-'. $this->keyfileUser); } ], [ - function (Bucket $bucket) use ($user) { + function (Bucket $bucket) { $acl = $bucket->defaultAcl(); - $acl->add('user-'. $user, Acl::ROLE_READER); + $acl->add('user-'. $this->keyfileUser, Acl::ROLE_READER); } ], [ - function (Bucket $bucket) use ($user) { + function (Bucket $bucket) { $acl = $bucket->defaultAcl(); - $item = $acl->get(['entity' => 'user-'. $user]); + $item = $acl->get(['entity' => 'user-'. $this->keyfileUser]); } ], [ - function (Bucket $bucket) use ($user) { + function (Bucket $bucket) { $acl = $bucket->defaultAcl(); - $acl->update('user-'. $user, Acl::ROLE_OWNER); + $acl->update('user-'. $this->keyfileUser, Acl::ROLE_OWNER); } ], [ - function (Bucket $bucket) use ($user) { + function (Bucket $bucket) { $acl = $bucket->defaultAcl(); - $acl->delete('user-'. $user); + $acl->delete('user-'. $this->keyfileUser); } ], [ function (Bucket $bucket) { @@ -272,24 +271,24 @@ function (Bucket $bucket) { $bucket->notification(self::$notificationId)->reload(); } ], [ - function (Bucket $bucket, StorageObject $object) use ($user) { + function (Bucket $bucket, StorageObject $object) { $acl = $object->acl(); - $acl->add('user-'. $user, Acl::ROLE_READER); + $acl->add('user-'. $this->keyfileUser, Acl::ROLE_READER); } ], [ - function (Bucket $bucket, StorageObject $object) use ($user) { + function (Bucket $bucket, StorageObject $object) { $acl = $object->acl(); - $item = $acl->get(['entity' => 'user-'. $user]); + $item = $acl->get(['entity' => 'user-'. $this->keyfileUser]); } ], [ - function (Bucket $bucket, StorageObject $object) use ($user) { + function (Bucket $bucket, StorageObject $object) { $acl = $object->acl(); - $acl->update('user-'. $user, Acl::ROLE_OWNER); + $acl->update('user-'. $this->keyfileUser, Acl::ROLE_OWNER); } ], [ - function (Bucket $bucket, StorageObject $object) use ($user) { + function (Bucket $bucket, StorageObject $object) { $acl = $object->acl(); - $acl->delete('user-'. $user); + $acl->delete('user-'. $this->keyfileUser); } ], [ function (Bucket $bucket, StorageObject $object) { diff --git a/tests/system/Storage/SignedUrlTest.php b/Storage/tests/System/SignedUrlTest.php similarity index 98% rename from tests/system/Storage/SignedUrlTest.php rename to Storage/tests/System/SignedUrlTest.php index ff01a7477cd9..155a044d5031 100644 --- a/tests/system/Storage/SignedUrlTest.php +++ b/Storage/tests/System/SignedUrlTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\System\Storage; +namespace Google\Cloud\Storage\Tests\System; use Google\Cloud\Core\Timestamp; use GuzzleHttp\Client; diff --git a/tests/system/Storage/StorageTestCase.php b/Storage/tests/System/StorageTestCase.php similarity index 97% rename from tests/system/Storage/StorageTestCase.php rename to Storage/tests/System/StorageTestCase.php index aada9cd5c9f4..351fb3434f76 100644 --- a/tests/system/Storage/StorageTestCase.php +++ b/Storage/tests/System/StorageTestCase.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\System\Storage; +namespace Google\Cloud\Storage\Tests\System; use Google\Cloud\Core\AnonymousCredentials; use Google\Cloud\Core\Exception\NotFoundException; diff --git a/tests/system/Storage/StreamWrapper/DirectoryTest.php b/Storage/tests/System/StreamWrapper/DirectoryTest.php similarity index 97% rename from tests/system/Storage/StreamWrapper/DirectoryTest.php rename to Storage/tests/System/StreamWrapper/DirectoryTest.php index 500555131336..202de94444b7 100644 --- a/tests/system/Storage/StreamWrapper/DirectoryTest.php +++ b/Storage/tests/System/StreamWrapper/DirectoryTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\System\Storage\StreamWrapper; +namespace Google\Cloud\Storage\Tests\System\StreamWrapper; /** * @group storage diff --git a/tests/system/Storage/StreamWrapper/ImageTest.php b/Storage/tests/System/StreamWrapper/ImageTest.php similarity index 97% rename from tests/system/Storage/StreamWrapper/ImageTest.php rename to Storage/tests/System/StreamWrapper/ImageTest.php index 9e47a81c1701..b866cf742110 100644 --- a/tests/system/Storage/StreamWrapper/ImageTest.php +++ b/Storage/tests/System/StreamWrapper/ImageTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\System\Storage\StreamWrapper; +namespace Google\Cloud\Storage\Tests\System\StreamWrapper; /** * @group storage diff --git a/tests/system/Storage/StreamWrapper/ReadTest.php b/Storage/tests/System/StreamWrapper/ReadTest.php similarity index 96% rename from tests/system/Storage/StreamWrapper/ReadTest.php rename to Storage/tests/System/StreamWrapper/ReadTest.php index a5db6655d177..f68559bf8746 100644 --- a/tests/system/Storage/StreamWrapper/ReadTest.php +++ b/Storage/tests/System/StreamWrapper/ReadTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\System\Storage\StreamWrapper; +namespace Google\Cloud\Storage\Tests\System\StreamWrapper; /** * @group storage diff --git a/tests/system/Storage/StreamWrapper/RenameTest.php b/Storage/tests/System/StreamWrapper/RenameTest.php similarity index 96% rename from tests/system/Storage/StreamWrapper/RenameTest.php rename to Storage/tests/System/StreamWrapper/RenameTest.php index 000d025f643a..77704ee777e8 100644 --- a/tests/system/Storage/StreamWrapper/RenameTest.php +++ b/Storage/tests/System/StreamWrapper/RenameTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\System\Storage\StreamWrapper; +namespace Google\Cloud\Storage\Tests\System\StreamWrapper; /** * @group storage diff --git a/tests/system/Storage/StreamWrapper/StreamWrapperTestCase.php b/Storage/tests/System/StreamWrapper/StreamWrapperTestCase.php similarity index 87% rename from tests/system/Storage/StreamWrapper/StreamWrapperTestCase.php rename to Storage/tests/System/StreamWrapper/StreamWrapperTestCase.php index 8928ff7da42b..72a4c4080c1a 100644 --- a/tests/system/Storage/StreamWrapper/StreamWrapperTestCase.php +++ b/Storage/tests/System/StreamWrapper/StreamWrapperTestCase.php @@ -15,9 +15,10 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\System\Storage\StreamWrapper; +namespace Google\Cloud\Storage\Tests\System\StreamWrapper; -use Google\Cloud\Tests\System\Storage\StorageTestCase; +use Google\Cloud\Storage\Storage\Tests\SystemTestCase; +use Google\Cloud\Storage\Tests\System\StorageTestCase; /** * @group storage diff --git a/tests/system/Storage/StreamWrapper/UrlStatTest.php b/Storage/tests/System/StreamWrapper/UrlStatTest.php similarity index 98% rename from tests/system/Storage/StreamWrapper/UrlStatTest.php rename to Storage/tests/System/StreamWrapper/UrlStatTest.php index 5373d8700142..257a94f99579 100644 --- a/tests/system/Storage/StreamWrapper/UrlStatTest.php +++ b/Storage/tests/System/StreamWrapper/UrlStatTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\System\Storage\StreamWrapper; +namespace Google\Cloud\Storage\Tests\System\StreamWrapper; /** * @group storage diff --git a/tests/system/Storage/StreamWrapper/WriteTest.php b/Storage/tests/System/StreamWrapper/WriteTest.php similarity index 96% rename from tests/system/Storage/StreamWrapper/WriteTest.php rename to Storage/tests/System/StreamWrapper/WriteTest.php index a3930e65ebfa..73354af70b03 100644 --- a/tests/system/Storage/StreamWrapper/WriteTest.php +++ b/Storage/tests/System/StreamWrapper/WriteTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\System\Storage\StreamWrapper; +namespace Google\Cloud\Storage\Tests\System\StreamWrapper; /** * @group storage diff --git a/tests/system/Storage/UploadObjectsTest.php b/Storage/tests/System/UploadObjectsTest.php similarity index 92% rename from tests/system/Storage/UploadObjectsTest.php rename to Storage/tests/System/UploadObjectsTest.php index 4755a38d302b..eeec6c1dcd68 100644 --- a/tests/system/Storage/UploadObjectsTest.php +++ b/Storage/tests/System/UploadObjectsTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\System\Storage; +namespace Google\Cloud\Storage\Tests\System; use GuzzleHttp\Psr7; @@ -45,7 +45,7 @@ public function testUploadsObjectFromStringWithMetadata() public function testUploadsObjectFromResource() { - $path = __DIR__ . '/../data/CloudPlatform_128px_Retina.png'; + $path = __DIR__ . '/data/CloudPlatform_128px_Retina.png'; $object = self::$bucket->upload( fopen($path, 'r') ); @@ -56,7 +56,7 @@ public function testUploadsObjectFromResource() public function testUploadsLargeObjectFromResource() { - $path = __DIR__ . '/../data/5mb.txt'; + $path = __DIR__ . '/data/5mb.txt'; $object = self::$bucket->upload( fopen($path, 'r') ); @@ -96,7 +96,7 @@ public function testUploadsObjectWithCustomerSuppliedEncryption() public function testUploadsObjectWithProgressTracking() { - $path = __DIR__ . '/../data/5mb.txt'; + $path = __DIR__ . '/data/5mb.txt'; $this->testFileSize = filesize($path); @@ -119,7 +119,7 @@ public function onStoredFileChunk($storedBytes) $this->assertFalse($this->testFileSize < $this->totalStoredBytes); if ($this->testFileSize == $this->totalStoredBytes) { - $this->assertEquals(filesize(__DIR__ . '/../data/5mb.txt'), $this->totalStoredBytes); + $this->assertEquals(filesize(__DIR__ . '/data/5mb.txt'), $this->totalStoredBytes); } } } diff --git a/Storage/tests/System/bootstrap.php b/Storage/tests/System/bootstrap.php new file mode 100644 index 000000000000..f45f59500ebb --- /dev/null +++ b/Storage/tests/System/bootstrap.php @@ -0,0 +1,8 @@ +write(str_repeat('0', 5000001)); - $logoFile = Psr7\stream_for(fopen(__DIR__ . '../../../data/logo.svg', 'r')); + $logoFile = Psr7\stream_for(fopen(__DIR__ . '/../data/logo.svg', 'r')); return [ [ diff --git a/tests/unit/Storage/EncryptionTraitTest.php b/Storage/tests/Unit/EncryptionTraitTest.php similarity index 99% rename from tests/unit/Storage/EncryptionTraitTest.php rename to Storage/tests/Unit/EncryptionTraitTest.php index 4a70dbea3213..ef3b6e9e7551 100644 --- a/tests/unit/Storage/EncryptionTraitTest.php +++ b/Storage/tests/Unit/EncryptionTraitTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Unit\Storage; +namespace Google\Cloud\Storage\Tests\Unit; use Google\Cloud\Core\Testing\KeyPairGenerateTrait; use Google\Cloud\Storage\EncryptionTrait; diff --git a/tests/unit/Storage/NotificationTest.php b/Storage/tests/Unit/NotificationTest.php similarity index 98% rename from tests/unit/Storage/NotificationTest.php rename to Storage/tests/Unit/NotificationTest.php index 63461e02ea00..8856680c8fbe 100644 --- a/tests/unit/Storage/NotificationTest.php +++ b/Storage/tests/Unit/NotificationTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Unit\Storage; +namespace Google\Cloud\Storage\Tests\Unit; use Google\Cloud\Core\Exception\NotFoundException; use Google\Cloud\Storage\Connection\ConnectionInterface; diff --git a/tests/unit/Storage/ObjectIteratorTest.php b/Storage/tests/Unit/ObjectIteratorTest.php similarity index 96% rename from tests/unit/Storage/ObjectIteratorTest.php rename to Storage/tests/Unit/ObjectIteratorTest.php index 0001bada013d..0ac70b9df93f 100644 --- a/tests/unit/Storage/ObjectIteratorTest.php +++ b/Storage/tests/Unit/ObjectIteratorTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Unit\Storage; +namespace Google\Cloud\Storage\Tests\Unit; use Google\Cloud\Storage\ObjectIterator; use Google\Cloud\Storage\ObjectPageIterator; diff --git a/tests/unit/Storage/ObjectPageIteratorTest.php b/Storage/tests/Unit/ObjectPageIteratorTest.php similarity index 97% rename from tests/unit/Storage/ObjectPageIteratorTest.php rename to Storage/tests/Unit/ObjectPageIteratorTest.php index 421f4d076827..1c5b82dadf2b 100644 --- a/tests/unit/Storage/ObjectPageIteratorTest.php +++ b/Storage/tests/Unit/ObjectPageIteratorTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Unit\Storage; +namespace Google\Cloud\Storage\Tests\Unit; use Google\Cloud\Storage\ObjectPageIterator; use PHPUnit\Framework\TestCase; diff --git a/tests/unit/Storage/ReadStreamTest.php b/Storage/tests/Unit/ReadStreamTest.php similarity index 100% rename from tests/unit/Storage/ReadStreamTest.php rename to Storage/tests/Unit/ReadStreamTest.php diff --git a/tests/unit/Storage/RequesterPaysTest.php b/Storage/tests/Unit/RequesterPaysTest.php similarity index 99% rename from tests/unit/Storage/RequesterPaysTest.php rename to Storage/tests/Unit/RequesterPaysTest.php index 2561916bcc70..d24956508d49 100644 --- a/tests/unit/Storage/RequesterPaysTest.php +++ b/Storage/tests/Unit/RequesterPaysTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Unit\Storage; +namespace Google\Cloud\Storage\Tests\Unit; use Prophecy\Argument; use Google\Cloud\Core\RequestWrapper; @@ -43,7 +43,10 @@ class RequesterPaysTest extends TestCase public function setUp() { $this->connection = new Rest(['projectId' => self::PROJECT]); - $this->client = \Google\Cloud\Core\Testing\TestHelpers::stub(StorageClient::class); + $this->client = \Google\Cloud\Core\Testing\TestHelpers::stub( + StorageClient::class, + [['projectId' => self::PROJECT]] + ); } /** diff --git a/tests/unit/Storage/StorageClientTest.php b/Storage/tests/Unit/StorageClientTest.php similarity index 99% rename from tests/unit/Storage/StorageClientTest.php rename to Storage/tests/Unit/StorageClientTest.php index c492adeef3c2..6ff471f476f6 100644 --- a/tests/unit/Storage/StorageClientTest.php +++ b/Storage/tests/Unit/StorageClientTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Unit\Storage; +namespace Google\Cloud\Storage\Tests\Unit; use Google\Cloud\Core\Timestamp; use Google\Cloud\Core\Upload\SignedUrlUploader; diff --git a/tests/unit/Storage/StorageObjectTest.php b/Storage/tests/Unit/StorageObjectTest.php similarity index 99% rename from tests/unit/Storage/StorageObjectTest.php rename to Storage/tests/Unit/StorageObjectTest.php index 83d4ca1a65df..aa5a5e28125c 100644 --- a/tests/unit/Storage/StorageObjectTest.php +++ b/Storage/tests/Unit/StorageObjectTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Unit\Storage; +namespace Google\Cloud\Storage\Tests\Unit; use Google\Cloud\Core\Exception\NotFoundException; use Google\Cloud\Core\RequestWrapper; diff --git a/tests/unit/Storage/StreamWrapperTest.php b/Storage/tests/Unit/StreamWrapperTest.php similarity index 100% rename from tests/unit/Storage/StreamWrapperTest.php rename to Storage/tests/Unit/StreamWrapperTest.php diff --git a/tests/unit/Storage/WriteStreamTest.php b/Storage/tests/Unit/WriteStreamTest.php similarity index 100% rename from tests/unit/Storage/WriteStreamTest.php rename to Storage/tests/Unit/WriteStreamTest.php diff --git a/tests/unit/data/logo.svg b/Storage/tests/Unit/data/logo.svg similarity index 100% rename from tests/unit/data/logo.svg rename to Storage/tests/Unit/data/logo.svg diff --git a/Trace/.github/pull_request_template.md b/Trace/.github/pull_request_template.md new file mode 100644 index 000000000000..0b776dfa1035 --- /dev/null +++ b/Trace/.github/pull_request_template.md @@ -0,0 +1,24 @@ +**PLEASE READ THIS ENTIRE MESSAGE** + +Hello, and thank you for your contribution! Please note that this repository is +a read-only split of `GoogleCloudPlatform/google-cloud-php`. As such, we are +unable to accept pull requests to this repository. + +We welcome your pull request and would be happy to consider it for inclusion in +our library if you follow these steps: + +* Clone the parent client library repository: + +```sh +$ git clone git@github.com:GoogleCloudPlatform/google-cloud-php.git +``` + +* Move your changes into the correct location in that library. Library code +belongs in `Trace/src`, and tests in `Trace/tests`. + +* Push the changes in a new branch to a fork, and open a new pull request +[here](https://github.com/GoogleCloudPlatform/google-cloud-php). + +Thanks again, and we look forward to seeing your proposed change! + +The Google Cloud PHP team diff --git a/src/Trace/CONTRIBUTING.md b/Trace/CONTRIBUTING.md similarity index 100% rename from src/Trace/CONTRIBUTING.md rename to Trace/CONTRIBUTING.md diff --git a/src/Trace/LICENSE b/Trace/LICENSE similarity index 100% rename from src/Trace/LICENSE rename to Trace/LICENSE diff --git a/src/Trace/README.md b/Trace/README.md similarity index 100% rename from src/Trace/README.md rename to Trace/README.md diff --git a/src/Trace/VERSION b/Trace/VERSION similarity index 100% rename from src/Trace/VERSION rename to Trace/VERSION diff --git a/src/Trace/composer.json b/Trace/composer.json similarity index 71% rename from src/Trace/composer.json rename to Trace/composer.json index 222ce412cf7f..bbcda2dd4dfc 100644 --- a/src/Trace/composer.json +++ b/Trace/composer.json @@ -8,6 +8,12 @@ "ramsey/uuid": "~3", "google/gax": "^0.30", "google/proto-client": "^0.34" + }, + "require-dev": { + "phpunit/phpunit": "^4.8|^5.0", + "squizlabs/php_codesniffer": "2.*", + "phpdocumentor/reflection": "^3.0", + "erusev/parsedown": "^1.6" }, "suggest": { "ext-grpc": "The gRPC extension enables use of the performant gRPC transport", @@ -20,13 +26,18 @@ "component": { "id": "cloud-trace", "target": "GoogleCloudPlatform/google-cloud-php-trace.git", - "path": "src/Trace", - "entry": "TraceClient.php" + "path": "Trace", + "entry": "src/TraceClient.php" } }, "autoload": { "psr-4": { - "Google\\Cloud\\Trace\\": "" + "Google\\Cloud\\Trace\\": "src" + } + }, + "autoload-dev": { + "psr-4": { + "Google\\Cloud\\Trace\\Tests\\": "tests" } } } diff --git a/Trace/phpunit-snippets.xml.dist b/Trace/phpunit-snippets.xml.dist new file mode 100644 index 000000000000..b92fd83e3c1b --- /dev/null +++ b/Trace/phpunit-snippets.xml.dist @@ -0,0 +1,19 @@ + + + + + tests/Snippet + + + + + src + + src/V[!a-zA-Z]* + + + + diff --git a/Trace/phpunit-system.xml.dist b/Trace/phpunit-system.xml.dist new file mode 100644 index 000000000000..f6deee15a036 --- /dev/null +++ b/Trace/phpunit-system.xml.dist @@ -0,0 +1,16 @@ + + + + + tests/System + + + + + src + + src/V[!a-zA-Z]* + + + + diff --git a/Trace/phpunit.xml.dist b/Trace/phpunit.xml.dist new file mode 100644 index 000000000000..1c2b8f6b56d2 --- /dev/null +++ b/Trace/phpunit.xml.dist @@ -0,0 +1,16 @@ + + + + + tests/Unit + + + + + src + + src/V[!a-zA-Z]* + + + + diff --git a/src/Trace/Annotation.php b/Trace/src/Annotation.php similarity index 100% rename from src/Trace/Annotation.php rename to Trace/src/Annotation.php diff --git a/src/Trace/AttributeTrait.php b/Trace/src/AttributeTrait.php similarity index 100% rename from src/Trace/AttributeTrait.php rename to Trace/src/AttributeTrait.php diff --git a/src/Trace/Attributes.php b/Trace/src/Attributes.php similarity index 100% rename from src/Trace/Attributes.php rename to Trace/src/Attributes.php diff --git a/src/Trace/Connection/ConnectionInterface.php b/Trace/src/Connection/ConnectionInterface.php similarity index 100% rename from src/Trace/Connection/ConnectionInterface.php rename to Trace/src/Connection/ConnectionInterface.php diff --git a/src/Trace/Connection/Rest.php b/Trace/src/Connection/Rest.php similarity index 100% rename from src/Trace/Connection/Rest.php rename to Trace/src/Connection/Rest.php diff --git a/src/Trace/Connection/ServiceDefinition/trace-v2.json b/Trace/src/Connection/ServiceDefinition/trace-v2.json similarity index 100% rename from src/Trace/Connection/ServiceDefinition/trace-v2.json rename to Trace/src/Connection/ServiceDefinition/trace-v2.json diff --git a/src/Trace/Link.php b/Trace/src/Link.php similarity index 100% rename from src/Trace/Link.php rename to Trace/src/Link.php diff --git a/src/Trace/MessageEvent.php b/Trace/src/MessageEvent.php similarity index 100% rename from src/Trace/MessageEvent.php rename to Trace/src/MessageEvent.php diff --git a/src/Trace/Span.php b/Trace/src/Span.php similarity index 100% rename from src/Trace/Span.php rename to Trace/src/Span.php diff --git a/src/Trace/StackTrace.php b/Trace/src/StackTrace.php similarity index 100% rename from src/Trace/StackTrace.php rename to Trace/src/StackTrace.php diff --git a/src/Trace/Status.php b/Trace/src/Status.php similarity index 100% rename from src/Trace/Status.php rename to Trace/src/Status.php diff --git a/src/Trace/TimeEvent.php b/Trace/src/TimeEvent.php similarity index 100% rename from src/Trace/TimeEvent.php rename to Trace/src/TimeEvent.php diff --git a/src/Trace/TimestampTrait.php b/Trace/src/TimestampTrait.php similarity index 100% rename from src/Trace/TimestampTrait.php rename to Trace/src/TimestampTrait.php diff --git a/src/Trace/Trace.php b/Trace/src/Trace.php similarity index 100% rename from src/Trace/Trace.php rename to Trace/src/Trace.php diff --git a/src/Trace/TraceClient.php b/Trace/src/TraceClient.php similarity index 98% rename from src/Trace/TraceClient.php rename to Trace/src/TraceClient.php index 57e5d29a7bf9..218511039c33 100644 --- a/src/Trace/TraceClient.php +++ b/Trace/src/TraceClient.php @@ -17,6 +17,7 @@ namespace Google\Cloud\Trace; +use Google\Auth\FetchAuthTokenInterface; use Google\Cloud\Core\ClientTrait; use Google\Cloud\Core\Iterator\ItemIterator; use Google\Cloud\Core\Iterator\PageIterator; @@ -24,6 +25,7 @@ use Google\Cloud\Trace\Connection\Rest; use Google\Cloud\Trace\Reporter\AsyncReporter; use Google\Cloud\Trace\Reporter\ReporterInterface; +use Psr\Cache\CacheItemPoolInterface; /** * Google Stackdriver Trace allows you to collect latency data from diff --git a/src/Trace/V2/Gapic/TraceServiceGapicClient.php b/Trace/src/V2/Gapic/TraceServiceGapicClient.php similarity index 100% rename from src/Trace/V2/Gapic/TraceServiceGapicClient.php rename to Trace/src/V2/Gapic/TraceServiceGapicClient.php diff --git a/src/Trace/V2/README.md b/Trace/src/V2/README.md similarity index 100% rename from src/Trace/V2/README.md rename to Trace/src/V2/README.md diff --git a/src/Trace/V2/TraceServiceClient.php b/Trace/src/V2/TraceServiceClient.php similarity index 100% rename from src/Trace/V2/TraceServiceClient.php rename to Trace/src/V2/TraceServiceClient.php diff --git a/src/Trace/V2/resources/trace_service_client_config.json b/Trace/src/V2/resources/trace_service_client_config.json similarity index 100% rename from src/Trace/V2/resources/trace_service_client_config.json rename to Trace/src/V2/resources/trace_service_client_config.json diff --git a/src/Trace/V2/resources/trace_service_descriptor_config.php b/Trace/src/V2/resources/trace_service_descriptor_config.php similarity index 100% rename from src/Trace/V2/resources/trace_service_descriptor_config.php rename to Trace/src/V2/resources/trace_service_descriptor_config.php diff --git a/src/Trace/V2/resources/trace_service_rest_client_config.php b/Trace/src/V2/resources/trace_service_rest_client_config.php similarity index 100% rename from src/Trace/V2/resources/trace_service_rest_client_config.php rename to Trace/src/V2/resources/trace_service_rest_client_config.php diff --git a/tests/snippets/Trace/AnnotationTest.php b/Trace/tests/Snippet/AnnotationTest.php similarity index 96% rename from tests/snippets/Trace/AnnotationTest.php rename to Trace/tests/Snippet/AnnotationTest.php index 6b4c17e0b383..f6b2d44a9e48 100644 --- a/tests/snippets/Trace/AnnotationTest.php +++ b/Trace/tests/Snippet/AnnotationTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Snippets\Trace; +namespace Google\Cloud\Trace\Tests\Snippet; use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Trace\Annotation; diff --git a/tests/snippets/Trace/AttributesTest.php b/Trace/tests/Snippet/AttributesTest.php similarity index 96% rename from tests/snippets/Trace/AttributesTest.php rename to Trace/tests/Snippet/AttributesTest.php index 492d57bb48ff..1d8abf560aea 100644 --- a/tests/snippets/Trace/AttributesTest.php +++ b/Trace/tests/Snippet/AttributesTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Snippets\Trace; +namespace Google\Cloud\Trace\Tests\Snippet; use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Trace\Attributes; diff --git a/tests/snippets/Trace/LinkTest.php b/Trace/tests/Snippet/LinkTest.php similarity index 95% rename from tests/snippets/Trace/LinkTest.php rename to Trace/tests/Snippet/LinkTest.php index 7e3eadd4bf4e..9cce5b17d858 100644 --- a/tests/snippets/Trace/LinkTest.php +++ b/Trace/tests/Snippet/LinkTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Snippets\Trace; +namespace Google\Cloud\Trace\Tests\Snippet; use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Trace\Link; diff --git a/tests/snippets/Trace/MessageEventTest.php b/Trace/tests/Snippet/MessageEventTest.php similarity index 96% rename from tests/snippets/Trace/MessageEventTest.php rename to Trace/tests/Snippet/MessageEventTest.php index da2a195e2b77..2b0fdb0746c2 100644 --- a/tests/snippets/Trace/MessageEventTest.php +++ b/Trace/tests/Snippet/MessageEventTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Snippets\Trace; +namespace Google\Cloud\Trace\Tests\Snippet; use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Trace\MessageEvent; diff --git a/tests/snippets/Trace/SpanTest.php b/Trace/tests/Snippet/SpanTest.php similarity index 99% rename from tests/snippets/Trace/SpanTest.php rename to Trace/tests/Snippet/SpanTest.php index 664554f6f081..a0c047d9aee3 100644 --- a/tests/snippets/Trace/SpanTest.php +++ b/Trace/tests/Snippet/SpanTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Snippets\Trace; +namespace Google\Cloud\Trace\Tests\Snippet; use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Trace\Annotation; diff --git a/tests/snippets/Trace/StackTraceTest.php b/Trace/tests/Snippet/StackTraceTest.php similarity index 95% rename from tests/snippets/Trace/StackTraceTest.php rename to Trace/tests/Snippet/StackTraceTest.php index 542915212cd9..0da30cd425f4 100644 --- a/tests/snippets/Trace/StackTraceTest.php +++ b/Trace/tests/Snippet/StackTraceTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Snippets\Trace; +namespace Google\Cloud\Trace\Tests\Snippet; use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Trace\StackTrace; diff --git a/tests/snippets/Trace/StatusTest.php b/Trace/tests/Snippet/StatusTest.php similarity index 95% rename from tests/snippets/Trace/StatusTest.php rename to Trace/tests/Snippet/StatusTest.php index 096ab4cd35cc..0df4b01946d9 100644 --- a/tests/snippets/Trace/StatusTest.php +++ b/Trace/tests/Snippet/StatusTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Snippets\Trace; +namespace Google\Cloud\Trace\Tests\Snippet; use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Trace\Status; diff --git a/tests/snippets/Trace/TraceClientTest.php b/Trace/tests/Snippet/TraceClientTest.php similarity index 98% rename from tests/snippets/Trace/TraceClientTest.php rename to Trace/tests/Snippet/TraceClientTest.php index a18be1a08e5c..6b006c662063 100644 --- a/tests/snippets/Trace/TraceClientTest.php +++ b/Trace/tests/Snippet/TraceClientTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Snippets\Trace; +namespace Google\Cloud\Trace\Tests\Snippet; use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Trace\Connection\ConnectionInterface; diff --git a/tests/snippets/Trace/TraceTest.php b/Trace/tests/Snippet/TraceTest.php similarity index 98% rename from tests/snippets/Trace/TraceTest.php rename to Trace/tests/Snippet/TraceTest.php index 23162c9fe025..5e28de297751 100644 --- a/tests/snippets/Trace/TraceTest.php +++ b/Trace/tests/Snippet/TraceTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Snippets\Trace; +namespace Google\Cloud\Trace\Tests\Snippet; use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Trace\Span; diff --git a/tests/system/Trace/BasicTest.php b/Trace/tests/System/BasicTest.php similarity index 98% rename from tests/system/Trace/BasicTest.php rename to Trace/tests/System/BasicTest.php index 621ef1eaf31b..5337cbffd4d8 100644 --- a/tests/system/Trace/BasicTest.php +++ b/Trace/tests/System/BasicTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\System\Trace; +namespace Google\Cloud\Trace\Tests\System; use Google\Cloud\Core\ExponentialBackoff; use Google\Cloud\Trace\Annotation; diff --git a/Trace/tests/System/bootstrap.php b/Trace/tests/System/bootstrap.php new file mode 100644 index 000000000000..38465605b9a8 --- /dev/null +++ b/Trace/tests/System/bootstrap.php @@ -0,0 +1,5 @@ + + + + + tests/Snippet + + + + + src + + src/V[!a-zA-Z]* + + + + diff --git a/Translate/phpunit-system.xml.dist b/Translate/phpunit-system.xml.dist new file mode 100644 index 000000000000..f6deee15a036 --- /dev/null +++ b/Translate/phpunit-system.xml.dist @@ -0,0 +1,16 @@ + + + + + tests/System + + + + + src + + src/V[!a-zA-Z]* + + + + diff --git a/Translate/phpunit.xml.dist b/Translate/phpunit.xml.dist new file mode 100644 index 000000000000..1c2b8f6b56d2 --- /dev/null +++ b/Translate/phpunit.xml.dist @@ -0,0 +1,16 @@ + + + + + tests/Unit + + + + + src + + src/V[!a-zA-Z]* + + + + diff --git a/src/Translate/Connection/ConnectionInterface.php b/Translate/src/Connection/ConnectionInterface.php similarity index 100% rename from src/Translate/Connection/ConnectionInterface.php rename to Translate/src/Connection/ConnectionInterface.php diff --git a/src/Translate/Connection/Rest.php b/Translate/src/Connection/Rest.php similarity index 100% rename from src/Translate/Connection/Rest.php rename to Translate/src/Connection/Rest.php diff --git a/src/Translate/Connection/ServiceDefinition/translate-v2.json b/Translate/src/Connection/ServiceDefinition/translate-v2.json similarity index 100% rename from src/Translate/Connection/ServiceDefinition/translate-v2.json rename to Translate/src/Connection/ServiceDefinition/translate-v2.json diff --git a/src/Translate/TranslateClient.php b/Translate/src/TranslateClient.php similarity index 99% rename from src/Translate/TranslateClient.php rename to Translate/src/TranslateClient.php index de1f5ab51deb..7ab730692ac9 100644 --- a/src/Translate/TranslateClient.php +++ b/Translate/src/TranslateClient.php @@ -17,9 +17,11 @@ namespace Google\Cloud\Translate; +use Google\Auth\FetchAuthTokenInterface; use Google\Cloud\Core\ClientTrait; use Google\Cloud\Translate\Connection\ConnectionInterface; use Google\Cloud\Translate\Connection\Rest; +use Psr\Cache\CacheItemPoolInterface; /** * Google Cloud Translation provides the ability to dynamically translate diff --git a/tests/snippets/Translate/TranslateClientTest.php b/Translate/tests/Snippet/TranslateClientTest.php similarity index 99% rename from tests/snippets/Translate/TranslateClientTest.php rename to Translate/tests/Snippet/TranslateClientTest.php index 1e3f5fec2eea..72417f26065f 100644 --- a/tests/snippets/Translate/TranslateClientTest.php +++ b/Translate/tests/Snippet/TranslateClientTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Snippets\Translate; +namespace Google\Cloud\Translate\Tests\Snippet; use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Translate\Connection\ConnectionInterface; diff --git a/tests/system/Translate/TranslateTest.php b/Translate/tests/System/TranslateTest.php similarity index 99% rename from tests/system/Translate/TranslateTest.php rename to Translate/tests/System/TranslateTest.php index bbd053ee8976..afd95cc1e4c1 100644 --- a/tests/system/Translate/TranslateTest.php +++ b/Translate/tests/System/TranslateTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\System\Translate; +namespace Google\Cloud\Translate\Tests\System; /** * @group translate diff --git a/tests/system/Translate/TranslateTestCase.php b/Translate/tests/System/TranslateTestCase.php similarity index 95% rename from tests/system/Translate/TranslateTestCase.php rename to Translate/tests/System/TranslateTestCase.php index d0bb3b7cbcce..513bd35911aa 100644 --- a/tests/system/Translate/TranslateTestCase.php +++ b/Translate/tests/System/TranslateTestCase.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\System\Translate; +namespace Google\Cloud\Translate\Tests\System; use Google\Cloud\Translate\TranslateClient; use PHPUnit\Framework\TestCase; diff --git a/Translate/tests/System/bootstrap.php b/Translate/tests/System/bootstrap.php new file mode 100644 index 000000000000..38465605b9a8 --- /dev/null +++ b/Translate/tests/System/bootstrap.php @@ -0,0 +1,5 @@ + + + + + tests/Snippet + + + + + src + + src/V[!a-zA-Z]* + + + + diff --git a/VideoIntelligence/phpunit-system.xml.dist b/VideoIntelligence/phpunit-system.xml.dist new file mode 100644 index 000000000000..f6deee15a036 --- /dev/null +++ b/VideoIntelligence/phpunit-system.xml.dist @@ -0,0 +1,16 @@ + + + + + tests/System + + + + + src + + src/V[!a-zA-Z]* + + + + diff --git a/VideoIntelligence/phpunit.xml.dist b/VideoIntelligence/phpunit.xml.dist new file mode 100644 index 000000000000..1c2b8f6b56d2 --- /dev/null +++ b/VideoIntelligence/phpunit.xml.dist @@ -0,0 +1,16 @@ + + + + + tests/Unit + + + + + src + + src/V[!a-zA-Z]* + + + + diff --git a/src/VideoIntelligence/V1/Gapic/VideoIntelligenceServiceGapicClient.php b/VideoIntelligence/src/V1/Gapic/VideoIntelligenceServiceGapicClient.php similarity index 100% rename from src/VideoIntelligence/V1/Gapic/VideoIntelligenceServiceGapicClient.php rename to VideoIntelligence/src/V1/Gapic/VideoIntelligenceServiceGapicClient.php diff --git a/src/VideoIntelligence/V1/README.md b/VideoIntelligence/src/V1/README.md similarity index 100% rename from src/VideoIntelligence/V1/README.md rename to VideoIntelligence/src/V1/README.md diff --git a/src/VideoIntelligence/V1/VideoIntelligenceServiceClient.php b/VideoIntelligence/src/V1/VideoIntelligenceServiceClient.php similarity index 100% rename from src/VideoIntelligence/V1/VideoIntelligenceServiceClient.php rename to VideoIntelligence/src/V1/VideoIntelligenceServiceClient.php diff --git a/src/VideoIntelligence/V1/resources/video_intelligence_service_client_config.json b/VideoIntelligence/src/V1/resources/video_intelligence_service_client_config.json similarity index 100% rename from src/VideoIntelligence/V1/resources/video_intelligence_service_client_config.json rename to VideoIntelligence/src/V1/resources/video_intelligence_service_client_config.json diff --git a/src/VideoIntelligence/V1/resources/video_intelligence_service_descriptor_config.php b/VideoIntelligence/src/V1/resources/video_intelligence_service_descriptor_config.php similarity index 100% rename from src/VideoIntelligence/V1/resources/video_intelligence_service_descriptor_config.php rename to VideoIntelligence/src/V1/resources/video_intelligence_service_descriptor_config.php diff --git a/src/VideoIntelligence/V1/resources/video_intelligence_service_rest_client_config.php b/VideoIntelligence/src/V1/resources/video_intelligence_service_rest_client_config.php similarity index 100% rename from src/VideoIntelligence/V1/resources/video_intelligence_service_rest_client_config.php rename to VideoIntelligence/src/V1/resources/video_intelligence_service_rest_client_config.php diff --git a/src/VideoIntelligence/V1beta1/Gapic/VideoIntelligenceServiceGapicClient.php b/VideoIntelligence/src/V1beta1/Gapic/VideoIntelligenceServiceGapicClient.php similarity index 100% rename from src/VideoIntelligence/V1beta1/Gapic/VideoIntelligenceServiceGapicClient.php rename to VideoIntelligence/src/V1beta1/Gapic/VideoIntelligenceServiceGapicClient.php diff --git a/src/VideoIntelligence/V1beta1/README.md b/VideoIntelligence/src/V1beta1/README.md similarity index 100% rename from src/VideoIntelligence/V1beta1/README.md rename to VideoIntelligence/src/V1beta1/README.md diff --git a/src/VideoIntelligence/V1beta1/VideoIntelligenceServiceClient.php b/VideoIntelligence/src/V1beta1/VideoIntelligenceServiceClient.php similarity index 100% rename from src/VideoIntelligence/V1beta1/VideoIntelligenceServiceClient.php rename to VideoIntelligence/src/V1beta1/VideoIntelligenceServiceClient.php diff --git a/src/VideoIntelligence/V1beta1/resources/video_intelligence_service_client_config.json b/VideoIntelligence/src/V1beta1/resources/video_intelligence_service_client_config.json similarity index 100% rename from src/VideoIntelligence/V1beta1/resources/video_intelligence_service_client_config.json rename to VideoIntelligence/src/V1beta1/resources/video_intelligence_service_client_config.json diff --git a/src/VideoIntelligence/V1beta1/resources/video_intelligence_service_descriptor_config.php b/VideoIntelligence/src/V1beta1/resources/video_intelligence_service_descriptor_config.php similarity index 100% rename from src/VideoIntelligence/V1beta1/resources/video_intelligence_service_descriptor_config.php rename to VideoIntelligence/src/V1beta1/resources/video_intelligence_service_descriptor_config.php diff --git a/src/VideoIntelligence/V1beta1/resources/video_intelligence_service_rest_client_config.php b/VideoIntelligence/src/V1beta1/resources/video_intelligence_service_rest_client_config.php similarity index 100% rename from src/VideoIntelligence/V1beta1/resources/video_intelligence_service_rest_client_config.php rename to VideoIntelligence/src/V1beta1/resources/video_intelligence_service_rest_client_config.php diff --git a/src/VideoIntelligence/V1beta2/Gapic/VideoIntelligenceServiceGapicClient.php b/VideoIntelligence/src/V1beta2/Gapic/VideoIntelligenceServiceGapicClient.php similarity index 100% rename from src/VideoIntelligence/V1beta2/Gapic/VideoIntelligenceServiceGapicClient.php rename to VideoIntelligence/src/V1beta2/Gapic/VideoIntelligenceServiceGapicClient.php diff --git a/src/VideoIntelligence/V1beta2/README.md b/VideoIntelligence/src/V1beta2/README.md similarity index 100% rename from src/VideoIntelligence/V1beta2/README.md rename to VideoIntelligence/src/V1beta2/README.md diff --git a/src/VideoIntelligence/V1beta2/VideoIntelligenceServiceClient.php b/VideoIntelligence/src/V1beta2/VideoIntelligenceServiceClient.php similarity index 100% rename from src/VideoIntelligence/V1beta2/VideoIntelligenceServiceClient.php rename to VideoIntelligence/src/V1beta2/VideoIntelligenceServiceClient.php diff --git a/src/VideoIntelligence/V1beta2/resources/video_intelligence_service_client_config.json b/VideoIntelligence/src/V1beta2/resources/video_intelligence_service_client_config.json similarity index 100% rename from src/VideoIntelligence/V1beta2/resources/video_intelligence_service_client_config.json rename to VideoIntelligence/src/V1beta2/resources/video_intelligence_service_client_config.json diff --git a/src/VideoIntelligence/V1beta2/resources/video_intelligence_service_descriptor_config.php b/VideoIntelligence/src/V1beta2/resources/video_intelligence_service_descriptor_config.php similarity index 100% rename from src/VideoIntelligence/V1beta2/resources/video_intelligence_service_descriptor_config.php rename to VideoIntelligence/src/V1beta2/resources/video_intelligence_service_descriptor_config.php diff --git a/src/VideoIntelligence/V1beta2/resources/video_intelligence_service_rest_client_config.php b/VideoIntelligence/src/V1beta2/resources/video_intelligence_service_rest_client_config.php similarity index 100% rename from src/VideoIntelligence/V1beta2/resources/video_intelligence_service_rest_client_config.php rename to VideoIntelligence/src/V1beta2/resources/video_intelligence_service_rest_client_config.php diff --git a/VideoIntelligence/tests/System/bootstrap.php b/VideoIntelligence/tests/System/bootstrap.php new file mode 100644 index 000000000000..38465605b9a8 --- /dev/null +++ b/VideoIntelligence/tests/System/bootstrap.php @@ -0,0 +1,5 @@ + + + + + tests/Snippet + + + + + src + + src/V[!a-zA-Z]* + + + + diff --git a/Vision/phpunit-system.xml.dist b/Vision/phpunit-system.xml.dist new file mode 100644 index 000000000000..f6deee15a036 --- /dev/null +++ b/Vision/phpunit-system.xml.dist @@ -0,0 +1,16 @@ + + + + + tests/System + + + + + src + + src/V[!a-zA-Z]* + + + + diff --git a/Vision/phpunit.xml.dist b/Vision/phpunit.xml.dist new file mode 100644 index 000000000000..1c2b8f6b56d2 --- /dev/null +++ b/Vision/phpunit.xml.dist @@ -0,0 +1,16 @@ + + + + + tests/Unit + + + + + src + + src/V[!a-zA-Z]* + + + + diff --git a/src/Vision/Annotation.php b/Vision/src/Annotation.php similarity index 100% rename from src/Vision/Annotation.php rename to Vision/src/Annotation.php diff --git a/src/Vision/Annotation/AbstractFeature.php b/Vision/src/Annotation/AbstractFeature.php similarity index 100% rename from src/Vision/Annotation/AbstractFeature.php rename to Vision/src/Annotation/AbstractFeature.php diff --git a/src/Vision/Annotation/CropHint.php b/Vision/src/Annotation/CropHint.php similarity index 100% rename from src/Vision/Annotation/CropHint.php rename to Vision/src/Annotation/CropHint.php diff --git a/src/Vision/Annotation/Document.php b/Vision/src/Annotation/Document.php similarity index 100% rename from src/Vision/Annotation/Document.php rename to Vision/src/Annotation/Document.php diff --git a/src/Vision/Annotation/Entity.php b/Vision/src/Annotation/Entity.php similarity index 100% rename from src/Vision/Annotation/Entity.php rename to Vision/src/Annotation/Entity.php diff --git a/src/Vision/Annotation/Face.php b/Vision/src/Annotation/Face.php similarity index 100% rename from src/Vision/Annotation/Face.php rename to Vision/src/Annotation/Face.php diff --git a/src/Vision/Annotation/Face/Landmarks.php b/Vision/src/Annotation/Face/Landmarks.php similarity index 100% rename from src/Vision/Annotation/Face/Landmarks.php rename to Vision/src/Annotation/Face/Landmarks.php diff --git a/src/Vision/Annotation/FeatureInterface.php b/Vision/src/Annotation/FeatureInterface.php similarity index 100% rename from src/Vision/Annotation/FeatureInterface.php rename to Vision/src/Annotation/FeatureInterface.php diff --git a/src/Vision/Annotation/ImageProperties.php b/Vision/src/Annotation/ImageProperties.php similarity index 100% rename from src/Vision/Annotation/ImageProperties.php rename to Vision/src/Annotation/ImageProperties.php diff --git a/src/Vision/Annotation/LikelihoodTrait.php b/Vision/src/Annotation/LikelihoodTrait.php similarity index 100% rename from src/Vision/Annotation/LikelihoodTrait.php rename to Vision/src/Annotation/LikelihoodTrait.php diff --git a/src/Vision/Annotation/SafeSearch.php b/Vision/src/Annotation/SafeSearch.php similarity index 100% rename from src/Vision/Annotation/SafeSearch.php rename to Vision/src/Annotation/SafeSearch.php diff --git a/src/Vision/Annotation/Web.php b/Vision/src/Annotation/Web.php similarity index 100% rename from src/Vision/Annotation/Web.php rename to Vision/src/Annotation/Web.php diff --git a/src/Vision/Annotation/Web/WebEntity.php b/Vision/src/Annotation/Web/WebEntity.php similarity index 100% rename from src/Vision/Annotation/Web/WebEntity.php rename to Vision/src/Annotation/Web/WebEntity.php diff --git a/src/Vision/Annotation/Web/WebImage.php b/Vision/src/Annotation/Web/WebImage.php similarity index 100% rename from src/Vision/Annotation/Web/WebImage.php rename to Vision/src/Annotation/Web/WebImage.php diff --git a/src/Vision/Annotation/Web/WebPage.php b/Vision/src/Annotation/Web/WebPage.php similarity index 100% rename from src/Vision/Annotation/Web/WebPage.php rename to Vision/src/Annotation/Web/WebPage.php diff --git a/src/Vision/Connection/ConnectionInterface.php b/Vision/src/Connection/ConnectionInterface.php similarity index 100% rename from src/Vision/Connection/ConnectionInterface.php rename to Vision/src/Connection/ConnectionInterface.php diff --git a/src/Vision/Connection/Rest.php b/Vision/src/Connection/Rest.php similarity index 100% rename from src/Vision/Connection/Rest.php rename to Vision/src/Connection/Rest.php diff --git a/src/Vision/Connection/ServiceDefinition/vision-v1.json b/Vision/src/Connection/ServiceDefinition/vision-v1.json similarity index 100% rename from src/Vision/Connection/ServiceDefinition/vision-v1.json rename to Vision/src/Connection/ServiceDefinition/vision-v1.json diff --git a/src/Vision/Image.php b/Vision/src/Image.php similarity index 100% rename from src/Vision/Image.php rename to Vision/src/Image.php diff --git a/src/Vision/V1/Gapic/ImageAnnotatorGapicClient.php b/Vision/src/V1/Gapic/ImageAnnotatorGapicClient.php similarity index 100% rename from src/Vision/V1/Gapic/ImageAnnotatorGapicClient.php rename to Vision/src/V1/Gapic/ImageAnnotatorGapicClient.php diff --git a/src/Vision/V1/ImageAnnotatorClient.php b/Vision/src/V1/ImageAnnotatorClient.php similarity index 100% rename from src/Vision/V1/ImageAnnotatorClient.php rename to Vision/src/V1/ImageAnnotatorClient.php diff --git a/src/Vision/V1/README.md b/Vision/src/V1/README.md similarity index 100% rename from src/Vision/V1/README.md rename to Vision/src/V1/README.md diff --git a/src/Vision/V1/resources/image_annotator_client_config.json b/Vision/src/V1/resources/image_annotator_client_config.json similarity index 100% rename from src/Vision/V1/resources/image_annotator_client_config.json rename to Vision/src/V1/resources/image_annotator_client_config.json diff --git a/src/Vision/V1/resources/image_annotator_descriptor_config.php b/Vision/src/V1/resources/image_annotator_descriptor_config.php similarity index 100% rename from src/Vision/V1/resources/image_annotator_descriptor_config.php rename to Vision/src/V1/resources/image_annotator_descriptor_config.php diff --git a/src/Vision/V1/resources/image_annotator_rest_client_config.php b/Vision/src/V1/resources/image_annotator_rest_client_config.php similarity index 100% rename from src/Vision/V1/resources/image_annotator_rest_client_config.php rename to Vision/src/V1/resources/image_annotator_rest_client_config.php diff --git a/src/Vision/VisionClient.php b/Vision/src/VisionClient.php similarity index 99% rename from src/Vision/VisionClient.php rename to Vision/src/VisionClient.php index e1476a829edf..e514a3532c38 100644 --- a/src/Vision/VisionClient.php +++ b/Vision/src/VisionClient.php @@ -17,6 +17,7 @@ namespace Google\Cloud\Vision; +use Google\Auth\FetchAuthTokenInterface; use Google\Cloud\Core\ClientTrait; use Google\Cloud\Core\ValidateTrait; use Google\Cloud\Storage\StorageObject; diff --git a/src/Vision/VisionHelpersTrait.php b/Vision/src/VisionHelpersTrait.php similarity index 99% rename from src/Vision/VisionHelpersTrait.php rename to Vision/src/VisionHelpersTrait.php index 4a5f5fd27b03..5a8ccb8388f0 100644 --- a/src/Vision/VisionHelpersTrait.php +++ b/Vision/src/VisionHelpersTrait.php @@ -21,7 +21,6 @@ use Google\Cloud\Vision\V1\AnnotateImageRequest; use Google\Cloud\Vision\V1\AnnotateImageResponse; use Google\Cloud\Vision\V1\Feature; -use Google\Cloud\Vision\V1\Image; use InvalidArgumentException; /** diff --git a/tests/snippets/Vision/Annotation/AbstractFeatureTest.php b/Vision/tests/Snippet/Annotation/AbstractFeatureTest.php similarity index 95% rename from tests/snippets/Vision/Annotation/AbstractFeatureTest.php rename to Vision/tests/Snippet/Annotation/AbstractFeatureTest.php index 4198e6b81421..54c398b84b4e 100644 --- a/tests/snippets/Vision/Annotation/AbstractFeatureTest.php +++ b/Vision/tests/Snippet/Annotation/AbstractFeatureTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Snippets\Vision\Annotation; +namespace Google\Cloud\Vision\Tests\Snippet\Annotation; use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Vision\Annotation\AbstractFeature; diff --git a/tests/snippets/Vision/Annotation/CropHintTest.php b/Vision/tests/Snippet/Annotation/CropHintTest.php similarity index 98% rename from tests/snippets/Vision/Annotation/CropHintTest.php rename to Vision/tests/Snippet/Annotation/CropHintTest.php index 25bc3bc91bbd..5bfb518d0dc2 100644 --- a/tests/snippets/Vision/Annotation/CropHintTest.php +++ b/Vision/tests/Snippet/Annotation/CropHintTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Snippets\Vision\Annotation; +namespace Google\Cloud\Vision\Tests\Snippet\Annotation; use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Vision\Annotation\CropHint; diff --git a/tests/snippets/Vision/Annotation/DocumentTest.php b/Vision/tests/Snippet/Annotation/DocumentTest.php similarity index 98% rename from tests/snippets/Vision/Annotation/DocumentTest.php rename to Vision/tests/Snippet/Annotation/DocumentTest.php index a8e951535521..d41edcea4b1c 100644 --- a/tests/snippets/Vision/Annotation/DocumentTest.php +++ b/Vision/tests/Snippet/Annotation/DocumentTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Snippets\Vision\Annotation; +namespace Google\Cloud\Vision\Tests\Snippet\Annotation; use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Vision\Annotation\Document; diff --git a/tests/snippets/Vision/Annotation/EntityTest.php b/Vision/tests/Snippet/Annotation/EntityTest.php similarity index 98% rename from tests/snippets/Vision/Annotation/EntityTest.php rename to Vision/tests/Snippet/Annotation/EntityTest.php index 170e0b2b2168..129d68ea5eef 100644 --- a/tests/snippets/Vision/Annotation/EntityTest.php +++ b/Vision/tests/Snippet/Annotation/EntityTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Snippets\Vision\Annotation; +namespace Google\Cloud\Vision\Tests\Snippet\Annotation; use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Vision\Annotation\Entity; diff --git a/tests/snippets/Vision/Annotation/Face/LandmarksTest.php b/Vision/tests/Snippet/Annotation/Face/LandmarksTest.php similarity index 99% rename from tests/snippets/Vision/Annotation/Face/LandmarksTest.php rename to Vision/tests/Snippet/Annotation/Face/LandmarksTest.php index 76e4152ca698..5e15e7702fd8 100644 --- a/tests/snippets/Vision/Annotation/Face/LandmarksTest.php +++ b/Vision/tests/Snippet/Annotation/Face/LandmarksTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Snippets\Vision\Annotation\Face; +namespace Google\Cloud\Vision\Tests\Snippet\Annotation\Face; use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Vision\Annotation\Face\Landmarks; diff --git a/tests/snippets/Vision/Annotation/FaceTest.php b/Vision/tests/Snippet/Annotation/FaceTest.php similarity index 99% rename from tests/snippets/Vision/Annotation/FaceTest.php rename to Vision/tests/Snippet/Annotation/FaceTest.php index 3f8e76ac3fa3..2d57c6f54808 100644 --- a/tests/snippets/Vision/Annotation/FaceTest.php +++ b/Vision/tests/Snippet/Annotation/FaceTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Snippets\Vision\Annotation; +namespace Google\Cloud\Vision\Tests\Snippet\Annotation; use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Vision\Annotation\Face; diff --git a/tests/snippets/Vision/Annotation/ImagePropertiesTest.php b/Vision/tests/Snippet/Annotation/ImagePropertiesTest.php similarity index 98% rename from tests/snippets/Vision/Annotation/ImagePropertiesTest.php rename to Vision/tests/Snippet/Annotation/ImagePropertiesTest.php index bece88609fb9..f1ede5b6585a 100644 --- a/tests/snippets/Vision/Annotation/ImagePropertiesTest.php +++ b/Vision/tests/Snippet/Annotation/ImagePropertiesTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Snippets\Vision\Annotation; +namespace Google\Cloud\Vision\Tests\Snippet\Annotation; use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Vision\Annotation\ImageProperties; diff --git a/tests/snippets/Vision/Annotation/SafeSearchTest.php b/Vision/tests/Snippet/Annotation/SafeSearchTest.php similarity index 98% rename from tests/snippets/Vision/Annotation/SafeSearchTest.php rename to Vision/tests/Snippet/Annotation/SafeSearchTest.php index 43f4d09939bb..5103f3358f67 100644 --- a/tests/snippets/Vision/Annotation/SafeSearchTest.php +++ b/Vision/tests/Snippet/Annotation/SafeSearchTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Snippets\Vision\Annotation; +namespace Google\Cloud\Vision\Tests\Snippet\Annotation; use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Vision\Annotation\SafeSearch; diff --git a/tests/snippets/Vision/Annotation/Web/WebEntityTest.php b/Vision/tests/Snippet/Annotation/Web/WebEntityTest.php similarity index 98% rename from tests/snippets/Vision/Annotation/Web/WebEntityTest.php rename to Vision/tests/Snippet/Annotation/Web/WebEntityTest.php index 5058e2ff4486..01c8841f8c91 100644 --- a/tests/snippets/Vision/Annotation/Web/WebEntityTest.php +++ b/Vision/tests/Snippet/Annotation/Web/WebEntityTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Snippets\Vision\Annotation\Web; +namespace Google\Cloud\Vision\Tests\Snippet\Annotation\Web; use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Vision\Annotation\Web\WebEntity; diff --git a/tests/snippets/Vision/Annotation/Web/WebImageTest.php b/Vision/tests/Snippet/Annotation/Web/WebImageTest.php similarity index 97% rename from tests/snippets/Vision/Annotation/Web/WebImageTest.php rename to Vision/tests/Snippet/Annotation/Web/WebImageTest.php index 8d58668e8025..a2788ff39f94 100644 --- a/tests/snippets/Vision/Annotation/Web/WebImageTest.php +++ b/Vision/tests/Snippet/Annotation/Web/WebImageTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Snippets\Vision\Annotation\Web; +namespace Google\Cloud\Vision\Tests\Snippet\Annotation\Web; use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Vision\Annotation\Web\WebImage; diff --git a/tests/snippets/Vision/Annotation/Web/WebPageTest.php b/Vision/tests/Snippet/Annotation/Web/WebPageTest.php similarity index 97% rename from tests/snippets/Vision/Annotation/Web/WebPageTest.php rename to Vision/tests/Snippet/Annotation/Web/WebPageTest.php index 3e29f19bbf33..46807edca1f2 100644 --- a/tests/snippets/Vision/Annotation/Web/WebPageTest.php +++ b/Vision/tests/Snippet/Annotation/Web/WebPageTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Snippets\Vision\Annotation\Web; +namespace Google\Cloud\Vision\Tests\Snippet\Annotation\Web; use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Vision\Annotation\Web\WebPage; diff --git a/tests/snippets/Vision/Annotation/WebTest.php b/Vision/tests/Snippet/Annotation/WebTest.php similarity index 98% rename from tests/snippets/Vision/Annotation/WebTest.php rename to Vision/tests/Snippet/Annotation/WebTest.php index 33714574866f..5417d1960c23 100644 --- a/tests/snippets/Vision/Annotation/WebTest.php +++ b/Vision/tests/Snippet/Annotation/WebTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Snippets\Vision\Annotation; +namespace Google\Cloud\Vision\Tests\Snippet\Annotation; use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Vision\Annotation\Web; diff --git a/tests/snippets/Vision/AnnotationTest.php b/Vision/tests/Snippet/AnnotationTest.php similarity index 99% rename from tests/snippets/Vision/AnnotationTest.php rename to Vision/tests/Snippet/AnnotationTest.php index 900e48c8ed3d..2d35d41de34a 100644 --- a/tests/snippets/Vision/AnnotationTest.php +++ b/Vision/tests/Snippet/AnnotationTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Snippets\Vision; +namespace Google\Cloud\Vision\Tests\Snippet; use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Vision\Annotation; diff --git a/tests/snippets/Vision/ImageTest.php b/Vision/tests/Snippet/ImageTest.php similarity index 98% rename from tests/snippets/Vision/ImageTest.php rename to Vision/tests/Snippet/ImageTest.php index 057c5a898519..262b21c036c7 100644 --- a/tests/snippets/Vision/ImageTest.php +++ b/Vision/tests/Snippet/ImageTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Snippets\Vision; +namespace Google\Cloud\Vision\Tests\Snippet; use Google\Cloud\Core\ServiceBuilder; use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; diff --git a/tests/snippets/Vision/V1/ImageAnnotatorClientTest.php b/Vision/tests/Snippet/V1/ImageAnnotatorClientTest.php similarity index 98% rename from tests/snippets/Vision/V1/ImageAnnotatorClientTest.php rename to Vision/tests/Snippet/V1/ImageAnnotatorClientTest.php index a54af74de124..71576ed5e45e 100644 --- a/tests/snippets/Vision/V1/ImageAnnotatorClientTest.php +++ b/Vision/tests/Snippet/V1/ImageAnnotatorClientTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Snippets\Vision\V1; +namespace Google\Cloud\Vision\Tests\Snippet\V1; use Google\ApiCore\Call; use Google\ApiCore\Transport\TransportInterface; diff --git a/tests/snippets/Vision/VisionClientTest.php b/Vision/tests/Snippet/VisionClientTest.php similarity index 98% rename from tests/snippets/Vision/VisionClientTest.php rename to Vision/tests/Snippet/VisionClientTest.php index f8ba1148c05a..84922e967fa1 100644 --- a/tests/snippets/Vision/VisionClientTest.php +++ b/Vision/tests/Snippet/VisionClientTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\Snippets\Vision; +namespace Google\Cloud\Vision\Tests\Snippet; use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Vision\Annotation; diff --git a/tests/system/Vision/AnnotationsTest.php b/Vision/tests/System/AnnotationsTest.php similarity index 99% rename from tests/system/Vision/AnnotationsTest.php rename to Vision/tests/System/AnnotationsTest.php index 2454ae059499..04651e50d81b 100644 --- a/tests/system/Vision/AnnotationsTest.php +++ b/Vision/tests/System/AnnotationsTest.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\System\Vision; +namespace Google\Cloud\Vision\Tests\System; use Google\Cloud\Vision\Annotation; use Google\Cloud\Vision\Annotation\CropHint; diff --git a/tests/system/Vision/VisionTestCase.php b/Vision/tests/System/VisionTestCase.php similarity index 96% rename from tests/system/Vision/VisionTestCase.php rename to Vision/tests/System/VisionTestCase.php index 13d46c80dd28..06f89203b968 100644 --- a/tests/system/Vision/VisionTestCase.php +++ b/Vision/tests/System/VisionTestCase.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Tests\System\Vision; +namespace Google\Cloud\Vision\Tests\System; use Google\Cloud\Vision\VisionClient; use PHPUnit\Framework\TestCase; diff --git a/Vision/tests/System/bootstrap.php b/Vision/tests/System/bootstrap.php new file mode 100644 index 000000000000..38465605b9a8 --- /dev/null +++ b/Vision/tests/System/bootstrap.php @@ -0,0 +1,5 @@ +add(new Release(__DIR__)); +$app->add(new AddComponent(__DIR__)); +$app->add(new ComponentIntegration(__DIR__)); +$app->add(new Credentials(__DIR__)); $app->add(new Docs(__DIR__)); +$app->add(new Release(__DIR__)); $app->add(new Split(__DIR__)); -$app->add(new AddComponent(__DIR__)); $app->run(); diff --git a/dev/sh/build-docs b/dev/sh/build-docs index 1079b9de9dd6..ffe70971319d 100755 --- a/dev/sh/build-docs +++ b/dev/sh/build-docs @@ -9,7 +9,7 @@ function buildDocs () { if [ -z "$TRAVIS_TAG" ]; then ./dev/google-cloud docs else - ./dev/google-cloud docs -r ${TRAVIS_TAG} + ./dev/google-cloud docs -r fi echo "doc dir after generation:" diff --git a/dev/sh/system-test-credentials b/dev/sh/system-test-credentials deleted file mode 100755 index 07ed8df1b7ca..000000000000 --- a/dev/sh/system-test-credentials +++ /dev/null @@ -1,52 +0,0 @@ -#!/usr/bin/env php -cliBasePath = $cliBasePath; + + parent::__construct(); + } + + protected function configure() + { + $this->setName('integration') + ->setDescription('Test each component individually.'); + } + + protected function execute(InputInterface $input, OutputInterface $output) + { + $this->execute = true; + $this->output = $output; + + $rootPath = dirname($this->cliBasePath); + $manifestPath = $rootPath . DIRECTORY_SEPARATOR . self::MANIFEST_PATH; + + $components = $this->getComponents($rootPath, $rootPath); + + $dest = $rootPath . DIRECTORY_SEPARATOR . self::TESTING_DIR; + $this->tmpDir = $dest; + @mkdir($dest); + + $guzzle = new Client; + + // do setup on components -- copy to tmp directory and check version info + foreach ($components as &$component) { + $tmpDir = $this->copyComponent($rootPath, $dest, $component); + + $localLatestVersion = $this->getComponentVersion($manifestPath, $component['id']); + $remoteLatestVersion = $this->getRemoteLatestVersion($guzzle, $component); + + // If the latest version in the manifest is greater than the latest remote, + // then the component is being updated. + // use semver to normalize both versions. + $isUpdated = version::gt($localLatestVersion, $remoteLatestVersion); + $component['useLocalPath'] = $isUpdated; + $component['tmpDir'] = $tmpDir; + } + + $components = $this->updateComposerFiles($dest, $components); + + // run tests on each component. + foreach ($components as $component) { + if (isset($component['missingDependency']) && $component['missingDependency']) { + $this->output->writeln('Skipping '. $component['id'] .' because a required PHP extension is missing.'); + $this->output->writeln(''); + continue; + } + + $this->testComponent($component); + } + + $this->deleteTmp($dest); + } + + private function copyComponent($rootPath, $dest, array $component) + { + $src = $rootPath . DIRECTORY_SEPARATOR . $component['path']; + $dest = $dest . DIRECTORY_SEPARATOR . $component['id']; + + if (file_exists($dest)) { + $this->deleteTmp($dest); + } + + $this->output->writeln('Creating temp directory for '. $component['id']); + $this->output->writeln('path: '. $dest); + $this->output->writeln(''); + + @mkdir($dest); + $iterator = new \RecursiveIteratorIterator( + new \RecursiveDirectoryIterator($src, \RecursiveDirectoryIterator::SKIP_DOTS), + \RecursiveIteratorIterator::SELF_FIRST + ); + + foreach ($iterator as $item) { + if ($item->isDir()) { + mkdir($dest . DIRECTORY_SEPARATOR . $iterator->getSubPathName()); + } else { + copy($item, $dest . DIRECTORY_SEPARATOR . $iterator->getSubPathName()); + } + } + + return $dest; + } + + private function deleteTmp($path) + { + $this->output->writeln('Deleting '. $path); + $this->output->writeln(''); + + if (!strpos($this->tmpDir, $path) === false) { + throw new \RuntimeException('cannot delete files outside test root path.'); + } + + passthru('rm -rf '. $path); + } + + private function getRemoteLatestVersion(Client $guzzle, array $component) + { + $target = str_replace('.git', '', trim($component['target'], '/')); + + $uri = 'https://api.github.com/repos/'. $target .'/releases/latest'; + if (getenv('GH_OAUTH_TOKEN')) { + $uri .= '?access_token='. getenv('GH_OAUTH_TOKEN'); + } + + $res = $guzzle->get($uri); + + $release = json_decode((string) $res->getBody(), true); + + if (!isset($release['tag_name'])) { + throw new \RuntimeException('Unexpected response from '. $uri); + } + + return $release['tag_name']; + } + + private function updateComposerFiles($tmpDir, array $components) + { + $repositories = []; + $aliases = []; + + foreach ($components as $component) { + if (!$component['useLocalPath']) { + continue; + } + + $repositories[] = [ + 'type' => 'path', + 'url' => '../'. $component['id'] + ]; + + $aliases[] = $component['id']; + } + + foreach ($components as &$component) { + $composerFile = $component['tmpDir'] . DIRECTORY_SEPARATOR .'composer.json'; + $composer = json_decode(file_get_contents($composerFile), true); + if (json_last_error() !== JSON_ERROR_NONE) { + throw new \RuntimeException('Could not decode composer file '. $composerFile); + } + + foreach ($aliases as $alias) { + $id = $component['id']; + if ( + !in_array($id, $aliases) && ( + array_key_exists('google/'. $alias, $composer['require']) || + array_key_exists('google/'. $alias, $composer['require-dev']) + )) { + $aliases[] = $id; + + $repositories[] = [ + 'type' => 'path', + 'url' => '../'. $component['id'] + ]; + } + } + + $component['missingDependency'] = false; + foreach ($composer['require'] as $require => $version) { + if (strpos($require, 'ext-') === 0) { + $ext = str_replace('ext-', '', $require); + if (!extension_loaded($ext)) { + $component['missingDependency'] = true; + continue; + } + } + } + } + + foreach ($components as $component) { + $composerFile = $component['tmpDir'] . DIRECTORY_SEPARATOR .'composer.json'; + $this->modifyComposerFile($composerFile, $repositories, $aliases); + } + + return $components; + } + + private function testComponent(array $component) + { + $this->output->writeln('Testing component '. $component['id'] .''); + $this->output->writeln(''); + $commands = [ + "cd {$component['tmpDir']}", + "composer update --no-suggest", + "echo \"\\nRUNNING UNIT TESTS\\n\"", + "vendor/bin/phpunit", + "echo \"\\nRUNNING SNIPPET TESTS\\n\"", + "vendor/bin/phpunit -c phpunit-snippets.xml.dist" + ]; + + passthru(implode(" && ", $commands), $exitCode); + + if ($exitCode !== 0) { + throw new \RuntimeException('Testing '. $component['id'] .' exited with a non-zero code'); + } + + $this->output->writeln(''); + } + + private function modifyComposerFile($composerFile, array $repositories, array $aliases) + { + $composer = json_decode(file_get_contents($composerFile), true); + if (json_last_error() !== JSON_ERROR_NONE) { + throw new \RuntimeException('Could not decode composer file '. $composerFile); + } + + foreach ($aliases as $alias) { + if (isset($composer['require']['google/'. $alias])) { + $composer['require']['google/'. $alias] = "@dev"; + } + + if (isset($composer['require-dev']['google/'. $alias])) { + $composer['require-dev']['google/'. $alias] = "@dev"; + } + } + + $oldRepositories = isset($composer['repositories']) + ? $composer['repositories'] + : []; + + $composer['repositories'] = array_merge($oldRepositories, $repositories); + + file_put_contents($composerFile, json_encode($composer, JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES)); + } +} diff --git a/dev/src/Credentials/Command.php b/dev/src/Credentials/Command.php new file mode 100644 index 000000000000..3367f14fe438 --- /dev/null +++ b/dev/src/Credentials/Command.php @@ -0,0 +1,84 @@ +cliBasePath = $cliBasePath; + + parent::__construct(); + } + + protected function configure() + { + $this->setName('credentials') + ->setDescription('Configure credentials for system tests') + ->setHelp(file_get_contents(__DIR__ .'/help.txt')); + } + + protected function execute(InputInterface $input, OutputInterface $output) + { + $base = realpath($this->cliBasePath .'/../'); + + $keyfiles = getenv('GOOGLE_CLOUD_PHP_KEYFILES'); + $decoded = json_decode(base64_decode($keyfiles), true); + if (!$keyfiles || json_last_error() !== JSON_ERROR_NONE) { + $output->writeln('You must specify `GOOGLE_CLOUD_PHP_KEYFILES` as a base64-encoded json array of keyfile names.'); + return; + } + + foreach ($decoded as $kf) { + $err = false; + + $data = base64_decode(getenv($kf . '_ENCODED'), true); + if (json_last_error() !== JSON_ERROR_NONE) { + $output->writeln('Required environment variable `' . $kf . '_ENCODED` not set or invalid!'); + return; + } else { + $output->writeln('Found valid json at environment variable `' . $kf .'`'); + } + + $dir = $base . '/keys/'; + $path = $dir . $kf .'.json'; + + if (!file_exists($dir)) { + mkdir($dir); + } + + if (file_put_contents($path, $data) !== false) { + $output->writeln('Wrote keyfile contents to file `' . realpath($path) . '`'); + } else { + $output->writeln('Could not write to file'); + return; + } + } + + $output->writeln('Credentials configured!'); + } +} diff --git a/dev/src/Credentials/help.txt b/dev/src/Credentials/help.txt new file mode 100644 index 000000000000..f5339dbdbc9d --- /dev/null +++ b/dev/src/Credentials/help.txt @@ -0,0 +1,7 @@ +This command reads keyfile data from the environment and generates on-disk keyfiles. + +This command relies on environment variables which must be set prior to running this command. + +1. `GOOGLE_CLOUD_PHP_KEYFILES` is a base64-encoded, json-encoded list of keyfiles to load. For instance, if you only need a single keyfile to run system tests, this environment variable should be the value of `base64_encode(json_encode(['KEYFILE_NAME']))`. +2. `_ENCODED` is a base64-encoded, json-encoded keyfile. There must be one environment variable corresponding to each member of `GOOGLE_CLOUD_PHP_KEYFILES` and it must contain the keyfile in its expected format. + diff --git a/dev/src/DocGenerator/Command/Docs.php b/dev/src/DocGenerator/Command/Docs.php index f4609b8a44a3..db3211c599da 100644 --- a/dev/src/DocGenerator/Command/Docs.php +++ b/dev/src/DocGenerator/Command/Docs.php @@ -17,8 +17,10 @@ namespace Google\Cloud\Dev\DocGenerator\Command; +use Google\Cloud\Core\Testing\FileListFilterIterator; use Google\Cloud\Dev\DocGenerator\DocGenerator; use Google\Cloud\Dev\DocGenerator\GuideGenerator; +use Google\Cloud\Dev\DocGenerator\RegexFileFilter; use Google\Cloud\Dev\DocGenerator\TableOfContents; use Google\Cloud\Dev\DocGenerator\TypeGenerator; use Google\Cloud\Dev\GetComponentsTrait; @@ -40,13 +42,22 @@ class Docs extends Command const TOC_SOURCE_DIR = 'docs/contents'; const TOC_TEMPLATE = 'docs/toc.json'; const OVERVIEW_FILE = 'docs/overview.html'; - const DEFAULT_SOURCE_DIR = 'src'; + const DEFAULT_SOURCE_DIR = ''; private $cliBasePath; + private $testPaths = [ + 'tests/Unit', + 'tests/Snippet', + 'tests/System', + 'tests/Conformance', + 'tests/Perf', + 'tests/conformance-fixtures' + ]; + public function __construct($cliBasePath) { - $this->cliBasePath = $cliBasePath; + $this->cliBasePath = realpath($cliBasePath); parent::__construct(); } @@ -55,19 +66,18 @@ protected function configure() { $this->setName('docs') ->setDescription('Generate Documentation') - ->addOption('release', 'r', InputOption::VALUE_REQUIRED, 'If set, docs will be generated into tag folders' . - ' such as v1.0.0 rather than master.', false) - ->addOption('pretty', 'p', InputOption::VALUE_OPTIONAL, 'If set, json files will be written with pretty'. - ' formatting using PHP\'s JSON_PRETTY_PRINT flag', false); + ->addOption('release', 'r', InputOption::VALUE_NONE, 'If set, docs will be generated into tag folders' . + ' such as v1.0.0 rather than master.') + ->addOption('pretty', 'p', InputOption::VALUE_NONE, 'If set, json files will be written with pretty'. + ' formatting using PHP\'s JSON_PRETTY_PRINT flag') + ->addOption('component', 'c', InputOption::VALUE_OPTIONAL, 'Generate docs only for a single component.'); } protected function execute(InputInterface $input, OutputInterface $output) { - $release = ($input->getOption('release') === false && $input->getOption('release') !== 'false') - ? null - : $input->getOption('release'); - - $pretty = ($input->getOption('pretty') === false) ? false : true; + $release = $input->getOption('release'); + $pretty = $input->getOption('pretty'); + $component = $input->getOption('component'); $paths = [ 'source' => $this->cliBasePath .'/../'. self::DEFAULT_SOURCE_DIR, @@ -78,13 +88,67 @@ protected function execute(InputInterface $input, OutputInterface $output) 'tocTemplate' => $this->cliBasePath .'/../'. self::TOC_TEMPLATE, 'overview' => $this->cliBasePath .'/../'. self::OVERVIEW_FILE ]; + $commonExcludes = [ + '.github', + 'tests', + 'CONTRIBUTING.md', + 'bootstrap.php' + ]; - $components = $this->getComponents($paths['source']); + $components = $this->getComponents(dirname($this->cliBasePath), $paths['source']); $tocTemplate = json_decode(file_get_contents($paths['tocTemplate']), true); - foreach ($components as $component) { - $input = $paths['project'] . $component['path']; - $source = $this->getFilesList($input); + if ($component !== 'google-cloud') { + if ($component) { + $components = array_filter($components, function ($componentInfo) use ($component) { + return $componentInfo['id'] === $component; + }); + + if (!$components) { + throw new \RuntimeException(sprintf('Given component ID %s does not exist', $component)); + } + } + + foreach ($components as $comp) { + $input = $paths['project'] . $comp['path']; + $source = $this->getFilesList( + $input, + ['php', 'md'], + $commonExcludes + ); + $this->generateComponentDocumentation( + $output, + $source, + $comp, + $paths, + $tocTemplate, + $release, + $pretty + ); + } + } + + if (!$component || $component === 'google-cloud') { + $projectRealPath = realpath($paths['project']); + $source = $this->getFilesList( + $projectRealPath, + ['php', 'md'], + array_merge($commonExcludes, [ + '/vendor', + '/dev', + '/build', + '/docs', + '/tests', + '/CODE_OF_CONDUCT.md', + '/README.md', + ]) + ); + + $component = [ + 'id' => 'google-cloud', + 'path' => '' + ]; + $this->generateComponentDocumentation( $output, $source, @@ -92,26 +156,10 @@ protected function execute(InputInterface $input, OutputInterface $output) $paths, $tocTemplate, $release, - $pretty + $pretty, + false ); } - - $source = $this->getFilesList($paths['project'] . '/src'); - $component = [ - 'id' => 'google-cloud', - 'path' => 'src/' - ]; - - $this->generateComponentDocumentation( - $output, - $source, - $component, - $paths, - $tocTemplate, - $release, - $pretty, - false - ); } private function generateComponentDocumentation( @@ -172,15 +220,32 @@ private function generateComponentDocumentation( $output->writeln(' '); } - private function getFilesList($source) + /** + * @param string $source The base directory to iterate. + * @param string[] $types A list of file extensions to include. Do not + * include the leading dot. + * @param string[] $excludes A list of directories or patterns to exclude. + * If the string begins with a forward-slash it will be treated as an + * absolute file path. Otherwise, the given string will be checked + * for existence in the absolute file path and excluded if it is + * found. (in other words, `strpos($exclude, $path) !== false`.) + * @return string[] A list of absolute paths to included files. + */ + private function getFilesList($source, array $types, array $excludes = []) { $directoryIterator = new RecursiveDirectoryIterator($source); $iterator = new RecursiveIteratorIterator($directoryIterator); - $regexIterator = new RegexIterator($iterator, '/^.+\.php|^.+\.md$/i', RecursiveRegexIterator::GET_MATCH); + $fileList = new FileListFilterIterator( + realpath($this->cliBasePath .'/../'), + $iterator, + $types, + $this->testPaths, + $excludes + ); $files = []; - foreach ($regexIterator as $item) { - array_push($files, $item[0]); + foreach ($fileList as $item) { + array_push($files, realPath($item->getPathName())); } return $files; diff --git a/dev/src/DocGenerator/DocGenerator.php b/dev/src/DocGenerator/DocGenerator.php index f681a499edf8..70fa16f5f0fc 100644 --- a/dev/src/DocGenerator/DocGenerator.php +++ b/dev/src/DocGenerator/DocGenerator.php @@ -66,13 +66,15 @@ public function __construct( public function generate($basePath, $pretty) { $fileReflectorRegister = new ReflectorRegister(); + + $rootPath = realpath(dirname($this->executionPath)); foreach ($this->files as $file) { + $currentFileArr = $this->isComponent + ? explode("/$basePath/", $file) + : explode("$rootPath/", $file); - if ($basePath) { - $currentFileArr = explode($basePath, trim($file, '/')); - if (isset($currentFileArr[1])) { - $currentFile = trim($currentFileArr[1], '/'); - } + if (isset($currentFileArr[1])) { + $currentFile = str_replace('src/', '', $currentFileArr[1]); } $isPhp = strrpos($file, '.php') == strlen($file) - strlen('.php'); @@ -88,13 +90,8 @@ public function generate($basePath, $pretty) $this->isComponent ); } else { - if (strpos($file, '.github') !== false) { - continue; - } - $content = file_get_contents($file); - $split = explode('src/', $file); - $parser = new MarkdownParser($split[1], $content); + $parser = new MarkdownParser($currentFile, $content); } $document = $parser->parse(); diff --git a/dev/src/DocGenerator/Parser/CodeParser.php b/dev/src/DocGenerator/Parser/CodeParser.php index 65aeb6283f28..da6d18b3681a 100644 --- a/dev/src/DocGenerator/Parser/CodeParser.php +++ b/dev/src/DocGenerator/Parser/CodeParser.php @@ -166,18 +166,13 @@ private function buildMethodInfo($fileReflector, $reflector) } $methods[$name] = [ 'methodReflector' => $method, - 'source' => $this->getPath($fileReflector), + 'source' => $fileReflector->getFileName(), 'container' => $reflector->getName(), ]; } return $methods; } - private function getPath($fileReflector) - { - return 'src' . trim(explode('src', $fileReflector->getFileName())[1]); - } - private function buildDocument($fileReflector, $reflector) { $name = $reflector->getShortName(); @@ -200,7 +195,7 @@ private function buildDocument($fileReflector, $reflector) } if (is_null($docBlock)) { - throw new \Exception(sprintf('%s has no description', $fullName)); + throw new \Exception(sprintf('%s has no description (%s)', $fullName, $fileReflector->getFilename())); } $split = $this->splitDescription($docBlock->getText()); @@ -407,7 +402,7 @@ private function buildMethod($method, $methodInfo, $className) 'id' => $method->getName(), 'type' => $method->getName() === '__construct' ? 'constructor' : 'instance', 'name' => $method->getName(), - 'source' => $methodInfo['source'] . '#L' . $method->getLineNumber(), + 'source' => $this->getSource($methodInfo['source']) . '#L' . $method->getLineNumber(), 'description' => $description, 'examples' => $this->buildExamples($split['examples']), 'resources' => $this->buildResources($resources), @@ -439,7 +434,7 @@ private function buildMagicMethod($magicMethod) 'id' => $magicMethod->getMethodName(), 'type' => $magicMethod->getMethodName() === '__construct' ? 'constructor' : 'instance', 'name' => $magicMethod->getMethodName(), - 'source' => $this->getSource(), + 'source' => $this->getSource($this->path), 'description' => $this->buildDescription($docBlock, $docText, $magicMethod), 'examples' => $this->buildExamples($examples), 'resources' => $this->buildResources($resources), @@ -698,7 +693,10 @@ private function hasInternalType($type) $matches = []; preg_match(self::CLASS_TYPE_REGEX, $type, $matches); $type = $matches[1]; - $file = $this->projectRoot . '/src' . str_replace('\\', '/', substr($type, 12)) . '.php'; + $parts = explode('/', str_replace('\\', '/', substr($type, 13))); + array_splice($parts, 1, 0, 'src'); + $file = $this->projectRoot . '/' . implode('/', $parts) . '.php'; + return file_exists($file); } @@ -830,8 +828,22 @@ private function isComponent($composerPath) return false; } - private function getSource() + private function getSource($path) { - return 'src' . explode('src', $this->path)[1]; + $filePieces = explode('/', $path); + + $srcIdx = []; + array_walk($filePieces, function ($piece, $i) use (&$srcIdx) { + if ($piece === 'src') { + $srcIdx[] = $i; + } + }); + + // Just in case you're running inside a different src directory... + $realSrcIndex = end($srcIdx); + + $base = $realSrcIndex - 1; + + return implode('/', array_slice($filePieces, $base)); } } diff --git a/dev/src/DocGenerator/Parser/MarkdownParser.php b/dev/src/DocGenerator/Parser/MarkdownParser.php index 058dba85bbfe..65c0bc89adce 100644 --- a/dev/src/DocGenerator/Parser/MarkdownParser.php +++ b/dev/src/DocGenerator/Parser/MarkdownParser.php @@ -31,18 +31,31 @@ public function __construct($currentFile, $content) $this->currentFile = $currentFile; $this->content = $content; $this->markdown = Parsedown::instance(); + + set_error_handler(function($number, $error){ + if (preg_match('/^DOMDocument::loadHTML\(\): (.+)$/', $error, $m) === 1) { + throw new \Exception($m[1]); + } + }); } public function parse() { $html = $this->markdown->parse($this->content); - $doc = new DOMDocument; - $doc->loadHTML($html); + try { + $doc = new DOMDocument; + $doc->loadHTML($html); + } catch (\Exception $e) { + throw new \RuntimeException($e->getMessage() .' ('. $this->currentFile .')'); + } $headings = $doc->getElementsByTagName('h1'); $heading = $headings->item(0); + if (!$heading) { + throw new \RuntimeException('Missing h1 tag ('. $this->currentFile .')'); + } $heading->parentNode->removeChild($heading); $pathinfo = pathinfo($this->currentFile); diff --git a/dev/src/DocGenerator/RegexFileFilter.php b/dev/src/DocGenerator/RegexFileFilter.php new file mode 100644 index 000000000000..5f8037e31aa8 --- /dev/null +++ b/dev/src/DocGenerator/RegexFileFilter.php @@ -0,0 +1,31 @@ +regex = $regex; + } +} diff --git a/dev/src/DocGenerator/Writer.php b/dev/src/DocGenerator/Writer.php index f2c22e458b63..76285580db37 100644 --- a/dev/src/DocGenerator/Writer.php +++ b/dev/src/DocGenerator/Writer.php @@ -38,9 +38,11 @@ public function write($currentFile) @mkdir(dirname($path), 0777, true); } - $content = ($this->pretty) - ? json_encode($this->content, JSON_PRETTY_PRINT) - : json_encode($this->content); + $options = $this->pretty + ? JSON_PRETTY_PRINT + : 0; + + $content = json_encode($this->content, $options); file_put_contents($path, $content); } diff --git a/dev/src/GetComponentsTrait.php b/dev/src/GetComponentsTrait.php index 3efa11290fe5..ffe73f9186fd 100644 --- a/dev/src/GetComponentsTrait.php +++ b/dev/src/GetComponentsTrait.php @@ -24,8 +24,13 @@ trait GetComponentsTrait /** * If $defaultComposerPath is set, it will parse that path as a composer * file and add it to the components. + * + * @param string $libraryRootPath The root path of the library. + * @param string $componentsPath The base path, under which composer.json files will be discovered. + * @param string|null $defaultComposerPath If set, this path will be included as a component. + * @return array Component data. */ - private function getComponents($componentsPath, $defaultComposerPath = null) + private function getComponents($libraryRootPath, $componentsPath, $defaultComposerPath = null) { $files = glob($componentsPath .'/*/composer.json'); @@ -35,20 +40,18 @@ private function getComponents($componentsPath, $defaultComposerPath = null) $components = []; foreach ($files as $file) { + $file = realpath($file); $json = json_decode(file_get_contents($file), true); - $path = explode('src', $file); + $path = trim(str_replace($libraryRootPath, '', $file), '/'); + $component = $json['extra']['component']; $component['name'] = $json['name']; if (!isset($component['displayName'])) { $component['displayName'] = $json['name']; } - if (count($path) > 1) { - $component['prefix'] = dirname('src' . $path[1]); - } else { - $component['prefix'] = ''; - } + $component['prefix'] = dirname($path); $components[] = $component; } @@ -56,29 +59,61 @@ private function getComponents($componentsPath, $defaultComposerPath = null) return $components; } + /** + * Get the latest version for a given component. + * + * @param string $manifestPath The path to the manifest. + * @param string $componentId The component ID to fetch a version from. + * @return string + */ private function getComponentVersion($manifestPath, $componentId) { $manifest = $this->getComponentManifest($manifestPath, $componentId); return $manifest['versions'][0]; } + /** + * Return manifest data for the given component. + * + * @param string $manifestPath The path to the manifest. + * @param string $componentId The component ID to fetch. + * @return array + */ private function getComponentManifest($manifestPath, $componentId) { $manifest = $this->getManifest($manifestPath); - $index = $this->getManifestComponentModuleIndex($manifestPath, $manifest, $componentId); + $index = $this->getManifestComponentModuleIndex($manifest, $componentId); return $manifest['modules'][$index]; } - private function getManifestComponentModuleIndex($manifestPath, array $manifest, $componentId) + /** + * Get the manifest component index. + * + * @param string|array $manifest If a string, the path to the manifest. If + * an array, the manifest contents. + * @param string $componentId The component ID to fetch + * @return int + */ + private function getManifestComponentModuleIndex($manifest, $componentId) { - $modules = array_filter($this->getManifest($manifestPath)['modules'], function ($module) use ($componentId) { + $manifest = is_array($manifest) + ? $manifest + : $this->getManifest($manifest); + + $modules = array_filter($manifest['modules'], function ($module) use ($componentId) { return ($module['id'] === $componentId); }); return array_keys($modules)[0]; } + /** + * Read the given file as a package manifest. + * + * @param string $manifestPath + * @return array + */ private function getManifest($manifestPath) { if (self::$__manifest) { @@ -96,9 +131,23 @@ private function getManifest($manifestPath) return $manifest; } - private function getComponentComposer($componentId) + /** + * Get the composer.json data for a given component. + * + * @param string $componentId + * @return array + */ + private function getComponentComposer($libraryRootPath, $componentId) { - $components = $this->getComponents($this->components, $this->defaultComponentComposer); + $defaultComposerPath = isset($this->defaultComponentComposer) + ? $this->defaultComponentComposer + : null; + + $componentsDir = isset($this->components) + ? $this->components + : $libraryRootPath; + + $components = $this->getComponents($libraryRootPath, $componentsDir, $defaultComposerPath); $components = array_values(array_filter($components, function ($component) use ($componentId) { return ($component['id'] === $componentId); diff --git a/dev/src/Release/Command/Release.php b/dev/src/Release/Command/Release.php index 56bb015fd7b9..d16edf2833e5 100644 --- a/dev/src/Release/Command/Release.php +++ b/dev/src/Release/Command/Release.php @@ -22,7 +22,6 @@ use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; -use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; use vierbergenlars\SemVer\version; @@ -30,7 +29,7 @@ class Release extends Command { use GetComponentsTrait; - const COMPONENT_BASE = '%s/../src'; + const COMPONENT_BASE = '%s/../'; const DEFAULT_COMPONENT = 'google-cloud'; const DEFAULT_COMPONENT_COMPOSER = '%s/../composer.json'; const PATH_MANIFEST = '%s/../docs/manifest.json'; @@ -63,18 +62,13 @@ protected function configure() $this->setName('release') ->setDescription('Prepares a new release') ->addArgument('version', InputArgument::REQUIRED, 'The new version number.') - ->addOption( - 'component', - 'c', - InputOption::VALUE_REQUIRED, - 'The component for which the version should be updated.', - self::DEFAULT_COMPONENT - ); + ->addArgument('component', InputArgument::OPTIONAL, '[optional] The component ID. Defaults to `google-cloud`.'); } protected function execute(InputInterface $input, OutputInterface $output) { - $component = $this->getComponentComposer($input->getOption('component')); + $componentInput = $input->getArgument('component') ?: self::DEFAULT_COMPONENT; + $component = $this->getComponentComposer(dirname($this->cliBasePath), $componentInput); $version = $input->getArgument('version'); @@ -162,7 +156,7 @@ private function getNextVersionName($type, array $component) private function addToComponentManifest($version, array $component) { $manifest = $this->getManifest($this->manifest); - $index = $this->getManifestComponentModuleIndex($this->manifest, $manifest, $component['id']); + $index = $this->getManifestComponentModuleIndex($manifest, $component['id']); array_unshift($manifest['modules'][$index]['versions'], 'v'. $version); diff --git a/dev/src/Split/Command/Split.php b/dev/src/Split/Command/Split.php index 6959e6985ac7..12f398a84373 100644 --- a/dev/src/Split/Command/Split.php +++ b/dev/src/Split/Command/Split.php @@ -33,7 +33,7 @@ class Split extends Command const TAG_ENV = 'TRAVIS_TAG'; const TARGET_REGEX = '/([a-zA-Z0-9-_]{1,})\/([a-zA-Z0-9-_]{1,})\.git/'; - const COMPONENT_BASE = '%s/../src'; + const COMPONENT_BASE = '%s/../'; const SPLIT_SHELL = '%s/sh/split'; const PATH_MANIFEST = '%s/../docs/manifest.json'; const PARENT_TAG_NAME = 'https://github.com/GoogleCloudPlatform/google-cloud-php/releases/tag/%s'; @@ -55,7 +55,7 @@ class Split extends Command public function __construct($cliBasePath) { - $this->cliBasePath = $cliBasePath; + $this->cliBasePath = realpath($cliBasePath); $this->splitShell = sprintf(self::SPLIT_SHELL, $cliBasePath); $this->components = sprintf(self::COMPONENT_BASE, $cliBasePath); $this->manifest = sprintf(self::PATH_MANIFEST, $cliBasePath); @@ -79,7 +79,7 @@ protected function execute(InputInterface $input, OutputInterface $output) return; } - $components = $this->getComponents($this->components); + $components = $this->getComponents(dirname($this->cliBasePath), $this->components); $tag = getenv(self::TAG_ENV); diff --git a/docs/contents/cloud-bigtable.json b/docs/contents/cloud-bigtable.json index 5d8287d146b4..472d6d93658f 100644 --- a/docs/contents/cloud-bigtable.json +++ b/docs/contents/cloud-bigtable.json @@ -2,7 +2,7 @@ "title": "Bigtable", "pattern": "bigtable\/\\w{1,}", "services": [{ - "title": "BigtableClient", + "title": "Overview", "type": "bigtable/readme" }, { "title": "v2", diff --git a/docs/contents/google-cloud.json b/docs/contents/google-cloud.json index f2dba7bd7ed1..62c4cbd4ae53 100644 --- a/docs/contents/google-cloud.json +++ b/docs/contents/google-cloud.json @@ -8,6 +8,7 @@ ], "includes": [ "cloud-bigquery", + "cloud-bigtable", "cloud-container", "cloud-core", "cloud-dataproc", diff --git a/phpcs-ruleset.xml b/phpcs-ruleset.xml index 1f7d13c8f1a4..05e4ff4add13 100644 --- a/phpcs-ruleset.xml +++ b/phpcs-ruleset.xml @@ -2,13 +2,22 @@ - src/*/V[0-9]+ + */src/V[0-9]+ + */src/*/V[0-9]+ + */src/*/*/V[0-9]+ - src/Storage/StreamWrapper.php + Storage/src/StreamWrapper.php - src/Core/Testing/Lock/MockValues.php + Core/src/Testing/Lock/MockValues.php - src + . + Core/src/Testing + */tests + vendor + tests + dev + docs + diff --git a/phpunit-conformance.xml.dist b/phpunit-conformance.xml.dist index 9e8ee84d7cea..a6e8a9e175d3 100644 --- a/phpunit-conformance.xml.dist +++ b/phpunit-conformance.xml.dist @@ -1,15 +1,20 @@ - + - tests/conformance + */tests/Conformance + */src src - src/*/V[!a-zA-Z]* + */src/V[!a-zA-Z]* + */src/*/V[!a-zA-Z]* + */src/*/*/V[!a-zA-Z]* + Core/src/Testing + dev diff --git a/phpunit-perf.xml.dist b/phpunit-perf.xml.dist index 576e4cdaf7d8..5627d63242e9 100644 --- a/phpunit-perf.xml.dist +++ b/phpunit-perf.xml.dist @@ -1,15 +1,14 @@ - + - tests/perf + */tests/Perf - src - src/*/V[!a-zA-Z]* + */src/V[!a-zA-Z]* diff --git a/phpunit-snippets.xml.dist b/phpunit-snippets.xml.dist index 6a3529b5faff..656a09e9e834 100644 --- a/phpunit-snippets.xml.dist +++ b/phpunit-snippets.xml.dist @@ -1,15 +1,24 @@ - + - tests/snippets + */tests/Snippet + */src src - src/*/V[!a-zA-Z]* + */src/V[!a-zA-Z]* + */src/*/V[!a-zA-Z]* + */src/*/*/V[!a-zA-Z]* + Core/src/Testing + dev diff --git a/phpunit-system.xml.dist b/phpunit-system.xml.dist index fe00c67b1d96..04ad0a574ace 100644 --- a/phpunit-system.xml.dist +++ b/phpunit-system.xml.dist @@ -1,15 +1,21 @@ - + - tests/system + */tests/System + tests/System + */src src - src/*/V[!a-zA-Z]* + */src/V[!a-zA-Z]* + */src/*/V[!a-zA-Z]* + */src/*/*/V[!a-zA-Z]* + Core/src/Testing + dev diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 443b0c12f1e3..270f49ac819e 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,18 +1,21 @@ - + - tests/unit + */tests/Unit + ./tests/Unit + */src src - src/*/V[!a-zA-Z]* - src/*/*/V[!a-zA-Z]* - src/*/*/*/V[!a-zA-Z]* - src/Core/Testing + */src/V[!a-zA-Z]* + */src/*/V[!a-zA-Z]* + */src/*/*/V[!a-zA-Z]* + Core/src/Testing + dev diff --git a/src/Core/Testing/TestHelpers.php b/src/Core/Testing/TestHelpers.php deleted file mode 100644 index 30daac61e6ea..000000000000 --- a/src/Core/Testing/TestHelpers.php +++ /dev/null @@ -1,92 +0,0 @@ -newInstanceArgs($args); - } - - /** - * Get a trait implementation. - * - * @param string $trait The fully-qualified name of the trait to implement. - * @return mixed - * - * @experimental - * @internal - */ - public static function impl($trait, array $props = []) - { - $properties = []; - foreach ($props as $prop) { - $properties[] = 'private $' . $prop . ';'; - } - - $tpl = 'class %s { - use %s; - use \Google\Cloud\Core\Testing\StubTrait; - private $___props = \'%s\'; - %s - public function call($fn, array $args = []) { return call_user_func_array([$this, $fn], $args); } - }'; - - $name = 'Trait' . sha1($trait . json_encode($props)); - - if (!class_exists($name)) { - eval(sprintf($tpl, $name, $trait, json_encode($props), implode("\n", $properties))); - } - - return new $name; - } -} diff --git a/src/Datastore/.github/pull_request_template.md b/src/Datastore/.github/pull_request_template.md deleted file mode 100644 index bd8c2798fb75..000000000000 --- a/src/Datastore/.github/pull_request_template.md +++ /dev/null @@ -1,24 +0,0 @@ -**PLEASE READ THIS ENTIRE MESSAGE** - -Hello, and thank you for your contribution! Please note that this repository is -a read-only split of `GoogleCloudPlatform/google-cloud-php`. As such, we are -unable to accept pull requests to this repository. - -We welcome your pull request and would be happy to consider it for inclusion in -our library if you follow these steps: - -* Clone the parent client library repository: - -```sh -$ git clone git@github.com:GoogleCloudPlatform/google-cloud-php.git -``` - -* Move your changes into the correct location in that library. Library code -belongs in `src/Datastore`, and tests in `tests/*/Datastore`. - -* Push the changes in a new branch to a fork, and open a new pull request -[here](https://github.com/GoogleCloudPlatform/google-cloud-php). - -Thanks again, and we look forward to seeing your proposed change! - -The Google Cloud PHP team diff --git a/src/Debugger/.github/pull_request_template.md b/src/Debugger/.github/pull_request_template.md deleted file mode 100644 index aaa05829e46b..000000000000 --- a/src/Debugger/.github/pull_request_template.md +++ /dev/null @@ -1,24 +0,0 @@ -**PLEASE READ THIS ENTIRE MESSAGE** - -Hello, and thank you for your contribution! Please note that this repository is -a read-only split of `GoogleCloudPlatform/google-cloud-php`. As such, we are -unable to accept pull requests to this repository. - -We welcome your pull request and would be happy to consider it for inclusion in -our library if you follow these steps: - -* Clone the parent client library repository: - -```sh -$ git clone git@github.com:GoogleCloudPlatform/google-cloud-php.git -``` - -* Move your changes into the correct location in that library. Library code -belongs in `src/Debugger`, and tests in `tests/*/Debugger`. - -* Push the changes in a new branch to a fork, and open a new pull request -[here](https://github.com/GoogleCloudPlatform/google-cloud-php). - -Thanks again, and we look forward to seeing your proposed change! - -The Google Cloud PHP team diff --git a/src/ErrorReporting/.github/pull_request_template.md b/src/ErrorReporting/.github/pull_request_template.md deleted file mode 100644 index 45084e014f6d..000000000000 --- a/src/ErrorReporting/.github/pull_request_template.md +++ /dev/null @@ -1,24 +0,0 @@ -**PLEASE READ THIS ENTIRE MESSAGE** - -Hello, and thank you for your contribution! Please note that this repository is -a read-only split of `GoogleCloudPlatform/google-cloud-php`. As such, we are -unable to accept pull requests to this repository. - -We welcome your pull request and would be happy to consider it for inclusion in -our library if you follow these steps: - -* Clone the parent client library repository: - -```sh -$ git clone git@github.com:GoogleCloudPlatform/google-cloud-php.git -``` - -* Move your changes into the correct location in that library. Library code -belongs in `src/ErrorReporting`, and tests in `tests/*/ErrorReporting`. - -* Push the changes in a new branch to a fork, and open a new pull request -[here](https://github.com/GoogleCloudPlatform/google-cloud-php). - -Thanks again, and we look forward to seeing your proposed change! - -The Google Cloud PHP team diff --git a/src/Firestore/.github/pull_request_template.md b/src/Firestore/.github/pull_request_template.md deleted file mode 100644 index c7d12449e986..000000000000 --- a/src/Firestore/.github/pull_request_template.md +++ /dev/null @@ -1,24 +0,0 @@ -**PLEASE READ THIS ENTIRE MESSAGE** - -Hello, and thank you for your contribution! Please note that this repository is -a read-only split of `GoogleCloudPlatform/google-cloud-php`. As such, we are -unable to accept pull requests to this repository. - -We welcome your pull request and would be happy to consider it for inclusion in -our library if you follow these steps: - -* Clone the parent client library repository: - -```sh -$ git clone git@github.com:GoogleCloudPlatform/google-cloud-php.git -``` - -* Move your changes into the correct location in that library. Library code -belongs in `src/Firestore`, and tests in `tests/*/Firestore`. - -* Push the changes in a new branch to a fork, and open a new pull request -[here](https://github.com/GoogleCloudPlatform/google-cloud-php). - -Thanks again, and we look forward to seeing your proposed change! - -The Google Cloud PHP team diff --git a/src/Language/.github/pull_request_template.md b/src/Language/.github/pull_request_template.md deleted file mode 100644 index c78ebc7f32f1..000000000000 --- a/src/Language/.github/pull_request_template.md +++ /dev/null @@ -1,24 +0,0 @@ -**PLEASE READ THIS ENTIRE MESSAGE** - -Hello, and thank you for your contribution! Please note that this repository is -a read-only split of `GoogleCloudPlatform/google-cloud-php`. As such, we are -unable to accept pull requests to this repository. - -We welcome your pull request and would be happy to consider it for inclusion in -our library if you follow these steps: - -* Clone the parent client library repository: - -```sh -$ git clone git@github.com:GoogleCloudPlatform/google-cloud-php.git -``` - -* Move your changes into the correct location in that library. Library code -belongs in `src/Language`, and tests in `tests/*/Language`. - -* Push the changes in a new branch to a fork, and open a new pull request -[here](https://github.com/GoogleCloudPlatform/google-cloud-php). - -Thanks again, and we look forward to seeing your proposed change! - -The Google Cloud PHP team diff --git a/src/Monitoring/.github/pull_request_template.md b/src/Monitoring/.github/pull_request_template.md deleted file mode 100644 index 0f98b5e0223c..000000000000 --- a/src/Monitoring/.github/pull_request_template.md +++ /dev/null @@ -1,24 +0,0 @@ -**PLEASE READ THIS ENTIRE MESSAGE** - -Hello, and thank you for your contribution! Please note that this repository is -a read-only split of `GoogleCloudPlatform/google-cloud-php`. As such, we are -unable to accept pull requests to this repository. - -We welcome your pull request and would be happy to consider it for inclusion in -our library if you follow these steps: - -* Clone the parent client library repository: - -```sh -$ git clone git@github.com:GoogleCloudPlatform/google-cloud-php.git -``` - -* Move your changes into the correct location in that library. Library code -belongs in `src/Monitoring`, and tests in `tests/*/Monitoring`. - -* Push the changes in a new branch to a fork, and open a new pull request -[here](https://github.com/GoogleCloudPlatform/google-cloud-php). - -Thanks again, and we look forward to seeing your proposed change! - -The Google Cloud PHP team diff --git a/src/Spanner/.github/pull_request_template.md b/src/Spanner/.github/pull_request_template.md deleted file mode 100644 index ec1a5966434f..000000000000 --- a/src/Spanner/.github/pull_request_template.md +++ /dev/null @@ -1,24 +0,0 @@ -**PLEASE READ THIS ENTIRE MESSAGE** - -Hello, and thank you for your contribution! Please note that this repository is -a read-only split of `GoogleCloudPlatform/google-cloud-php`. As such, we are -unable to accept pull requests to this repository. - -We welcome your pull request and would be happy to consider it for inclusion in -our library if you follow these steps: - -* Clone the parent client library repository: - -```sh -$ git clone git@github.com:GoogleCloudPlatform/google-cloud-php.git -``` - -* Move your changes into the correct location in that library. Library code -belongs in `src/Spanner`, and tests in `tests/*/Spanner`. - -* Push the changes in a new branch to a fork, and open a new pull request -[here](https://github.com/GoogleCloudPlatform/google-cloud-php). - -Thanks again, and we look forward to seeing your proposed change! - -The Google Cloud PHP team diff --git a/src/Storage/.github/pull_request_template.md b/src/Storage/.github/pull_request_template.md deleted file mode 100644 index 9507e2a6b030..000000000000 --- a/src/Storage/.github/pull_request_template.md +++ /dev/null @@ -1,24 +0,0 @@ -**PLEASE READ THIS ENTIRE MESSAGE** - -Hello, and thank you for your contribution! Please note that this repository is -a read-only split of `GoogleCloudPlatform/google-cloud-php`. As such, we are -unable to accept pull requests to this repository. - -We welcome your pull request and would be happy to consider it for inclusion in -our library if you follow these steps: - -* Clone the parent client library repository: - -```sh -$ git clone git@github.com:GoogleCloudPlatform/google-cloud-php.git -``` - -* Move your changes into the correct location in that library. Library code -belongs in `src/Storage`, and tests in `tests/*/Storage`. - -* Push the changes in a new branch to a fork, and open a new pull request -[here](https://github.com/GoogleCloudPlatform/google-cloud-php). - -Thanks again, and we look forward to seeing your proposed change! - -The Google Cloud PHP team diff --git a/src/Translate/.github/pull_request_template.md b/src/Translate/.github/pull_request_template.md deleted file mode 100644 index dd051376cc8a..000000000000 --- a/src/Translate/.github/pull_request_template.md +++ /dev/null @@ -1,24 +0,0 @@ -**PLEASE READ THIS ENTIRE MESSAGE** - -Hello, and thank you for your contribution! Please note that this repository is -a read-only split of `GoogleCloudPlatform/google-cloud-php`. As such, we are -unable to accept pull requests to this repository. - -We welcome your pull request and would be happy to consider it for inclusion in -our library if you follow these steps: - -* Clone the parent client library repository: - -```sh -$ git clone git@github.com:GoogleCloudPlatform/google-cloud-php.git -``` - -* Move your changes into the correct location in that library. Library code -belongs in `src/Translate`, and tests in `tests/*/Translate`. - -* Push the changes in a new branch to a fork, and open a new pull request -[here](https://github.com/GoogleCloudPlatform/google-cloud-php). - -Thanks again, and we look forward to seeing your proposed change! - -The Google Cloud PHP team diff --git a/src/VideoIntelligence/.github/pull_request_template.md b/src/VideoIntelligence/.github/pull_request_template.md deleted file mode 100644 index 5bb52227214d..000000000000 --- a/src/VideoIntelligence/.github/pull_request_template.md +++ /dev/null @@ -1,24 +0,0 @@ -**PLEASE READ THIS ENTIRE MESSAGE** - -Hello, and thank you for your contribution! Please note that this repository is -a read-only split of `GoogleCloudPlatform/google-cloud-php`. As such, we are -unable to accept pull requests to this repository. - -We welcome your pull request and would be happy to consider it for inclusion in -our library if you follow these steps: - -* Clone the parent client library repository: - -```sh -$ git clone git@github.com:GoogleCloudPlatform/google-cloud-php.git -``` - -* Move your changes into the correct location in that library. Library code -belongs in `src/VideoIntelligence`, and tests in `tests/*/VideoIntelligence`. - -* Push the changes in a new branch to a fork, and open a new pull request -[here](https://github.com/GoogleCloudPlatform/google-cloud-php). - -Thanks again, and we look forward to seeing your proposed change! - -The Google Cloud PHP team diff --git a/src/Vision/.github/pull_request_template.md b/src/Vision/.github/pull_request_template.md deleted file mode 100644 index 827c3fc40f99..000000000000 --- a/src/Vision/.github/pull_request_template.md +++ /dev/null @@ -1,24 +0,0 @@ -**PLEASE READ THIS ENTIRE MESSAGE** - -Hello, and thank you for your contribution! Please note that this repository is -a read-only split of `GoogleCloudPlatform/google-cloud-php`. As such, we are -unable to accept pull requests to this repository. - -We welcome your pull request and would be happy to consider it for inclusion in -our library if you follow these steps: - -* Clone the parent client library repository: - -```sh -$ git clone git@github.com:GoogleCloudPlatform/google-cloud-php.git -``` - -* Move your changes into the correct location in that library. Library code -belongs in `src/Vision`, and tests in `tests/*/Vision`. - -* Push the changes in a new branch to a fork, and open a new pull request -[here](https://github.com/GoogleCloudPlatform/google-cloud-php). - -Thanks again, and we look forward to seeing your proposed change! - -The Google Cloud PHP team diff --git a/src/generated-code.md b/src/generated-code.md deleted file mode 100644 index 8be63ae37290..000000000000 --- a/src/generated-code.md +++ /dev/null @@ -1,23 +0,0 @@ -# What Are Generated Code Clients? - -Google engineers have generated API clients for each language, which -are used to communicate directly with a specific version of a service via -[gRPC](https://grpc.io). Many services in Google Cloud PHP offer a generated -client in addition to the base client. - -These generated clients are used by Google Cloud PHP under the hood to communicate with -Google Cloud services via gRPC. They are also available for use directly by you. - -### Should I Use a Generated Client? - -If you require a specific version of an API, the Generated Code may be best. Google -Cloud PHP libraries generally use the latest version of an API. The Generated Code clients -are also much closer to a 1:1 API client. If you are familiar with the specifics -of a service, vkit may be more familiar to you. Google Cloud PHP clients attempt -to provide simple, language-idiomatic access to Google Cloud services over a -direct mapping. - -### What are the requirements for using Generated Code clients? - -* Using Generated Code requires the [gRPC PHP extension](https://pecl.php.net/package/gRPC) -to be enabled on your server. diff --git a/tests/component/TestComposerInstall.php b/tests/Component/TestComposerInstall.php similarity index 100% rename from tests/component/TestComposerInstall.php rename to tests/Component/TestComposerInstall.php diff --git a/tests/system/ServiceWhitelist/WhitelistTest.php b/tests/System/ServiceWhitelist/WhitelistTest.php similarity index 100% rename from tests/system/ServiceWhitelist/WhitelistTest.php rename to tests/System/ServiceWhitelist/WhitelistTest.php diff --git a/tests/unit/JsonFileTest.php b/tests/Unit/JsonFileTest.php similarity index 100% rename from tests/unit/JsonFileTest.php rename to tests/Unit/JsonFileTest.php diff --git a/tests/unit/fixtures/schema/composer.json.schema b/tests/Unit/fixtures/schema/composer.json.schema similarity index 100% rename from tests/unit/fixtures/schema/composer.json.schema rename to tests/Unit/fixtures/schema/composer.json.schema diff --git a/tests/unit/fixtures/schema/manifest.json.schema b/tests/Unit/fixtures/schema/manifest.json.schema similarity index 100% rename from tests/unit/fixtures/schema/manifest.json.schema rename to tests/Unit/fixtures/schema/manifest.json.schema diff --git a/tests/unit/fixtures/schema/toc.json.schema b/tests/Unit/fixtures/schema/toc.json.schema similarity index 100% rename from tests/unit/fixtures/schema/toc.json.schema rename to tests/Unit/fixtures/schema/toc.json.schema diff --git a/tests/perf/README.md b/tests/perf/README.md deleted file mode 100644 index 555c4903eb68..000000000000 --- a/tests/perf/README.md +++ /dev/null @@ -1,29 +0,0 @@ -## Performance Tests - -Some services contained in Google Cloud PHP provide a performance test, to allow -Google engineers and others to measure the performance of a client library. - -Like other test suites in Google Cloud PHP, performance tests are implemented -using PHPUnit. Due to the memory-intensive nature of many of these tests, however, -and the time required to run all tests, it is recommended that you use the test -group feature to run only the tests required at a given time. - -Running the tests is easy, once you have cloned the repository and run -`composer install` to install all required dependencies. - -From the repository root, run the following command: - -```sh -$ vendor/bin/phpunit -c phpunit-perf.xml.dist --group= -``` - -The group name can be identified by opening a test file (i.e. -`tests/perf/BigQueryTest.php`), and looking for the `@group` annotation found -immediately before the class declaration: - -```php -/** - * @group bigquery - */ -class BigQueryTest extends TestCase -``` diff --git a/tests/perf/bootstrap.php b/tests/perf/bootstrap.php deleted file mode 100644 index 38a03fbbaaf5..000000000000 --- a/tests/perf/bootstrap.php +++ /dev/null @@ -1,9 +0,0 @@ -buildListToCover(); - -Container::$coverage = $coverage; -Container::$parser = $parser; - -register_shutdown_function(function () { - $uncovered = Container::$coverage->uncovered(); - - if (!file_exists(__DIR__ . '/../../build')) { - mkdir(__DIR__ . '/../../build', 0777, true); - } - - file_put_contents(__DIR__ . '/../../build/snippets-uncovered.json', json_encode($uncovered, JSON_PRETTY_PRINT)); - - if (!empty($uncovered)) { - echo sprintf("\033[31mNOTICE: %s uncovered snippets! \033[0m See build/snippets-uncovered.json for a report.\n", count($uncovered)); - if (extension_loaded('grpc')) { - exit(1); - } - } -}); diff --git a/tests/snippets/keyfile-stub.json b/tests/snippets/keyfile-stub.json deleted file mode 100644 index e1c618b7497e..000000000000 --- a/tests/snippets/keyfile-stub.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "type": "service_account", - "project_id": "my-awesome-project", - "private_key_id": "", - "private_key": "", - "client_email": "", - "client_id": "", - "auth_uri": "", - "token_uri": "", - "auth_provider_x509_cert_url": "", - "client_x509_cert_url": "" -} diff --git a/tests/system/bootstrap.php b/tests/system/bootstrap.php deleted file mode 100644 index bcbb5d681cca..000000000000 --- a/tests/system/bootstrap.php +++ /dev/null @@ -1,43 +0,0 @@ -