diff --git a/.php_cs.dist b/.php_cs.dist index f52c9327a2..7b2f2ef73d 100644 --- a/.php_cs.dist +++ b/.php_cs.dist @@ -5,6 +5,7 @@ return PhpCsFixer\Config::create() '@PSR2' => true, 'concat_space' => ['spacing' => 'one'], 'no_unused_imports' => true, + 'method_argument_space' => false, ]) ->setFinder( PhpCsFixer\Finder::create() diff --git a/compute/helloworld/app.php b/compute/helloworld/app.php index 6e6dcdcb9d..39a544713b 100755 --- a/compute/helloworld/app.php +++ b/compute/helloworld/app.php @@ -120,52 +120,60 @@ function generateMarkup($apiRequestName, $apiResponse) * Google Compute Engine API request to retrieve the list of instances in your * Google Compute Engine project. */ - $instances = $computeService->instances->listInstances(DEFAULT_PROJECT, - DEFAULT_ZONE_NAME); - $instancesListMarkup = generateMarkup('List Instances', $instances); + $instances = $computeService->instances->listInstances( + DEFAULT_PROJECT, + DEFAULT_ZONE_NAME + ); - /** - * Google Compute Engine API request to retrieve the list of all data center - * locations associated with your Google Compute Engine project. - */ - $zones = $computeService->zones->listZones(DEFAULT_PROJECT); + $instancesListMarkup = generateMarkup( + 'List Instances', + $instances + ); + + /** + * Google Compute Engine API request to retrieve the list of all data center + * locations associated with your Google Compute Engine project. + */ + $zones = $computeService->zones->listZones(DEFAULT_PROJECT); $zonesListMarkup = generateMarkup('List Zones', $zones); - /** - * Google Compute Engine API request to retrieve the list of all machine types - * associated associated with your Google Compute Engine project. - */ - $machineTypes = $computeService->machineTypes->listMachineTypes(DEFAULT_PROJECT); - $machineTypesListMarkup = generateMarkup('List Machine Types', - $machineTypes); + /** + * Google Compute Engine API request to retrieve the list of all machine types + * associated with your Google Compute Engine project. + */ + $machineTypes = $computeService->machineTypes->listMachineTypes(DEFAULT_PROJECT); + $machineTypesListMarkup = generateMarkup( + 'List Machine Types', + $machineTypes + ); - /** - * Google Compute Engine API request to retrieve the list of all image types - * associated associated with your Google Compute Engine project. - */ - $images = $computeService->images->listImages(GOOGLE_PROJECT); + /** + * Google Compute Engine API request to retrieve the list of all image types + * associated with your Google Compute Engine project. + */ + $images = $computeService->images->listImages(GOOGLE_PROJECT); $imagesListMarkup = generateMarkup('List Images', $images); - /** - * Google Compute Engine API request to retrieve the list of all firewalls - * associated associated with your Google Compute Engine project. - */ - $firewalls = $computeService->firewalls->listFirewalls(DEFAULT_PROJECT); + /** + * Google Compute Engine API request to retrieve the list of all firewalls + * associated with your Google Compute Engine project. + */ + $firewalls = $computeService->firewalls->listFirewalls(DEFAULT_PROJECT); $firewallsListMarkup = generateMarkup('List Firewalls', $firewalls); - /** - * Google Compute Engine API request to retrieve the list of all networks - * associated associated with your Google Compute Engine project. - */ - $networks = $computeService->networks->listNetworks(DEFAULT_PROJECT); + /** + * Google Compute Engine API request to retrieve the list of all networks + * associated with your Google Compute Engine project. + */ + $networks = $computeService->networks->listNetworks(DEFAULT_PROJECT); $networksListMarkup = generateMarkup('List Networks', $networks); ; - /** - * Google Compute Engine API request to insert a new instance into your Google - * Compute Engine project. - */ - $name = DEFAULT_NAME; + /** + * Google Compute Engine API request to insert a new instance into your Google + * Compute Engine project. + */ + $name = DEFAULT_NAME; $machineType = DEFAULT_MACHINE_TYPE; $zone = DEFAULT_ZONE_NAME; $image = DEFAULT_IMAGE; @@ -184,11 +192,11 @@ function generateMarkup($apiRequestName, $apiResponse) $zone, $new_instance); $insertInstanceMarkup = generateMarkup('Insert Instance', $insertInstance); - /** - * Google Compute Engine API request to insert a new instance (with metadata) - * into your Google Compute Engine project. - */ - $name = DEFAULT_NAME_WITH_METADATA; + /** + * Google Compute Engine API request to insert a new instance (with metadata) + * into your Google Compute Engine project. + */ + $name = DEFAULT_NAME_WITH_METADATA; $machineType = DEFAULT_MACHINE_TYPE; $zone = DEFAULT_ZONE_NAME; $image = DEFAULT_IMAGE; @@ -212,53 +220,85 @@ function generateMarkup($apiRequestName, $apiResponse) $new_instance->setMetadata($metadata); $insertInstanceWithMetadata = $computeService->instances->insert( - DEFAULT_PROJECT, $zone, $new_instance); + DEFAULT_PROJECT, + $zone, + $new_instance + ); + $insertInstanceWithMetadataMarkup = generateMarkup( - 'Insert Instance With Metadata', $insertInstanceWithMetadata); + 'Insert Instance With Metadata', + $insertInstanceWithMetadata + ); + + /** + * Google Compute Engine API request to get an instance matching the outlined + * parameters from your Google Compute Engine project. + */ + $getInstance = $computeService->instances->get( + DEFAULT_PROJECT, + DEFAULT_ZONE_NAME, + DEFAULT_NAME + ); - /** - * Google Compute Engine API request to get an instance matching the outlined - * parameters from your Google Compute Engine project. - */ - $getInstance = $computeService->instances->get(DEFAULT_PROJECT, - DEFAULT_ZONE_NAME, DEFAULT_NAME); $getInstanceMarkup = generateMarkup('Get Instance', $getInstance); - /** - * Google Compute Engine API request to get an instance matching the outlined - * parameters from your Google Compute Engine project. - */ - $getInstanceWithMetadata = $computeService->instances->get(DEFAULT_PROJECT, - DEFAULT_ZONE_NAME, DEFAULT_NAME_WITH_METADATA); - $getInstanceWithMetadataMarkup = generateMarkup('Get Instance With Metadata', - $getInstanceWithMetadata); - - /** - * Google Compute Engine API request to delete an instance matching the - * outlined parameters from your Google Compute Engine project. - */ - $deleteInstance = $computeService->instances->delete(DEFAULT_PROJECT, - DEFAULT_ZONE_NAME, DEFAULT_NAME); + /** + * Google Compute Engine API request to get an instance matching the outlined + * parameters from your Google Compute Engine project. + */ + $getInstanceWithMetadata = $computeService->instances->get( + DEFAULT_PROJECT, + DEFAULT_ZONE_NAME, + DEFAULT_NAME_WITH_METADATA + ); + + $getInstanceWithMetadataMarkup = generateMarkup( + 'Get Instance With Metadata', + $getInstanceWithMetadata + ); + + /** + * Google Compute Engine API request to delete an instance matching the + * outlined parameters from your Google Compute Engine project. + */ + $deleteInstance = $computeService->instances->delete( + DEFAULT_PROJECT, + DEFAULT_ZONE_NAME, + DEFAULT_NAME + ); + $deleteInstanceMarkup = generateMarkup('Delete Instance', $deleteInstance); - /** - * Google Compute Engine API request to delete an instance matching the - * outlined parameters from your Google Compute Engine project. - */ - $deleteInstanceWithMetadata = $computeService->instances->delete(DEFAULT_PROJECT, - DEFAULT_ZONE_NAME, DEFAULT_NAME_WITH_METADATA); - $deleteInstanceWithMetadataMarkup = generateMarkup( - 'Delete Instance With Metadata', $deleteInstanceWithMetadata); + /** + * Google Compute Engine API request to delete an instance matching the + * outlined parameters from your Google Compute Engine project. + */ + $deleteInstanceWithMetadata = $computeService->instances->delete( + DEFAULT_PROJECT, + DEFAULT_ZONE_NAME, + DEFAULT_NAME_WITH_METADATA + ); - /** - * Google Compute Engine API request to retrieve the list of all global - * operations associated with your Google Compute Engine project. - */ - $globalOperations = $computeService->globalOperations->listGlobalOperations(DEFAULT_PROJECT); - $operationsListMarkup = generateMarkup('List Global Operations', $globalOperations); + $deleteInstanceWithMetadataMarkup = generateMarkup( + 'Delete Instance With Metadata', + $deleteInstanceWithMetadata + ); - // The access token may have been updated lazily. - $_SESSION['access_token'] = $client->getAccessToken(); + /** + * Google Compute Engine API request to retrieve the list of all global + * operations associated with your Google Compute Engine project. + */ + $globalOperations = $computeService->globalOperations->listGlobalOperations( + DEFAULT_PROJECT + ); + + $operationsListMarkup = generateMarkup( + 'List Global Operations', + $globalOperations + ); + + // The access token may have been updated lazily. + $_SESSION['access_token'] = $client->getAccessToken(); } else { $authUrl = $client->createAuthUrl(); } diff --git a/logging/api/test/ListEntriesCommandTest.php b/logging/api/test/ListEntriesCommandTest.php index f4e774f397..92426d7210 100644 --- a/logging/api/test/ListEntriesCommandTest.php +++ b/logging/api/test/ListEntriesCommandTest.php @@ -51,10 +51,19 @@ public function setUp() if (!$this->projectId = getenv('GOOGLE_PROJECT_ID')) { $this->markTestSkipped('No project ID'); } + + // up the default retry count + $this->eventuallyConsistentRetryCount = 5; + } + + public function testListEntries() + { $application = new Application(); $application->add(new WriteCommand()); - $commandTester = new CommandTester($application->get('write')); - $commandTester->execute( + $application->add(new ListEntriesCommand()); + + $writeCommandTester = new CommandTester($application->get('write')); + $writeCommandTester->execute( [ '--project' => $this->projectId, '--logger' => 'my_test_logger', @@ -62,12 +71,7 @@ public function setUp() ], ['interactive' => false] ); - } - public function testListEntries() - { - $application = new Application(); - $application->add(new ListEntriesCommand()); $commandTester = new CommandTester($application->get('list-entries')); $this->runEventuallyConsistentTest(function () use ($commandTester) { ob_start(); diff --git a/spanner/test/spannerTest.php b/spanner/test/spannerTest.php index 33c5f18ab9..538cc7618c 100644 --- a/spanner/test/spannerTest.php +++ b/spanner/test/spannerTest.php @@ -53,7 +53,7 @@ public static function setUpBeforeClass() $instance = $spanner->instance(self::$instanceId); $operation = $instance->create($configuration); - $operation->result(); + $operation->pollUntilComplete(); self::$instance = $instance; }