Skip to content

Commit 682c7c2

Browse files
Merge pull request #325 from ChristophWurst/enhancement/php8
Update phpunit and allow php8
2 parents 1c695df + 43864e9 commit 682c7c2

File tree

91 files changed

+874
-937
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

91 files changed

+874
-937
lines changed

.travis.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
language: php
22

3-
sudo: false
4-
53
dist: bionic
64

75
cache:
@@ -13,6 +11,7 @@ matrix:
1311
- php: 7.2
1412
- php: 7.3
1513
- php: 7.4
14+
- php: 8.0
1615
- php: nightly
1716
allow_failures:
1817
- php: nightly

composer.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,17 @@
3333
}
3434
},
3535
"require": {
36-
"php": "^7.2.5",
36+
"php": "^7.2.5|^8.0",
3737
"guzzlehttp/guzzle": "^7.0",
3838
"guzzlehttp/uri-template": "0.2",
3939
"justinrainbow/json-schema": "^5.2"
4040
},
4141
"require-dev": {
42-
"phpunit/phpunit": "^6.5",
42+
"phpunit/phpunit": "^8.0",
4343
"psr/log": "^1.0",
4444
"php-coveralls/php-coveralls": "^2.0",
45-
"jakub-onderka/php-parallel-lint": "^1.0",
46-
"friendsofphp/php-cs-fixer": "^2.13"
45+
"friendsofphp/php-cs-fixer": "^2.18",
46+
"php-parallel-lint/php-parallel-lint": "^1.2"
4747
},
4848
"extra": {
4949
"branch-alias": {

src/Common/Transport/Middleware.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public static function httpErrors(): callable
2020
return function (callable $handler) {
2121
return function ($request, array $options) use ($handler) {
2222
return $handler($request, $options)->then(
23-
function (ResponseInterface $response) use ($request, $handler) {
23+
function (ResponseInterface $response) use ($request) {
2424
if ($response->getStatusCode() < 400) {
2525
return $response;
2626
}

src/OpenStack.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ private function getDefaultIdentityService(array $options): Service
7777
*
7878
* @param array $options options that will be used in configuring the service
7979
*/
80-
public function computeV2(array $options = []): \OpenStack\Compute\v2\Service
80+
public function computeV2(array $options = []): Compute\v2\Service
8181
{
8282
$defaults = ['catalogName' => 'nova', 'catalogType' => 'compute'];
8383

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

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

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

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

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

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

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

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

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

tests/integration/BlockStorage/v2/CoreTest.php

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -55,25 +55,25 @@ public function volumes()
5555
$this->logStep('Creating volume');
5656
/** @var Volume $volume */
5757
require_once $this->sampleFile($replacements, 'volumes/create.php');
58-
$this->assertInstanceOf(Volume::class, $volume);
59-
$this->assertEquals($replacements['{name}'], $volume->name);
60-
$this->assertEquals(1, $volume->size);
61-
$this->assertEquals($volumeType->name, $volume->volumeTypeName);
58+
self::assertInstanceOf(Volume::class, $volume);
59+
self::assertEquals($replacements['{name}'], $volume->name);
60+
self::assertEquals(1, $volume->size);
61+
self::assertEquals($volumeType->name, $volume->volumeTypeName);
6262

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

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

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

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

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

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

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

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

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

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

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

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

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

175175
$replacements += ['{newName}' => $this->randomStr(), '{newDescription}' => $this->randomStr()];
176176
$this->logStep('Updating snapshot');

tests/integration/Compute/v2/CoreTest.php

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -247,9 +247,9 @@ private function createServer()
247247

248248
$server->waitUntilActive(false);
249249

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

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

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

276276
$server->waitUntilActive(false);
277277

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

302-
$this->assertInstanceOf('OpenStack\Compute\v2\Models\Server', $server);
303-
$this->assertEquals($this->serverId, $server->id);
304-
$this->assertNotNull($server->created);
305-
$this->assertNotNull($server->updated);
306-
$this->assertNotNull($server->name);
307-
$this->assertNotNull($server->ipv4);
308-
$this->assertNotNull($server->status);
309-
$this->assertInstanceOf(Image::class, $server->image);
310-
$this->assertInstanceOf(Flavor::class, $server->flavor);
302+
self::assertInstanceOf('OpenStack\Compute\v2\Models\Server', $server);
303+
self::assertEquals($this->serverId, $server->id);
304+
self::assertNotNull($server->created);
305+
self::assertNotNull($server->updated);
306+
self::assertNotNull($server->name);
307+
self::assertNotNull($server->ipv4);
308+
self::assertNotNull($server->status);
309+
self::assertInstanceOf(Image::class, $server->image);
310+
self::assertInstanceOf(Flavor::class, $server->flavor);
311311

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

0 commit comments

Comments
 (0)