Skip to content

Commit

Permalink
Merge af57678 into 1c695df
Browse files Browse the repository at this point in the history
  • Loading branch information
ChristophWurst committed Jan 6, 2021
2 parents 1c695df + af57678 commit cc6efa4
Show file tree
Hide file tree
Showing 91 changed files with 874 additions and 937 deletions.
3 changes: 1 addition & 2 deletions .travis.yml
@@ -1,7 +1,5 @@
language: php

sudo: false

dist: bionic

cache:
Expand All @@ -13,6 +11,7 @@ matrix:
- php: 7.2
- php: 7.3
- php: 7.4
- php: 8.0
- php: nightly
allow_failures:
- php: nightly
Expand Down
8 changes: 4 additions & 4 deletions composer.json
Expand Up @@ -33,17 +33,17 @@
}
},
"require": {
"php": "^7.2.5",
"php": "^7.2.5|^8.0",
"guzzlehttp/guzzle": "^7.0",
"guzzlehttp/uri-template": "0.2",
"justinrainbow/json-schema": "^5.2"
},
"require-dev": {
"phpunit/phpunit": "^6.5",
"phpunit/phpunit": "^8.0",
"psr/log": "^1.0",
"php-coveralls/php-coveralls": "^2.0",
"jakub-onderka/php-parallel-lint": "^1.0",
"friendsofphp/php-cs-fixer": "^2.13"
"friendsofphp/php-cs-fixer": "^2.13",
"php-parallel-lint/php-parallel-lint": "^1.2"
},
"extra": {
"branch-alias": {
Expand Down
2 changes: 1 addition & 1 deletion src/Common/Transport/Middleware.php
Expand Up @@ -20,7 +20,7 @@ public static function httpErrors(): callable
return function (callable $handler) {
return function ($request, array $options) use ($handler) {
return $handler($request, $options)->then(
function (ResponseInterface $response) use ($request, $handler) {
function (ResponseInterface $response) use ($request) {
if ($response->getStatusCode() < 400) {
return $response;
}
Expand Down
20 changes: 10 additions & 10 deletions src/OpenStack.php
Expand Up @@ -77,7 +77,7 @@ private function getDefaultIdentityService(array $options): Service
*
* @param array $options options that will be used in configuring the service
*/
public function computeV2(array $options = []): \OpenStack\Compute\v2\Service
public function computeV2(array $options = []): Compute\v2\Service
{
$defaults = ['catalogName' => 'nova', 'catalogType' => 'compute'];

Expand All @@ -89,7 +89,7 @@ public function computeV2(array $options = []): \OpenStack\Compute\v2\Service
*
* @param array $options options that will be used in configuring the service
*/
public function networkingV2(array $options = []): \OpenStack\Networking\v2\Service
public function networkingV2(array $options = []): Networking\v2\Service
{
$defaults = ['catalogName' => 'neutron', 'catalogType' => 'network'];

Expand All @@ -101,7 +101,7 @@ public function networkingV2(array $options = []): \OpenStack\Networking\v2\Serv
*
* @param array $options options that will be used in configuring the service
*/
public function networkingV2ExtLayer3(array $options = []): \OpenStack\Networking\v2\Extensions\Layer3\Service
public function networkingV2ExtLayer3(array $options = []): Networking\v2\Extensions\Layer3\Service
{
$defaults = ['catalogName' => 'neutron', 'catalogType' => 'network'];

Expand All @@ -113,7 +113,7 @@ public function networkingV2ExtLayer3(array $options = []): \OpenStack\Networkin
*
* @param array $options options that will be used in configuring the service
*/
public function networkingV2ExtSecGroups(array $options = []): \OpenStack\Networking\v2\Extensions\SecurityGroups\Service
public function networkingV2ExtSecGroups(array $options = []): Networking\v2\Extensions\SecurityGroups\Service
{
$defaults = ['catalogName' => 'neutron', 'catalogType' => 'network'];

Expand All @@ -125,7 +125,7 @@ public function networkingV2ExtSecGroups(array $options = []): \OpenStack\Networ
*
* @param array $options options that will be used in configuring the service
*/
public function identityV2(array $options = []): \OpenStack\Identity\v2\Service
public function identityV2(array $options = []): Identity\v2\Service
{
$defaults = ['catalogName' => 'keystone', 'catalogType' => 'identity'];

Expand All @@ -137,7 +137,7 @@ public function identityV2(array $options = []): \OpenStack\Identity\v2\Service
*
* @param array $options options that will be used in configuring the service
*/
public function identityV3(array $options = []): \OpenStack\Identity\v3\Service
public function identityV3(array $options = []): Service
{
$defaults = ['catalogName' => 'keystone', 'catalogType' => 'identity'];

Expand All @@ -149,7 +149,7 @@ public function identityV3(array $options = []): \OpenStack\Identity\v3\Service
*
* @param array $options options that will be used in configuring the service
*/
public function objectStoreV1(array $options = []): \OpenStack\ObjectStore\v1\Service
public function objectStoreV1(array $options = []): ObjectStore\v1\Service
{
$defaults = ['catalogName' => 'swift', 'catalogType' => 'object-store'];

Expand All @@ -161,7 +161,7 @@ public function objectStoreV1(array $options = []): \OpenStack\ObjectStore\v1\Se
*
* @param array $options options that will be used in configuring the service
*/
public function blockStorageV2(array $options = []): \OpenStack\BlockStorage\v2\Service
public function blockStorageV2(array $options = []): BlockStorage\v2\Service
{
$defaults = ['catalogName' => 'cinderv2', 'catalogType' => 'volumev2'];

Expand All @@ -173,7 +173,7 @@ public function blockStorageV2(array $options = []): \OpenStack\BlockStorage\v2\
*
* @param array $options options that will be used in configuring the service
*/
public function imagesV2(array $options = []): \OpenStack\Images\v2\Service
public function imagesV2(array $options = []): Images\v2\Service
{
$defaults = ['catalogName' => 'glance', 'catalogType' => 'image'];

Expand All @@ -183,7 +183,7 @@ public function imagesV2(array $options = []): \OpenStack\Images\v2\Service
/**
* Creates a new Gnocchi Metric service v1.
*/
public function metricGnocchiV1(array $options = []): \OpenStack\Metric\v1\Gnocchi\Service
public function metricGnocchiV1(array $options = []): Metric\v1\Gnocchi\Service
{
$defaults = ['catalogName' => 'gnocchi', 'catalogType' => 'metric'];

Expand Down
30 changes: 15 additions & 15 deletions tests/integration/BlockStorage/v2/CoreTest.php
Expand Up @@ -55,25 +55,25 @@ public function volumes()
$this->logStep('Creating volume');
/** @var Volume $volume */
require_once $this->sampleFile($replacements, 'volumes/create.php');
$this->assertInstanceOf(Volume::class, $volume);
$this->assertEquals($replacements['{name}'], $volume->name);
$this->assertEquals(1, $volume->size);
$this->assertEquals($volumeType->name, $volume->volumeTypeName);
self::assertInstanceOf(Volume::class, $volume);
self::assertEquals($replacements['{name}'], $volume->name);
self::assertEquals(1, $volume->size);
self::assertEquals($volumeType->name, $volume->volumeTypeName);

$volumeId = $volume->id;
$replacements = ['{volumeId}' => $volumeId];

$this->logStep('Getting volume');
/** @var Volume $volume */
require_once $this->sampleFile($replacements, 'volumes/get.php');
$this->assertInstanceOf(Volume::class, $volume);
self::assertInstanceOf(Volume::class, $volume);

$replacements += ['{newName}' => $this->randomStr(), '{newDescription}' => $this->randomStr()];

$this->logStep('Updating volume');
/** @var Volume $volume */
require_once $this->sampleFile($replacements, 'volumes/update.php');
$this->assertInstanceOf(Volume::class, $volume);
self::assertInstanceOf(Volume::class, $volume);

$this->logStep('Listing volumes');
/** @var \Generator $volumes */
Expand All @@ -98,22 +98,22 @@ public function volumeTypes()
$this->logStep('Creating volume type');
/** @var VolumeType $volumeType */
require_once $this->sampleFile($replacements, 'volume_types/create.php');
$this->assertInstanceOf(VolumeType::class, $volumeType);
$this->assertEquals($replacements['{name}'], $volumeType->name);
self::assertInstanceOf(VolumeType::class, $volumeType);
self::assertEquals($replacements['{name}'], $volumeType->name);

$replacements = ['{volumeTypeId}' => $volumeType->id];

$this->logStep('Getting volume type');
/** @var VolumeType $volumeType */
require_once $this->sampleFile($replacements, 'volume_types/get.php');
$this->assertInstanceOf(VolumeType::class, $volumeType);
self::assertInstanceOf(VolumeType::class, $volumeType);

$replacements += ['{newName}' => $this->randomStr()];

$this->logStep('Updating volume type');
/** @var VolumeType $volumeType */
require_once $this->sampleFile($replacements, 'volume_types/update.php');
$this->assertInstanceOf(VolumeType::class, $volumeType);
self::assertInstanceOf(VolumeType::class, $volumeType);

$this->logStep('Listing volume types');
/** @var \Generator $volumeTypes */
Expand All @@ -138,8 +138,8 @@ public function snapshots()
$this->logStep('Creating snapshot');
/** @var Snapshot $snapshot */
require_once $this->sampleFile($replacements, 'snapshots/create.php');
$this->assertInstanceOf(Snapshot::class, $snapshot);
$this->assertEquals($replacements['{name}'], $snapshot->name);
self::assertInstanceOf(Snapshot::class, $snapshot);
self::assertEquals($replacements['{name}'], $snapshot->name);
$volume->waitUntil('available', 60);

$snapshotId = $snapshot->id;
Expand All @@ -148,7 +148,7 @@ public function snapshots()
$this->logStep('Getting snapshot');
/** @var Snapshot $snapshot */
require_once $this->sampleFile($replacements, 'snapshots/get.php');
$this->assertInstanceOf(Snapshot::class, $snapshot);
self::assertInstanceOf(Snapshot::class, $snapshot);

$this->getService()
->getSnapshot($snapshot->id)
Expand All @@ -161,7 +161,7 @@ public function snapshots()
$this->logStep('Retrieving metadata');
/** @var array $metadata */
require_once $this->sampleFile($replacements, 'snapshots/get_metadata.php');
$this->assertEquals(['key1' => 'val1', 'key2' => 'val2'], $metadata);
self::assertEquals(['key1' => 'val1', 'key2' => 'val2'], $metadata);

$replacements = ['{snapshotId}' => $snapshot->id, '{key}' => 'key3', '{val}' => 'val3'];
$this->logStep('Resetting metadata');
Expand All @@ -170,7 +170,7 @@ public function snapshots()
$this->logStep('Retrieving metadata');
/** @var array $metadata */
require_once $this->sampleFile($replacements, 'snapshots/get_metadata.php');
$this->assertEquals(['key3' => 'val3'], $metadata);
self::assertEquals(['key3' => 'val3'], $metadata);

$replacements += ['{newName}' => $this->randomStr(), '{newDescription}' => $this->randomStr()];
$this->logStep('Updating snapshot');
Expand Down
52 changes: 26 additions & 26 deletions tests/integration/Compute/v2/CoreTest.php
Expand Up @@ -247,9 +247,9 @@ private function createServer()

$server->waitUntilActive(false);

$this->assertInstanceOf('OpenStack\Compute\v2\Models\Server', $server);
$this->assertNotEmpty($server->id);
$this->assertNotEmpty($server->adminPass);
self::assertInstanceOf('OpenStack\Compute\v2\Models\Server', $server);
self::assertNotEmpty($server->id);
self::assertNotEmpty($server->adminPass);

$this->serverId = $server->id;
$this->adminPass = $server->adminPass;
Expand All @@ -270,8 +270,8 @@ private function updateServer()
$path = $this->sampleFile($replacements, 'servers/update_server.php');
require_once $path;

$this->assertInstanceOf('OpenStack\Compute\v2\Models\Server', $server);
$this->assertEquals($name, $server->name);
self::assertInstanceOf('OpenStack\Compute\v2\Models\Server', $server);
self::assertEquals($name, $server->name);

$server->waitUntilActive(false);

Expand Down Expand Up @@ -299,15 +299,15 @@ private function retrieveServer()
$path = $this->sampleFile($replacements, 'servers/get_server.php');
require_once $path;

$this->assertInstanceOf('OpenStack\Compute\v2\Models\Server', $server);
$this->assertEquals($this->serverId, $server->id);
$this->assertNotNull($server->created);
$this->assertNotNull($server->updated);
$this->assertNotNull($server->name);
$this->assertNotNull($server->ipv4);
$this->assertNotNull($server->status);
$this->assertInstanceOf(Image::class, $server->image);
$this->assertInstanceOf(Flavor::class, $server->flavor);
self::assertInstanceOf('OpenStack\Compute\v2\Models\Server', $server);
self::assertEquals($this->serverId, $server->id);
self::assertNotNull($server->created);
self::assertNotNull($server->updated);
self::assertNotNull($server->name);
self::assertNotNull($server->ipv4);
self::assertNotNull($server->status);
self::assertInstanceOf(Image::class, $server->image);
self::assertInstanceOf(Flavor::class, $server->flavor);

$this->logStep('Retrieved the details of server ID', ['ID' => $this->serverId]);
}
Expand Down Expand Up @@ -456,7 +456,7 @@ private function createFlavor()
$path = $this->sampleFile($replacements, 'flavors/create_flavor.php');
require_once $path;

$this->assertInstanceOf('\OpenStack\Compute\v2\Models\Flavor', $flavor);
self::assertInstanceOf('\OpenStack\Compute\v2\Models\Flavor', $flavor);

$this->flavorId = $flavor->id;
$this->logStep('Created flavor {id}', ['{id}' => $flavor->id]);
Expand Down Expand Up @@ -552,7 +552,7 @@ private function listKeypairs()
/** @var $keypairs \Generator */
require_once $this->sampleFile([], 'keypairs/list_keypairs.php');

$this->assertInstanceOf(\Generator::class, $keypairs);
self::assertInstanceOf(\Generator::class, $keypairs);

$this->logStep('Listed all keypairs');
}
Expand All @@ -567,9 +567,9 @@ private function createKeypair()
require_once $this->sampleFile($replacements, 'keypairs/create_keypair.php');
/**@var Keypair $keypair */

$this->assertInstanceOf(Keypair::class, $keypair);
$this->assertEquals($replacements['{name}'], $keypair->name);
$this->assertEquals($replacements['{publicKey}'], $keypair->publicKey);
self::assertInstanceOf(Keypair::class, $keypair);
self::assertEquals($replacements['{name}'], $keypair->name);
self::assertEquals($replacements['{publicKey}'], $keypair->publicKey);

$this->keypairName = $keypair->name;
$this->logStep('Created keypair name {name}', ['{name}' => $keypair->name]);
Expand All @@ -584,9 +584,9 @@ private function getKeypair()
require_once $this->sampleFile($replacements, 'keypairs/get_keypair.php');

/**@var Keypair $keypair */
$this->assertInstanceOf(Keypair::class, $keypair);
self::assertInstanceOf(Keypair::class, $keypair);

$this->assertEquals($replacements['{name}'], $keypair->name);
self::assertEquals($replacements['{name}'], $keypair->name);

$this->logStep('Retrieved details for keypair {name}', $replacements);
}
Expand Down Expand Up @@ -617,8 +617,8 @@ private function getHypervisor()
require_once $this->sampleFile($replacements, 'hypervisors/get_hypervisor.php');

/**@var Hypervisor $hypervisor */
$this->assertInstanceOf(Hypervisor::class, $hypervisor);
$this->assertEquals($replacements['{hypervisorId}'], $hypervisor->id);
self::assertInstanceOf(Hypervisor::class, $hypervisor);
self::assertEquals($replacements['{hypervisorId}'], $hypervisor->id);

$this->logStep('Retrieved details for hypervisor id {hypervisorId}', $replacements);
}
Expand All @@ -628,7 +628,7 @@ private function getHypervisorsStatistics()
require_once $this->sampleFile([], 'hypervisors/get_hypervisors_statistics.php');

/**@var HypervisorStatistic $hypervisorStatistics */
$this->assertInstanceOf(HypervisorStatistic::class, $hypervisorStatistics);
self::assertInstanceOf(HypervisorStatistic::class, $hypervisorStatistics);

$this->logStep('Retrieved hypervisors statistics');
}
Expand All @@ -638,7 +638,7 @@ private function getLimits()
require_once $this->sampleFile([], 'limits/get_limits.php');

/**@var Limit $limit */
$this->assertInstanceOf(Limit::class, $limit);
self::assertInstanceOf(Limit::class, $limit);

$this->logStep('Retrieved tenant limit');
}
Expand All @@ -665,7 +665,7 @@ private function listServerSecurityGroups()
require_once $this->sampleFile($replacements, 'servers/list_security_groups.php');

/**@var \Generator $securityGroups */
$this->assertInstanceOf(\Generator::class, $securityGroups);
self::assertInstanceOf(\Generator::class, $securityGroups);

$this->logStep('Listed all security groups attached to server {serverId}', $replacements);
}
Expand Down

0 comments on commit cc6efa4

Please sign in to comment.