diff --git a/.php_cs.dist b/.php_cs.dist new file mode 100644 index 00000000..fa934870 --- /dev/null +++ b/.php_cs.dist @@ -0,0 +1,19 @@ +setRules( + [ + '@PSR2' => true, + 'array_syntax' => ['syntax' => 'short'], + 'protected_to_private' => false + ] + ) + ->setUsingCache(false) + ->setRiskyAllowed(true) + ->setFinder( + PhpCsFixer\Finder::create() + ->in(__DIR__.'/src') + ->append([__FILE__, __DIR__.'/samples']) + ); diff --git a/.travis.yml b/.travis.yml index 5ca85ee1..b95c4d7d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,8 +2,6 @@ language: php sudo: false -dist: precise - cache: directories: - $HOME/.composer/cache @@ -12,6 +10,7 @@ matrix: include: - php: 7.0 - php: 7.1 + - php: 7.2 - php: nightly allow_failures: - php: nightly @@ -25,7 +24,7 @@ before_install: before_script: - composer install --prefer-source - vendor/bin/parallel-lint --exclude vendor . - - vendor/bin/php-cs-fixer fix --dry-run --diff --level psr2 . + - vendor/bin/php-cs-fixer fix --dry-run --diff - phpenv config-add ./xdebug.ini after_script: diff --git a/README.md b/README.md index a3022613..e0460b57 100644 --- a/README.md +++ b/README.md @@ -12,11 +12,23 @@ OpenStack services, and versions of services, are supported. * [Official documentation](http://docs.os.php-opencloud.com/) * [Reference documentation](http://refdocs.os.php-opencloud.com) -* [Developer support](https://developer.rackspace.com/) -* [Mailing list](https://groups.google.com/forum/#!forum/php-opencloud) * [Contributing guide](/CONTRIBUTING.md) * [Code of Conduct](/CODE_OF_CONDUCT.md) +## Backward incompatibility + +Due to new [object typehint](https://wiki.php.net/rfc/object-typehint) since PHP 7.2, `Object` is a reserved keyword +thus class `OpenStack\ObjectStore\v1\Models\Object` had to be renamed to +`OpenStack\ObjectStore\v1\Models\StorageObject`. See [#184](https://github.com/php-opencloud/openstack/pull/184) for +details. + +### Version Guidance + +| Version | Status | PHP Version | Life span | +| --------- | --------------------------- | ------------- | ----------------------- | +| `^2.0` | Maintained (Bug fixes only) | `^=7.0,<7.2` | March 2016 - March 2018 | +| `^3.0` | Latest | `^7.0` | March 2018 - March 2020 | + ## Getting help - Meet us on Slack: https://phpopencloud.slack.com ([Get your invitation](https://launchpass.com/phpopencloud)) diff --git a/composer.json b/composer.json index 6b699598..d68c7c30 100644 --- a/composer.json +++ b/composer.json @@ -44,11 +44,11 @@ "justinrainbow/json-schema": "~5.2" }, "require-dev": { - "phpunit/phpunit": "~4.0", + "phpunit/phpunit": "^6.5", "sami/sami": "dev-master", "psr/log": "~1.0", "satooshi/php-coveralls": "~1.0", "jakub-onderka/php-parallel-lint": "0.*", - "friendsofphp/php-cs-fixer": "^1.0" + "friendsofphp/php-cs-fixer": "^2.9" } } diff --git a/doc/services/object-store/v1/objects.rst b/doc/services/object-store/v1/objects.rst index f2a2ff88..b958a03c 100644 --- a/doc/services/object-store/v1/objects.rst +++ b/doc/services/object-store/v1/objects.rst @@ -27,7 +27,7 @@ Download an object ------------------ .. sample:: object_store/v1/objects/download.php -.. refdoc:: OpenStack/ObjectStore/v1/Models/Object.html#method_download +.. refdoc:: OpenStack/ObjectStore/v1/Models/StorageObject.html#method_download As you will notice, a Stream_ object is returned by this call. For more information about dealing with streams, please consult `Guzzle's docs`_. @@ -88,19 +88,19 @@ Copy object ----------- .. sample:: object_store/v1/objects/copy.php -.. refdoc:: OpenStack/ObjectStore/v1/Models/Object.html#method_copy +.. refdoc:: OpenStack/ObjectStore/v1/Models/StorageObject.html#method_copy Delete object ------------- .. sample:: object_store/v1/objects/delete.php -.. refdoc:: OpenStack/ObjectStore/v1/Models/Object.html#method_delete +.. refdoc:: OpenStack/ObjectStore/v1/Models/StorageObject.html#method_delete Get metadata ------------ .. sample:: object_store/v1/objects/get_metadata.php -.. refdoc:: OpenStack/ObjectStore/v1/Models/Object.html#method_getMetadata +.. refdoc:: OpenStack/ObjectStore/v1/Models/StorageObject.html#method_getMetadata The returned value will be a standard associative array, or hash, containing arbitrary key/value pairs. These will correspond to the values set either when the object was created, or when a previous ``mergeMetadata`` or @@ -110,7 +110,7 @@ Replace all metadata with new values ------------------------------------ .. sample:: object_store/v1/objects/reset_metadata.php -.. refdoc:: OpenStack/ObjectStore/v1/Models/Object.html#method_resetMetadata +.. refdoc:: OpenStack/ObjectStore/v1/Models/StorageObject.html#method_resetMetadata In order to replace all existing metadata with a set of new values, you can use this operation. Any existing metadata items which not specified in the new set will be removed. For example, say an account has the following metadata @@ -140,7 +140,7 @@ Merge new metadata values with existing --------------------------------------- .. sample:: object_store/v1/objects/merge_metadata.php -.. refdoc:: OpenStack/ObjectStore/v1/Models/Object.html#method_mergeMetadata +.. refdoc:: OpenStack/ObjectStore/v1/Models/StorageObject.html#method_mergeMetadata In order to merge a set of new metadata values with the existing metadata set, you can use this operation. Any existing metadata items which are not specified in the new set will be preserved. For example, say an account has the following diff --git a/phpunit.xml.dist b/phpunit.xml.dist index cf698d5b..2493eb9e 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,5 +1,5 @@ - + diff --git a/samples/object_store/v1/objects/create.php b/samples/object_store/v1/objects/create.php index 6ab81c09..1541c22c 100644 --- a/samples/object_store/v1/objects/create.php +++ b/samples/object_store/v1/objects/create.php @@ -17,7 +17,7 @@ 'content' => '{objectContent}', ]; -/** @var \OpenStack\ObjectStore\v1\Models\Object $object */ +/** @var \OpenStack\ObjectStore\v1\Models\StorageObject $object */ $object = $openstack->objectStoreV1() ->getContainer('{containerName}') ->createObject($options); diff --git a/samples/object_store/v1/objects/create_from_stream.php b/samples/object_store/v1/objects/create_from_stream.php index 5873a3ae..eed9fa20 100644 --- a/samples/object_store/v1/objects/create_from_stream.php +++ b/samples/object_store/v1/objects/create_from_stream.php @@ -22,7 +22,7 @@ 'stream' => $stream, ]; -/** @var \OpenStack\ObjectStore\v1\Models\Object $object */ +/** @var \OpenStack\ObjectStore\v1\Models\StorageObject $object */ $object = $openstack->objectStoreV1() ->getContainer('{containerName}') ->createObject($options); diff --git a/samples/object_store/v1/objects/create_large_object.php b/samples/object_store/v1/objects/create_large_object.php index 87cfc7a7..52f03b3f 100644 --- a/samples/object_store/v1/objects/create_large_object.php +++ b/samples/object_store/v1/objects/create_large_object.php @@ -27,7 +27,7 @@ $options['segmentContainer'] = 'test_segments'; -/** @var \OpenStack\ObjectStore\v1\Models\Object $object */ +/** @var \OpenStack\ObjectStore\v1\Models\StorageObject $object */ $object = $openstack->objectStoreV1() ->getContainer('test') ->createLargeObject($options); diff --git a/samples/object_store/v1/objects/get.php b/samples/object_store/v1/objects/get.php index 3789bdab..b7b42f3a 100644 --- a/samples/object_store/v1/objects/get.php +++ b/samples/object_store/v1/objects/get.php @@ -12,7 +12,7 @@ 'scope' => ['project' => ['id' => '{projectId}']] ]); -/** @var \OpenStack\ObjectStore\v1\Models\Object $object */ +/** @var \OpenStack\ObjectStore\v1\Models\StorageObject $object */ $object = $openstack->objectStoreV1() ->getContainer('{containerName}') ->getObject('{objectName}'); diff --git a/samples/object_store/v1/objects/list.php b/samples/object_store/v1/objects/list.php index fa7daef5..8d08cf0d 100644 --- a/samples/object_store/v1/objects/list.php +++ b/samples/object_store/v1/objects/list.php @@ -16,5 +16,5 @@ ->getContainer('{containerName}'); foreach ($container->listObjects() as $object) { - /** @var \OpenStack\ObjectStore\v1\Models\Object $object */ + /** @var \OpenStack\ObjectStore\v1\Models\StorageObject $object */ } diff --git a/src/Common/Api/Parameter.php b/src/Common/Api/Parameter.php index 15ab8369..136ff016 100644 --- a/src/Common/Api/Parameter.php +++ b/src/Common/Api/Parameter.php @@ -207,7 +207,9 @@ private function validateEnums($userValues) { if (!empty($this->enum) && $this->type == 'string' && !in_array($userValues, $this->enum)) { throw new \Exception(sprintf( - 'The only permitted values are %s. You provided %s', implode(', ', $this->enum), print_r($userValues, true) + 'The only permitted values are %s. You provided %s', + implode(', ', $this->enum), + print_r($userValues, true) )); } } @@ -217,7 +219,10 @@ private function validateType($userValues) if (!$this->hasCorrectType($userValues)) { throw new \Exception(sprintf( 'The key provided "%s" has the wrong value type. You provided %s (%s) but was expecting %s', - $this->name, print_r($userValues, true), gettype($userValues), $this->type + $this->name, + print_r($userValues, true), + gettype($userValues), + $this->type )); } } diff --git a/src/Common/Error/Builder.php b/src/Common/Error/Builder.php index 304e54eb..ad693b7c 100644 --- a/src/Common/Error/Builder.php +++ b/src/Common/Error/Builder.php @@ -116,8 +116,11 @@ public function httpError(RequestInterface $request, ResponseInterface $response { $message = $this->header('HTTP Error'); - $message .= sprintf("The remote server returned a \"%d %s\" error for the following transaction:\n\n", - $response->getStatusCode(), $response->getReasonPhrase()); + $message .= sprintf( + "The remote server returned a \"%d %s\" error for the following transaction:\n\n", + $response->getStatusCode(), + $response->getReasonPhrase() + ); $message .= $this->header('Request'); $message .= trim($this->str($request)) . PHP_EOL . PHP_EOL; @@ -163,8 +166,11 @@ public function userInputError(string $expectedType, $userValue, string $further { $message = $this->header('User Input Error'); - $message .= sprintf("%s was expected, but the following value was passed in:\n\n%s\n", - $expectedType, print_r($userValue, true)); + $message .= sprintf( + "%s was expected, but the following value was passed in:\n\n%s\n", + $expectedType, + print_r($userValue, true) + ); $message .= "Please ensure that the value adheres to the expectation above. "; diff --git a/src/Common/JsonSchema/JsonPatch.php b/src/Common/JsonSchema/JsonPatch.php index eb6c6e0a..ca69f792 100644 --- a/src/Common/JsonSchema/JsonPatch.php +++ b/src/Common/JsonSchema/JsonPatch.php @@ -78,7 +78,8 @@ protected function handleObject(\stdClass $srcStruct, \stdClass $desStruct, stri protected function shouldPartiallyReplace(\stdClass $o1, \stdClass $o2): bool { - return count(array_diff_key((array) $o1, (array) $o2)) < count($o1); + // NOTE: count(stdClass) always returns 1 + return count(array_diff_key((array) $o1, (array) $o2)) < 1; } protected function arrayDiff(array $a1, array $a2): array diff --git a/src/Common/Resource/AbstractResource.php b/src/Common/Resource/AbstractResource.php index a3f2f51a..1adaf2b5 100644 --- a/src/Common/Resource/AbstractResource.php +++ b/src/Common/Resource/AbstractResource.php @@ -42,7 +42,7 @@ abstract class AbstractResource implements ResourceInterface, Serializable * * @return AbstractResource */ - public function populateFromResponse(ResponseInterface $response): self + public function populateFromResponse(ResponseInterface $response) { if (strpos($response->getHeaderLine('Content-Type'), 'application/json') === 0) { $json = Utils::jsonDecode($response); @@ -61,7 +61,7 @@ public function populateFromResponse(ResponseInterface $response): self * * @return mixed|void */ - public function populateFromArray(array $array): self + public function populateFromArray(array $array) { $aliases = $this->getAliases(); diff --git a/src/Common/Service/Builder.php b/src/Common/Service/Builder.php index ee7b5442..f1c1d155 100644 --- a/src/Common/Service/Builder.php +++ b/src/Common/Service/Builder.php @@ -166,7 +166,8 @@ private function mergeOptions(array $serviceOptions): array if (!isset($options['identityService']) || !($options['identityService'] instanceof IdentityService)) { throw new \InvalidArgumentException(sprintf( - '"identityService" must be specified and implement %s', IdentityService::class + '"identityService" must be specified and implement %s', + IdentityService::class )); } diff --git a/src/Common/Transport/JsonSerializer.php b/src/Common/Transport/JsonSerializer.php index 24a62a31..826d396c 100644 --- a/src/Common/Transport/JsonSerializer.php +++ b/src/Common/Transport/JsonSerializer.php @@ -101,7 +101,8 @@ private function serializeObjectValue($value) } elseif (!($value instanceof \stdClass)) { throw new \InvalidArgumentException(sprintf( 'When an object value is provided, it must either be \stdClass or implement the Serializable ' - . 'interface, you provided %s', print_r($value, true) + . 'interface, you provided %s', + print_r($value, true) )); } } diff --git a/src/Identity/v2/Models/Catalog.php b/src/Identity/v2/Models/Catalog.php index 6081507a..f2cd02c2 100644 --- a/src/Identity/v2/Models/Catalog.php +++ b/src/Identity/v2/Models/Catalog.php @@ -61,7 +61,10 @@ public function getServiceUrl( throw new \RuntimeException(sprintf( "Endpoint URL could not be found in the catalog for this service.\nName: %s\nType: %s\nRegion: %s\nURL type: %s", - $serviceName, $serviceType, $region, $urlType + $serviceName, + $serviceType, + $region, + $urlType )); } } diff --git a/src/Identity/v3/Models/Catalog.php b/src/Identity/v3/Models/Catalog.php index 9fc1a7f9..55b39c4a 100644 --- a/src/Identity/v3/Models/Catalog.php +++ b/src/Identity/v3/Models/Catalog.php @@ -56,7 +56,10 @@ public function getServiceUrl(string $name, string $type, string $region, string throw new \RuntimeException(sprintf( "Endpoint URL could not be found in the catalog for this service.\nName: %s\nType: %s\nRegion: %s\nURL type: %s", - $name, $type, $region, $urlType + $name, + $type, + $region, + $urlType )); } } diff --git a/src/Identity/v3/Service.php b/src/Identity/v3/Service.php index 4fca5626..b29261cd 100644 --- a/src/Identity/v3/Service.php +++ b/src/Identity/v3/Service.php @@ -50,8 +50,13 @@ public function authenticate(array $options): array return [$token, $baseUrl]; } - throw new \RuntimeException(sprintf("No service found with type [%s] name [%s] region [%s] interface [%s]", - $type, $name, $region, $interface)); + throw new \RuntimeException(sprintf( + "No service found with type [%s] name [%s] region [%s] interface [%s]", + $type, + $name, + $region, + $interface + )); } /** diff --git a/src/ObjectStore/v1/Models/Container.php b/src/ObjectStore/v1/Models/Container.php index 52704546..31414a94 100644 --- a/src/ObjectStore/v1/Models/Container.php +++ b/src/ObjectStore/v1/Models/Container.php @@ -61,7 +61,7 @@ public function populateFromResponse(ResponseInterface $response): self public function listObjects(array $options = [], callable $mapFn = null): \Generator { $options = array_merge($options, ['name' => $this->name, 'format' => 'json']); - return $this->model(Object::class)->enumerate($this->api->getContainer(), $options, $mapFn); + return $this->model(StorageObject::class)->enumerate($this->api->getContainer(), $options, $mapFn); } /** @@ -136,17 +136,17 @@ public function getMetadata(): array } /** - * Retrieves an Object and populates its `name` and `containerName` properties according to the name provided and + * Retrieves an StorageObject and populates its `name` and `containerName` properties according to the name provided and * the name of this container. A HTTP call will not be executed by default - you need to call - * {@see Object::retrieve} or {@see Object::download} on the returned Object object to do that. + * {@see StorageObject::retrieve} or {@see StorageObject::download} on the returned StorageObject object to do that. * * @param string $name The name of the object * - * @return Object + * @return StorageObject */ - public function getObject($name): Object + public function getObject($name): StorageObject { - return $this->model(Object::class, ['containerName' => $this->name, 'name' => $name]); + return $this->model(StorageObject::class, ['containerName' => $this->name, 'name' => $name]); } /** @@ -179,9 +179,9 @@ public function objectExists(string $name): bool * * @return Object */ - public function createObject(array $data): Object + public function createObject(array $data): StorageObject { - return $this->model(Object::class)->create($data + ['containerName' => $this->name]); + return $this->model(StorageObject::class)->create($data + ['containerName' => $this->name]); } /** @@ -195,9 +195,9 @@ public function createObject(array $data): Object * @param string $data['segmentPrefix'] The prefix that will come before each segment. If omitted, a default * is used: name/timestamp/filesize * - * @return Object + * @return StorageObject */ - public function createLargeObject(array $data): Object + public function createLargeObject(array $data): StorageObject { /** @var \Psr\Http\Message\StreamInterface $stream */ $stream = $data['stream']; @@ -218,7 +218,7 @@ public function createLargeObject(array $data): Object $count = 0; while (!$stream->eof() && $count < round($stream->getSize() / $segmentSize)) { - $promises[] = $this->model(Object::class)->createAsync([ + $promises[] = $this->model(StorageObject::class)->createAsync([ 'name' => sprintf("%s/%d", $segmentPrefix, ++$count), 'stream' => new LimitStream($stream, $segmentSize, ($count - 1) * $segmentSize), 'containerName' => $segmentContainer, diff --git a/src/ObjectStore/v1/Models/Object.php b/src/ObjectStore/v1/Models/StorageObject.php similarity index 98% rename from src/ObjectStore/v1/Models/Object.php rename to src/ObjectStore/v1/Models/StorageObject.php index 2f255817..ca9302be 100644 --- a/src/ObjectStore/v1/Models/Object.php +++ b/src/ObjectStore/v1/Models/StorageObject.php @@ -14,7 +14,7 @@ /** * @property \OpenStack\ObjectStore\v1\Api $api */ -class Object extends OperatorResource implements Creatable, Deletable, HasMetadata +class StorageObject extends OperatorResource implements Creatable, Deletable, HasMetadata { use MetadataTrait; diff --git a/tests/integration/Compute/v2/CoreTest.php b/tests/integration/Compute/v2/CoreTest.php index ae4c644c..eb829b73 100644 --- a/tests/integration/Compute/v2/CoreTest.php +++ b/tests/integration/Compute/v2/CoreTest.php @@ -672,7 +672,8 @@ private function attachVolumeToServer() $this->volume->waitUntil('in-use'); - $this->logStep('Attached volume {volumeId} to server {serverId} with volume attachment id {volumeAttachmentId}', + $this->logStep( + 'Attached volume {volumeId} to server {serverId} with volume attachment id {volumeAttachmentId}', array_merge($replacements, ['{volumeAttachmentId}' => $volumeAttachment->id]) ); } diff --git a/tests/integration/TestCase.php b/tests/integration/TestCase.php index cebb1953..f382e301 100644 --- a/tests/integration/TestCase.php +++ b/tests/integration/TestCase.php @@ -5,7 +5,7 @@ use OpenStack\Common\Resource\Deletable; use Psr\Log\LoggerInterface; -abstract class TestCase extends \PHPUnit_Framework_TestCase implements TestInterface +abstract class TestCase extends \PHPUnit\Framework\TestCase implements TestInterface { protected $logger; private $startPoint; diff --git a/tests/unit/Common/Api/OperationTest.php b/tests/unit/Common/Api/OperationTest.php index 36adf3bd..68e0eaa9 100644 --- a/tests/unit/Common/Api/OperationTest.php +++ b/tests/unit/Common/Api/OperationTest.php @@ -6,7 +6,7 @@ use OpenStack\Common\Api\Parameter; use OpenStack\Test\Fixtures\ComputeV2Api; -class OperationTest extends \PHPUnit_Framework_TestCase +class OperationTest extends \PHPUnit\Framework\TestCase { private $operation; diff --git a/tests/unit/Common/Api/OperatorTraitTest.php b/tests/unit/Common/Api/OperatorTraitTest.php index c0589141..813eddcd 100644 --- a/tests/unit/Common/Api/OperatorTraitTest.php +++ b/tests/unit/Common/Api/OperatorTraitTest.php @@ -48,6 +48,8 @@ public function test_it_sends_a_request_when_operations_are_executed() $this->client->request('GET', 'test', ['headers' => []])->willReturn(new Response()); $this->operator->execute($this->def, []); + + $this->addToAssertionCount(1); } public function test_it_sends_a_request_when_async_operations_are_executed() @@ -55,6 +57,8 @@ public function test_it_sends_a_request_when_async_operations_are_executed() $this->client->requestAsync('GET', 'test', ['headers' => []])->willReturn(new Promise()); $this->operator->executeAsync($this->def, []); + + $this->addToAssertionCount(1); } public function test_it_wraps_sequential_ops_in_promise_when_async_is_appended_to_method_name() @@ -90,10 +94,12 @@ public function test_it_returns_a_model_instance() { $this->assertInstanceOf(ResourceInterface::class, $this->operator->model(TestResource::class)); } + public function test_it_populates_models_from_response() { $this->assertInstanceOf(ResourceInterface::class, $this->operator->model(TestResource::class, new Response(200))); } + public function test_it_populates_models_from_arrays() { $data = ['flavor' => [], 'image' => []]; diff --git a/tests/unit/Common/Api/ParameterTest.php b/tests/unit/Common/Api/ParameterTest.php index 79aaa118..320d25be 100644 --- a/tests/unit/Common/Api/ParameterTest.php +++ b/tests/unit/Common/Api/ParameterTest.php @@ -5,7 +5,7 @@ use OpenStack\Common\Api\Parameter; use OpenStack\Test\Fixtures\ComputeV2Api; -class ParameterTest extends \PHPUnit_Framework_TestCase +class ParameterTest extends \PHPUnit\Framework\TestCase { private $param; private $data; diff --git a/tests/unit/Common/Error/BuilderTest.php b/tests/unit/Common/Error/BuilderTest.php index 0c91e697..f5710a1b 100644 --- a/tests/unit/Common/Error/BuilderTest.php +++ b/tests/unit/Common/Error/BuilderTest.php @@ -13,12 +13,12 @@ use OpenStack\Common\Error\Builder; use OpenStack\Common\Error\UserInputError; -class BuilderTest extends \PHPUnit_Framework_TestCase +class BuilderTest extends \PHPUnit\Framework\TestCase { private $builder; private $client; - public function __construct() + public function setUp() { $this->client = $this->prophesize(ClientInterface::class); $this->builder = new Builder($this->client->reveal()); diff --git a/tests/unit/Common/JsonPathTest.php b/tests/unit/Common/JsonPathTest.php index 5648e327..42edb91c 100644 --- a/tests/unit/Common/JsonPathTest.php +++ b/tests/unit/Common/JsonPathTest.php @@ -4,7 +4,7 @@ use OpenStack\Common\JsonPath; -class JsonPathTest extends \PHPUnit_Framework_TestCase +class JsonPathTest extends \PHPUnit\Framework\TestCase { private $jsonPath; diff --git a/tests/unit/Common/Transport/JsonSerializerTest.php b/tests/unit/Common/Transport/JsonSerializerTest.php index 652c7219..50a54e5a 100644 --- a/tests/unit/Common/Transport/JsonSerializerTest.php +++ b/tests/unit/Common/Transport/JsonSerializerTest.php @@ -8,7 +8,7 @@ use OpenStack\Common\Resource\OperatorResource; use OpenStack\Common\Transport\JsonSerializer; -class JsonSerializerTest extends \PHPUnit_Framework_TestCase +class JsonSerializerTest extends \PHPUnit\Framework\TestCase { /** @var JsonSerializer */ private $serializer; diff --git a/tests/unit/Networking/v2/Extensions/Layer3/Models/FloatingIpTest.php b/tests/unit/Networking/v2/Extensions/Layer3/Models/FloatingIpTest.php index fe757adc..f7e5e51f 100644 --- a/tests/unit/Networking/v2/Extensions/Layer3/Models/FloatingIpTest.php +++ b/tests/unit/Networking/v2/Extensions/Layer3/Models/FloatingIpTest.php @@ -49,20 +49,34 @@ public function test_it_retrieves() $this->floatingIp->retrieve(); - $this->assertEquals('376da547-b977-4cfe-9cba-275c80debf57', - $this->floatingIp->floatingNetworkId); - $this->assertEquals('d23abc8d-2991-4a55-ba98-2aaea84cc72f', - $this->floatingIp->routerId); - $this->assertEquals('10.0.0.3', - $this->floatingIp->fixedIpAddress); - $this->assertEquals('172.24.4.228', - $this->floatingIp->floatingIpAddress); - $this->assertEquals('4969c491a3c74ee4af974e6d800c62de', - $this->floatingIp->tenantId); + $this->assertEquals( + '376da547-b977-4cfe-9cba-275c80debf57', + $this->floatingIp->floatingNetworkId + ); + $this->assertEquals( + 'd23abc8d-2991-4a55-ba98-2aaea84cc72f', + $this->floatingIp->routerId + ); + $this->assertEquals( + '10.0.0.3', + $this->floatingIp->fixedIpAddress + ); + $this->assertEquals( + '172.24.4.228', + $this->floatingIp->floatingIpAddress + ); + $this->assertEquals( + '4969c491a3c74ee4af974e6d800c62de', + $this->floatingIp->tenantId + ); $this->assertEquals('ACTIVE', $this->floatingIp->status); - $this->assertEquals('ce705c24-c1ef-408a-bda3-7bbd946164ab', - $this->floatingIp->portId); - $this->assertEquals('2f245a7b-796b-4f26-9cf9-9e82d248fda7', - $this->floatingIp->id); + $this->assertEquals( + 'ce705c24-c1ef-408a-bda3-7bbd946164ab', + $this->floatingIp->portId + ); + $this->assertEquals( + '2f245a7b-796b-4f26-9cf9-9e82d248fda7', + $this->floatingIp->id + ); } } diff --git a/tests/unit/ObjectStore/v1/Models/ContainerTest.php b/tests/unit/ObjectStore/v1/Models/ContainerTest.php index 6e83b8a4..78fe4c65 100644 --- a/tests/unit/ObjectStore/v1/Models/ContainerTest.php +++ b/tests/unit/ObjectStore/v1/Models/ContainerTest.php @@ -8,7 +8,7 @@ use OpenStack\Common\Error\BadResponseError; use OpenStack\ObjectStore\v1\Api; use OpenStack\ObjectStore\v1\Models\Container; -use OpenStack\ObjectStore\v1\Models\Object; +use OpenStack\ObjectStore\v1\Models\StorageObject; use OpenStack\Test\TestCase; use Prophecy\Argument; @@ -95,7 +95,7 @@ public function test_It_Gets_Object() { $object = $this->container->getObject('foo.txt'); - $this->assertInstanceOf(Object::class, $object); + $this->assertInstanceOf(StorageObject::class, $object); $this->assertEquals('foo.txt', $object->name); } @@ -135,7 +135,7 @@ public function test_it_lists_objects() ->willReturn($this->getFixture('GET_Container')); foreach ($this->container->listObjects(['limit' => 2]) as $object) { - $this->assertInstanceOf(Object::class, $object); + $this->assertInstanceOf(StorageObject::class, $object); } } diff --git a/tests/unit/ObjectStore/v1/Models/ObjectTest.php b/tests/unit/ObjectStore/v1/Models/ObjectTest.php index 2dd54a3e..85202b82 100644 --- a/tests/unit/ObjectStore/v1/Models/ObjectTest.php +++ b/tests/unit/ObjectStore/v1/Models/ObjectTest.php @@ -5,7 +5,7 @@ use function GuzzleHttp\Psr7\uri_for; use GuzzleHttp\Psr7\Stream; use OpenStack\ObjectStore\v1\Api; -use OpenStack\ObjectStore\v1\Models\Object; +use OpenStack\ObjectStore\v1\Models\StorageObject; use OpenStack\Test\TestCase; class ObjectTest extends TestCase @@ -21,7 +21,7 @@ public function setUp() $this->rootFixturesDir = dirname(__DIR__); - $this->object = new Object($this->client->reveal(), new Api()); + $this->object = new StorageObject($this->client->reveal(), new Api()); $this->object->containerName = self::CONTAINER; $this->object->name = self::NAME; } diff --git a/tests/unit/TestCase.php b/tests/unit/TestCase.php index 3a372dd0..30f14879 100644 --- a/tests/unit/TestCase.php +++ b/tests/unit/TestCase.php @@ -8,7 +8,7 @@ use GuzzleHttp\Psr7\Response; use Prophecy\Argument; -abstract class TestCase extends \PHPUnit_Framework_TestCase +abstract class TestCase extends \PHPUnit\Framework\TestCase { /** @var \Prophecy\Prophecy\ObjectProphecy */ protected $client;