summaryrefslogtreecommitdiff
path: root/server/vendor/php-opencloud
diff options
context:
space:
mode:
authorEoleDev <EoleDev@outlook.fr>2016-04-14 16:24:44 +0200
committerEoleDev <EoleDev@outlook.fr>2016-04-14 16:24:44 +0200
commit24bb5fefbdf93ce0969b7f56cc46c459ebb82a95 (patch)
tree531fc8b774c035040774234efba780a3d4fe9242 /server/vendor/php-opencloud
parent646af6fd4d14c5b5edb1372e5f68ed9bdc35b3d2 (diff)
Mise a jour et nettoyage depot
Diffstat (limited to 'server/vendor/php-opencloud')
-rw-r--r--server/vendor/php-opencloud/common/.gitignore10
-rw-r--r--server/vendor/php-opencloud/common/.travis.yml30
-rw-r--r--server/vendor/php-opencloud/common/composer.json36
-rw-r--r--server/vendor/php-opencloud/common/phpunit.xml.dist21
-rw-r--r--server/vendor/php-opencloud/common/src/Common/Api/AbstractApi.php33
-rw-r--r--server/vendor/php-opencloud/common/src/Common/Api/AbstractParams.php100
-rw-r--r--server/vendor/php-opencloud/common/src/Common/Api/ApiInterface.php20
-rw-r--r--server/vendor/php-opencloud/common/src/Common/Api/Operation.php134
-rw-r--r--server/vendor/php-opencloud/common/src/Common/Api/Operator.php175
-rw-r--r--server/vendor/php-opencloud/common/src/Common/Api/OperatorInterface.php54
-rw-r--r--server/vendor/php-opencloud/common/src/Common/Api/Parameter.php389
-rw-r--r--server/vendor/php-opencloud/common/src/Common/ArrayAccessTrait.php67
-rw-r--r--server/vendor/php-opencloud/common/src/Common/Auth/AuthHandler.php76
-rw-r--r--server/vendor/php-opencloud/common/src/Common/Auth/Catalog.php20
-rw-r--r--server/vendor/php-opencloud/common/src/Common/Auth/IdentityService.php13
-rw-r--r--server/vendor/php-opencloud/common/src/Common/Auth/Token.php15
-rw-r--r--server/vendor/php-opencloud/common/src/Common/Error/BadResponseError.php40
-rw-r--r--server/vendor/php-opencloud/common/src/Common/Error/BaseError.php12
-rw-r--r--server/vendor/php-opencloud/common/src/Common/Error/Builder.php179
-rw-r--r--server/vendor/php-opencloud/common/src/Common/Error/NotImplementedError.php12
-rw-r--r--server/vendor/php-opencloud/common/src/Common/Error/UserInputError.php12
-rw-r--r--server/vendor/php-opencloud/common/src/Common/HydratorStrategyTrait.php35
-rw-r--r--server/vendor/php-opencloud/common/src/Common/JsonPath.php122
-rw-r--r--server/vendor/php-opencloud/common/src/Common/JsonSchema/JsonPatch.php117
-rw-r--r--server/vendor/php-opencloud/common/src/Common/JsonSchema/Schema.php75
-rw-r--r--server/vendor/php-opencloud/common/src/Common/Resource/AbstractResource.php245
-rw-r--r--server/vendor/php-opencloud/common/src/Common/Resource/Creatable.php19
-rw-r--r--server/vendor/php-opencloud/common/src/Common/Resource/Deletable.php18
-rw-r--r--server/vendor/php-opencloud/common/src/Common/Resource/HasMetadata.php67
-rw-r--r--server/vendor/php-opencloud/common/src/Common/Resource/HasWaiterTrait.php124
-rw-r--r--server/vendor/php-opencloud/common/src/Common/Resource/Iterator.php97
-rw-r--r--server/vendor/php-opencloud/common/src/Common/Resource/Listable.php28
-rw-r--r--server/vendor/php-opencloud/common/src/Common/Resource/ResourceInterface.php29
-rw-r--r--server/vendor/php-opencloud/common/src/Common/Resource/Retrievable.php18
-rw-r--r--server/vendor/php-opencloud/common/src/Common/Resource/Updateable.php18
-rw-r--r--server/vendor/php-opencloud/common/src/Common/Service/AbstractService.php14
-rw-r--r--server/vendor/php-opencloud/common/src/Common/Service/Builder.php168
-rw-r--r--server/vendor/php-opencloud/common/src/Common/Service/ServiceInterface.php14
-rw-r--r--server/vendor/php-opencloud/common/src/Common/Transport/HandlerStack.php19
-rw-r--r--server/vendor/php-opencloud/common/src/Common/Transport/JsonSerializer.php95
-rw-r--r--server/vendor/php-opencloud/common/src/Common/Transport/Middleware.php96
-rw-r--r--server/vendor/php-opencloud/common/src/Common/Transport/RequestSerializer.php85
-rw-r--r--server/vendor/php-opencloud/common/src/Common/Transport/Utils.php88
-rw-r--r--server/vendor/php-opencloud/common/tests/integration/DefaultLogger.php20
-rw-r--r--server/vendor/php-opencloud/common/tests/integration/Runner.php114
-rw-r--r--server/vendor/php-opencloud/common/tests/integration/SampleManager.php104
-rw-r--r--server/vendor/php-opencloud/common/tests/integration/SampleManagerInterface.php10
-rw-r--r--server/vendor/php-opencloud/common/tests/integration/TestCase.php115
-rw-r--r--server/vendor/php-opencloud/common/tests/integration/TestInterface.php16
-rw-r--r--server/vendor/php-opencloud/common/tests/integration/Utils.php13
-rwxr-xr-xserver/vendor/php-opencloud/common/tests/integration/script/compute_v23
-rwxr-xr-xserver/vendor/php-opencloud/common/tests/integration/script/identity_v33
-rwxr-xr-xserver/vendor/php-opencloud/common/tests/integration/script/networking_v23
-rwxr-xr-xserver/vendor/php-opencloud/common/tests/integration/script/objectstore_v23
-rw-r--r--server/vendor/php-opencloud/common/tests/unit/Common/Api/OperationTest.php74
-rw-r--r--server/vendor/php-opencloud/common/tests/unit/Common/Api/OperatorTest.php136
-rw-r--r--server/vendor/php-opencloud/common/tests/unit/Common/Api/ParameterTest.php203
-rw-r--r--server/vendor/php-opencloud/common/tests/unit/Common/Api/fixtures/headers.php25
-rw-r--r--server/vendor/php-opencloud/common/tests/unit/Common/Api/fixtures/jsonBody.php27
-rw-r--r--server/vendor/php-opencloud/common/tests/unit/Common/ArrayAccessTraitTest.php59
-rw-r--r--server/vendor/php-opencloud/common/tests/unit/Common/Auth/AuthHandlerTest.php63
-rw-r--r--server/vendor/php-opencloud/common/tests/unit/Common/DateTime.php16
-rw-r--r--server/vendor/php-opencloud/common/tests/unit/Common/Error/BadResponseErrorTest.php34
-rw-r--r--server/vendor/php-opencloud/common/tests/unit/Common/Error/BuilderTest.php117
-rw-r--r--server/vendor/php-opencloud/common/tests/unit/Common/HydratorStrategyTraitTes.php52
-rw-r--r--server/vendor/php-opencloud/common/tests/unit/Common/JsonPathTest.php70
-rw-r--r--server/vendor/php-opencloud/common/tests/unit/Common/JsonSchema/Fixtures/jsonPatchTests.json231
-rw-r--r--server/vendor/php-opencloud/common/tests/unit/Common/JsonSchema/JsonPatchTest.php28
-rw-r--r--server/vendor/php-opencloud/common/tests/unit/Common/JsonSchema/SchemaTest.php102
-rw-r--r--server/vendor/php-opencloud/common/tests/unit/Common/Resource/AbstractResourceTest.php161
-rw-r--r--server/vendor/php-opencloud/common/tests/unit/Common/Resource/Fixtures/servers-empty.resp6
-rw-r--r--server/vendor/php-opencloud/common/tests/unit/Common/Resource/Fixtures/servers-page1.resp77
-rw-r--r--server/vendor/php-opencloud/common/tests/unit/Common/Resource/Fixtures/servers-page2.resp77
-rw-r--r--server/vendor/php-opencloud/common/tests/unit/Common/Service/BuilderTest.php164
-rw-r--r--server/vendor/php-opencloud/common/tests/unit/Common/Transport/HandlerStackTest.php15
-rw-r--r--server/vendor/php-opencloud/common/tests/unit/Common/Transport/JsonSerializerTest.php85
-rw-r--r--server/vendor/php-opencloud/common/tests/unit/Common/Transport/MiddlewareTest.php59
-rw-r--r--server/vendor/php-opencloud/common/tests/unit/Common/Transport/RequestSerializerTest.php112
-rw-r--r--server/vendor/php-opencloud/common/tests/unit/Common/Transport/UtilsTest.php30
-rw-r--r--server/vendor/php-opencloud/common/tests/unit/Fixtures/ComputeV2Api.php117
-rw-r--r--server/vendor/php-opencloud/common/tests/unit/Fixtures/IdentityV2Api.php36
-rw-r--r--server/vendor/php-opencloud/common/tests/unit/Fixtures/IdentityV3Api.php75
-rw-r--r--server/vendor/php-opencloud/common/tests/unit/TestCase.php99
m---------server/vendor/php-opencloud/openstack0
84 files changed, 0 insertions, 5793 deletions
diff --git a/server/vendor/php-opencloud/common/.gitignore b/server/vendor/php-opencloud/common/.gitignore
deleted file mode 100644
index 7ad09a8..0000000
--- a/server/vendor/php-opencloud/common/.gitignore
+++ /dev/null
@@ -1,10 +0,0 @@
-.idea/
-.test/
-coverage/
-vendor/
-
-*.pyc
-
-phpunit.xml
-coverage.xml
-composer.lock
diff --git a/server/vendor/php-opencloud/common/.travis.yml b/server/vendor/php-opencloud/common/.travis.yml
deleted file mode 100644
index f15d253..0000000
--- a/server/vendor/php-opencloud/common/.travis.yml
+++ /dev/null
@@ -1,30 +0,0 @@
-language: php
-
-sudo: false
-
-cache:
- directories:
- - $HOME/.composer/cache
-
-matrix:
- include:
- - php: 7.0
- - php: nightly
- allow_failures:
- - php: nightly
- fast_finish: true
-
-before_install:
- - composer self-update
-
-before_script:
- - composer install --prefer-source
- - vendor/bin/parallel-lint --exclude vendor .
- - vendor/bin/php-cs-fixer fix --dry-run --diff --level psr2 .
-
-after_script:
- - php vendor/bin/coveralls -v
-
-notifications:
- email:
- - jamie.hannaford@rackspace.com
diff --git a/server/vendor/php-opencloud/common/composer.json b/server/vendor/php-opencloud/common/composer.json
deleted file mode 100644
index f2520ad..0000000
--- a/server/vendor/php-opencloud/common/composer.json
+++ /dev/null
@@ -1,36 +0,0 @@
-{
- "name": "php-opencloud/common",
- "authors": [
- {
- "name": "Jamie Hannaford",
- "email": "jamie.hannaford@rackspace.com",
- "homepage" : "https://github.com/jamiehannaford"
- }
- ],
- "autoload": {
- "psr-4": {
- "OpenCloud\\": "src/",
- "OpenCloud\\Test\\": "tests/unit/",
- "OpenCloud\\Integration\\": "tests/integration/"
- }
- },
- "repositories": [
- {
- "type": "vcs",
- "url": "https://github.com/php-opencloud/Sami"
- }
- ],
- "require": {
- "php": "~7.0",
- "guzzlehttp/guzzle": "~6.1",
- "justinrainbow/json-schema": "~1.3"
- },
- "require-dev": {
- "phpunit/phpunit": "~4.0",
- "sami/sami": "dev-master",
- "psr/log": "~1.0",
- "satooshi/php-coveralls": "~1.0",
- "jakub-onderka/php-parallel-lint": "0.*",
- "fabpot/php-cs-fixer": "~1.0"
- }
-}
diff --git a/server/vendor/php-opencloud/common/phpunit.xml.dist b/server/vendor/php-opencloud/common/phpunit.xml.dist
deleted file mode 100644
index cf698d5..0000000
--- a/server/vendor/php-opencloud/common/phpunit.xml.dist
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<phpunit bootstrap="./vendor/autoload.php" colors="true">
-
- <testsuites>
- <testsuite name="OpenStack">
- <directory>tests/unit</directory>
- </testsuite>
- </testsuites>
-
- <filter>
- <whitelist>
- <directory suffix=".php">./src</directory>
- <exclude>
- <directory suffix="Interface.php">./src</directory>
- <directory suffix="Api.php">./src</directory>
- <directory suffix="Params.php">./src</directory>
- </exclude>
- </whitelist>
- </filter>
-
-</phpunit> \ No newline at end of file
diff --git a/server/vendor/php-opencloud/common/src/Common/Api/AbstractApi.php b/server/vendor/php-opencloud/common/src/Common/Api/AbstractApi.php
deleted file mode 100644
index 09988fd..0000000
--- a/server/vendor/php-opencloud/common/src/Common/Api/AbstractApi.php
+++ /dev/null
@@ -1,33 +0,0 @@
-<?php declare(strict_types = 1);
-
-namespace OpenCloud\Common\Api;
-
-abstract class AbstractApi implements ApiInterface
-{
- protected $params;
-
- protected function isRequired(array $param): array
- {
- return array_merge($param, ['required' => true]);
- }
-
- protected function notRequired(array $param): array
- {
- return array_merge($param, ['required' => false]);
- }
-
- protected function query(array $param): array
- {
- return array_merge($param, ['location' => AbstractParams::QUERY]);
- }
-
- protected function url(array $param): array
- {
- return array_merge($param, ['location' => AbstractParams::URL]);
- }
-
- public function documented(array $param): array
- {
- return array_merge($param, ['required' => true]);
- }
-}
diff --git a/server/vendor/php-opencloud/common/src/Common/Api/AbstractParams.php b/server/vendor/php-opencloud/common/src/Common/Api/AbstractParams.php
deleted file mode 100644
index b21b3dd..0000000
--- a/server/vendor/php-opencloud/common/src/Common/Api/AbstractParams.php
+++ /dev/null
@@ -1,100 +0,0 @@
-<?php declare(strict_types=1);
-
-namespace OpenCloud\Common\Api;
-
-abstract class AbstractParams
-{
- // locations
- const QUERY = 'query';
- const HEADER = 'header';
- const URL = 'url';
- const JSON = 'json';
- const RAW = 'raw';
-
- // types
- const STRING_TYPE = "string";
- const BOOL_TYPE = "boolean";
- const BOOLEAN_TYPE = self::BOOL_TYPE;
- const OBJECT_TYPE = "object";
- const ARRAY_TYPE = "array";
- const NULL_TYPE = "NULL";
- const INT_TYPE = 'integer';
- const INTEGER_TYPE = self::INT_TYPE;
-
- public static function isSupportedLocation(string $val): bool
- {
- return in_array($val, [self::QUERY, self::HEADER, self::URL, self::JSON, self::RAW]);
- }
-
- public function limit(): array
- {
- return [
- 'type' => self::INT_TYPE,
- 'location' => 'query',
- 'description' => <<<DESC
-This will limit the total amount of elements returned in a list up to the number specified. For example, specifying a
-limit of 10 will return 10 elements, regardless of the actual count.
-DESC
- ];
- }
-
- public function marker(): array
- {
- return [
- 'type' => 'string',
- 'location' => 'query',
- 'description' => <<<DESC
-Specifying a marker will begin the list from the value specified. Elements will have a particular attribute that
-identifies them, such as a name or ID. The marker value will search for an element whose identifying attribute matches
-the marker value, and begin the list from there.
-DESC
- ];
- }
-
- public function id(string $type): array
- {
- return [
- 'description' => sprintf("The unique ID, or identifier, for the %s", $type),
- 'type' => self::STRING_TYPE,
- 'location' => self::JSON,
- ];
- }
-
- public function idPath(): array
- {
- return [
- 'type' => self::STRING_TYPE,
- 'location' => self::URL,
- 'description' => 'The unique ID of the resource',
- ];
- }
-
- public function name(string $resource): array
- {
- return [
- 'description' => sprintf("The name of the %s", $resource),
- 'type' => self::STRING_TYPE,
- 'location' => self::JSON,
- ];
- }
-
-
- public function sortDir(): array
- {
- return [
- 'type' => self::STRING_TYPE,
- 'location' => self::QUERY,
- 'description' => "Sorts by one or more sets of attribute and sort direction combinations.",
- 'enum' => ['asc', 'desc']
- ];
- }
-
- public function sortKey(): array
- {
- return [
- 'type' => self::STRING_TYPE,
- 'location' => self::QUERY,
- 'description' => "Sorts by one or more sets of attribute and sort direction combinations.",
- ];
- }
-} \ No newline at end of file
diff --git a/server/vendor/php-opencloud/common/src/Common/Api/ApiInterface.php b/server/vendor/php-opencloud/common/src/Common/Api/ApiInterface.php
deleted file mode 100644
index d4629dc..0000000
--- a/server/vendor/php-opencloud/common/src/Common/Api/ApiInterface.php
+++ /dev/null
@@ -1,20 +0,0 @@
-<?php declare(strict_types=1);
-
-namespace OpenCloud\Common\Api;
-
-/**
- * All classes which implement this interface are a data representation of a remote OpenCloud API.
- * They do not execute functionality, but instead return data for each API operation for other parts
- * of the SDK to use. Usually, the data is injected into {@see OpenCloud\Common\Api\Operation} objects.
- * The operation is then serialized into a {@see GuzzleHttp\Message\Request} and sent to the API.
- *
- * The reason for storing all the API-specific data is to decouple service information from client
- * HTTP functionality. Too often it is mixed all across different layers, leading to duplication and
- * no separation of concerns. The choice was made for storage in PHP classes, rather than YAML or JSON
- * syntax, due to performance concerns.
- *
- * @package OpenCloud\Common\Api
- */
-interface ApiInterface
-{
-}
diff --git a/server/vendor/php-opencloud/common/src/Common/Api/Operation.php b/server/vendor/php-opencloud/common/src/Common/Api/Operation.php
deleted file mode 100644
index 927af5a..0000000
--- a/server/vendor/php-opencloud/common/src/Common/Api/Operation.php
+++ /dev/null
@@ -1,134 +0,0 @@
-<?php declare(strict_types=1);
-
-namespace OpenCloud\Common\Api;
-
-/**
- * This class represents an OpenCloud API operation. It encapsulates most aspects of the REST operation: its HTTP
- * method, the URL path, its top-level JSON key, and all of its {@see Parameter} objects.
- *
- * An operation not only represents a remote operation, but it also provides the mechanism for executing it
- * over HTTP. To do this, it uses a {@see ClientInterface} that allows a {@see GuzzleHttp\Message\Request}
- * to be created from the user values provided. Once this request is assembled, it is then sent to the
- * remote API and the response is returned to whoever first invoked the Operation class.
- *
- * @package OpenCloud\Common\Api
- */
-class Operation
-{
- /** @var string The HTTP method */
- private $method;
-
- /** @var string The URL path */
- private $path;
-
- /** @var string The top-level JSON key */
- private $jsonKey;
-
- /** @var []Parameter The parameters of this operation */
- private $params;
-
- /**
- * @param array $definition The data definition (in array form) that will populate this
- * operation. Usually this is retrieved from an {@see ApiInterface}
- * object method.
- */
- public function __construct(array $definition)
- {
- $this->method = $definition['method'];
- $this->path = $definition['path'];
-
- if (isset($definition['jsonKey'])) {
- $this->jsonKey = $definition['jsonKey'];
- }
-
- $this->params = self::toParamArray($definition['params']);
- }
-
- /**
- * @return string
- */
- public function getPath(): string
- {
- return $this->path;
- }
-
- /**
- * @return string
- */
- public function getMethod(): string
- {
- return $this->method;
- }
-
- /**
- * Indicates whether this operation supports a parameter.
- *
- * @param $key The name of a parameter
- *
- * @return bool
- */
- public function hasParam(string $key): bool
- {
- return isset($this->params[$key]);
- }
-
- /**
- * @param $name
- *
- * @return Parameter
- */
- public function getParam(string $name)
- {
- return isset($this->params[$name]) ? $this->params[$name] : null;
- }
-
- /**
- * @return string
- */
- public function getJsonKey(): string
- {
- return $this->jsonKey ?: '';
- }
-
- /**
- * A convenience method that will take a generic array of data and convert it into an array of
- * {@see Parameter} objects.
- *
- * @param array $data A generic data array
- *
- * @return array
- */
- public static function toParamArray(array $data): array
- {
- $params = [];
-
- foreach ($data as $name => $param) {
- $params[$name] = new Parameter($param + ['name' => $name]);
- }
-
- return $params;
- }
-
- /**
- * This method will validate all of the user-provided values and throw an exception if any
- * failures are detected. This is useful for basic sanity-checking before a request is
- * serialized and sent to the API.
- *
- * @param array $userValues The user-defined values
- *
- * @return bool TRUE if validation passes
- * @throws \Exception If validate fails
- */
- public function validate(array $userValues): bool
- {
- foreach ($this->params as $paramName => $param) {
- if (array_key_exists($paramName, $userValues)) {
- $param->validate($userValues[$paramName]);
- } elseif ($param->isRequired()) {
- throw new \Exception(sprintf('"%s" is a required option, but it was not provided', $paramName));
- }
- }
-
- return true;
- }
-} \ No newline at end of file
diff --git a/server/vendor/php-opencloud/common/src/Common/Api/Operator.php b/server/vendor/php-opencloud/common/src/Common/Api/Operator.php
deleted file mode 100644
index 5698779..0000000
--- a/server/vendor/php-opencloud/common/src/Common/Api/Operator.php
+++ /dev/null
@@ -1,175 +0,0 @@
-<?php declare(strict_types=1);
-
-namespace OpenCloud\Common\Api;
-
-use GuzzleHttp\Promise\PromiseInterface;
-use GuzzleHttp\Psr7\Uri;
-use function GuzzleHttp\uri_template;
-use GuzzleHttp\ClientInterface;
-use GuzzleHttp\Promise\Promise;
-use OpenCloud\Common\Resource\ResourceInterface;
-use OpenCloud\Common\Transport\RequestSerializer;
-use Psr\Http\Message\ResponseInterface;
-
-/**
- * {@inheritDoc}
- */
-abstract class Operator implements OperatorInterface
-{
- /** @var ClientInterface */
- protected $client;
-
- /** @var ApiInterface */
- protected $api;
-
- /**
- * {@inheritDoc}
- */
- public function __construct(ClientInterface $client, ApiInterface $api)
- {
- $this->client = $client;
- $this->api = $api;
- }
-
- /**
- * Magic method for dictating how objects are rendered when var_dump is called.
- * For the benefit of users, extremely verbose and heavy properties (such as HTTP clients) are
- * removed to provide easier access to normal state, such as resource attributes.
- *
- * @codeCoverageIgnore
- * @return array
- */
- public function __debugInfo()
- {
- $excludedVars = ['client', 'errorBuilder', 'api'];
-
- $output = [];
-
- foreach (get_object_vars($this) as $key => $val) {
- if (!in_array($key, $excludedVars)) {
- $output[$key] = $val;
- }
- }
-
- return $output;
- }
-
- /**
- * Retrieves a populated Operation according to the definition and values provided. A
- * HTTP client is also injected into the object to allow it to communicate with the remote API.
- *
- * @param array $definition The data that dictates how the operation works
- *
- * @return Operation
- */
- public function getOperation(array $definition): Operation
- {
- return new Operation($definition);
- }
-
- protected function sendRequest(Operation $operation, array $userValues = [], bool $async = false)
- {
- $operation->validate($userValues);
-
- $options = (new RequestSerializer)->serializeOptions($operation, $userValues);
- $method = $async ? 'requestAsync' : 'request';
- $uri = uri_template($operation->getPath(), $userValues);
-
- return $this->client->$method($operation->getMethod(), $uri, $options);
- }
-
- /**
- * {@inheritDoc}
- */
- public function execute(array $definition, array $userValues = []): ResponseInterface
- {
- return $this->sendRequest($this->getOperation($definition), $userValues);
- }
-
- /**
- * {@inheritDoc}
- */
- public function executeAsync(array $definition, array $userValues = []): PromiseInterface
- {
- return $this->sendRequest($this->getOperation($definition), $userValues, true);
- }
-
- /**
- * {@inheritDoc}
- */
- public function model(string $class, $data = null): ResourceInterface
- {
- $model = new $class($this->client, $this->api);
-
- // @codeCoverageIgnoreStart
- if (!$model instanceof ResourceInterface) {
- throw new \RuntimeException(sprintf('%s does not implement %s', $class, ResourceInterface::class));
- }
- // @codeCoverageIgnoreEnd
-
- if ($data instanceof ResponseInterface) {
- $model->populateFromResponse($data);
- } elseif (is_array($data)) {
- $model->populateFromArray($data);
- }
-
- return $model;
- }
-
- /**
- * Will create a new instance of this class with the current HTTP client and API injected in. This
- * is useful when enumerating over a collection since multiple copies of the same resource class
- * are needed.
- *
- * @return static
- */
- public function newInstance(): self
- {
- return new static($this->client, $this->api);
- }
-
- /**
- * @return \GuzzleHttp\Psr7\Uri:null
- */
- protected function getHttpBaseUrl()
- {
- return $this->client->getConfig('base_uri');
- }
-
- /**
- * Magic method which intercepts async calls, finds the sequential version, and wraps it in a
- * {@see Promise} object. In order for this to happen, the called methods need to be in the
- * following format: `createAsync`, where `create` is the sequential method being wrapped.
- *
- * @param $methodName The name of the method being invoked.
- * @param $args The arguments to be passed to the sequential method.
- *
- * @throws \RuntimeException If method does not exist
- *
- * @return Promise
- */
- public function __call($methodName, $args)
- {
- $e = function ($name) {
- return new \RuntimeException(sprintf('%s::%s is not defined', get_class($this), $name));
- };
-
- if (substr($methodName, -5) === 'Async') {
- $realMethod = substr($methodName, 0, -5);
- if (!method_exists($this, $realMethod)) {
- throw $e($realMethod);
- }
-
- $promise = new Promise(
- function () use (&$promise, $realMethod, $args) {
- $value = call_user_func_array([$this, $realMethod], $args);
- $promise->resolve($value);
- }
- );
-
- return $promise;
- }
-
- throw $e($methodName);
- }
-}
diff --git a/server/vendor/php-opencloud/common/src/Common/Api/OperatorInterface.php b/server/vendor/php-opencloud/common/src/Common/Api/OperatorInterface.php
deleted file mode 100644
index 168518b..0000000
--- a/server/vendor/php-opencloud/common/src/Common/Api/OperatorInterface.php
+++ /dev/null
@@ -1,54 +0,0 @@
-<?php declare(strict_types=1);
-
-namespace OpenCloud\Common\Api;
-
-use GuzzleHttp\ClientInterface;
-use GuzzleHttp\Promise\PromiseInterface;
-use OpenCloud\Common\Resource\ResourceInterface;
-use Psr\Http\Message\ResponseInterface;
-
-/**
- * An operator is any resource or service that can invoke and send REST operations. In other words, it
- * is any class that can send requests and receive responses with a HTTP client. To do this
- * it needs two things: a {@see ClientInterface} for handling HTTP transactions and an {@see ApiInterface}
- * for handling how operations are created.
- *
- * @package OpenCloud\Common\Api
- */
-interface OperatorInterface
-{
- /**
- * @param ClientInterface $client The HTTP client responsible for handling HTTP transactions
- * @param ApiInterface $api The data API class that dictates how REST operations are structured
- */
- public function __construct(ClientInterface $client, ApiInterface $api);
-
- /**
- * A convenience method that assembles an operation and sends it to the remote API
- *
- * @param array $definition The data that dictates how the operation works
- * @param array $userValues The user-defined values that populate the request
- *
- * @return \Psr\Http\Message\ResponseInterface
- */
- public function execute(array $definition, array $userValues = []): ResponseInterface;
-
- /**
- * A convenience method that assembles an operation and asynchronously sends it to the remote API
- *
- * @param array $definition The data that dictates how the operation works
- * @param array $userValues The user-defined values that populate the request
- *
- * @return \GuzzleHttp\Promise\PromiseInterface
- */
- public function executeAsync(array $definition, array $userValues = []): PromiseInterface;
-
- /**
- * @param string $name The name of the model class.
- * @param mixed $data Either a {@see ResponseInterface} or data array that will populate the newly
- * created model class.
- *
- * @return \OpenCloud\Common\Resource\ResourceInterface
- */
- public function model(string $name, $data = null): ResourceInterface;
-}
diff --git a/server/vendor/php-opencloud/common/src/Common/Api/Parameter.php b/server/vendor/php-opencloud/common/src/Common/Api/Parameter.php
deleted file mode 100644
index f1ec7c7..0000000
--- a/server/vendor/php-opencloud/common/src/Common/Api/Parameter.php
+++ /dev/null
@@ -1,389 +0,0 @@
-<?php declare(strict_types=1);
-
-namespace OpenCloud\Common\Api;
-
-use OpenCloud\Common\HydratorStrategyTrait;
-
-/**
- * Represents an individual request parameter in a RESTful operation. A parameter can take on many forms:
- * in a URL path, in a URL query, in a JSON body, and in a HTTP header. It is worth documenting brifly each
- * variety of parameter:
- *
- * * Header parameters are those which populate a HTTP header in a request. Header parameters can have
- * aliases; for example, a user-facing name of "Foo" can be sent over the wire as "X-Foo_Bar", as defined
- * by ``sentAs``. Prefixes can also be used.
- *
- * * Query parameters are those which populate a URL query parameter. The value is therefore usually
- * confined to a string.
- *
- * * JSON parameters are those which populate a JSON request body. These are the most complex variety
- * of Parameter, since there are so many different ways a JSON document can be constructed. The SDK
- * supports deep-nesting according to a XPath syntax; for more information, see {@see \OpenCloud\Common\JsonPath}.
- * Nested object and array properties are also supported since JSON is a recursive data type. What
- * this means is that a Parameter can have an assortment of child Parameters, one for each object
- * property or array element.
- *
- * * Raw parameters are those which populate a non-JSON request body. This is typically used for
- * uploading payloads (such as Swift object data) to a remote API.
- *
- * * Path parameters are those which populate a URL path. They are serialized according to URL
- * placeholders.
- *
- * @package OpenCloud\Common\Api
- */
-class Parameter
-{
- use HydratorStrategyTrait;
-
- const DEFAULT_LOCATION = 'json';
-
- /**
- * The human-friendly name of the parameter. This is what the user will input.
- *
- * @var string
- */
- private $name = '';
-
- /**
- * The alias for this parameter. Although the user will always interact with the human-friendly $name property,
- * the $sentAs is what's used over the wire.
- *
- * @var string
- */
- private $sentAs = '';
-
- /**
- * For array parameters (for example, an array of security group names when creating a server), each array element
- * will need to adhere to a common schema. For the aforementioned example, each element will need to be a string.
- * For more complicated parameters, you might be validated an array of complicated objects.
- *
- * @var Parameter
- */
- private $itemSchema;
-
- /**
- * For object parameters, each property will need to adhere to a specific schema. For every property in the
- * object, it has its own schema - meaning that this property is a hash of name/schema pairs.
- *
- * The *only* exception to this rule is for metadata parameters, which are arbitrary key/value pairs. Since it does
- * not make sense to have a schema for each metadata key, a common schema is use for every one. So instead of this
- * property being a hash of schemas, it is a single Parameter object instead. This single Parameter schema will
- * then be applied to each metadata key provided.
- *
- * @var []Parameter|Parameter
- */
- private $properties;
-
- /**
- * The value's PHP type which this parameter represents; either "string", "bool", "object", "array", "NULL".
- *
- * @var string
- */
- private $type = '';
-
- /**
- * Indicates whether this parameter requires a value from the user.
- *
- * @var bool
- */
- private $required;
-
- /**
- * The location in the HTTP request where this parameter will populate; either "header", "url", "query", "raw" or
- * "json".
- *
- * @var string
- */
- private $location = '';
-
- /**
- * Relevant to "json" location parameters only. This property allows for deep nesting through the use of
- * {@see OpenCloud\Common\JsonPath}.
- *
- * @var string
- */
- private $path = '';
-
- /**
- * Allows for the prefixing of parameter names.
- *
- * @var string
- */
- private $prefix = '';
-
- /**
- * The enum values for which this param is restricted.
- *
- * @var array
- */
- private $enum;
-
- /**
- * @param array $data
- */
- public function __construct(array $data)
- {
- $this->hydrate($data);
-
- $this->required = (bool)$this->required;
-
- $this->stockLocation($data);
- $this->stockItemSchema($data);
- $this->stockProperties($data);
- }
-
- private function stockLocation(array $data)
- {
- $this->location = isset($data['location']) ? $data['location'] : self::DEFAULT_LOCATION;
-
- if (!AbstractParams::isSupportedLocation($this->location)) {
- throw new \RuntimeException(sprintf("%s is not a permitted location", $this->location));
- }
- }
-
- private function stockItemSchema(array $data)
- {
- if (isset($data['items'])) {
- $this->itemSchema = new Parameter($data['items']);
- }
- }
-
- private function stockProperties(array $data)
- {
- if (isset($data['properties'])) {
- if ($this->name && stripos($this->name, 'metadata') !== false) {
- $this->properties = new Parameter($data['properties']);
- } else {
- foreach ($data['properties'] as $name => $property) {
- $this->properties[$name] = new Parameter($property + ['name' => $name]);
- }
- }
- }
- }
-
- /**
- * Retrieve the name that will be used over the wire.
- *
- * @return string
- */
- public function getName(): string
- {
- return $this->sentAs ?: $this->name;
- }
-
- /**
- * Indicates whether the user must provide a value for this parameter.
- *
- * @return bool
- */
- public function isRequired(): bool
- {
- return $this->required === true;
- }
-
- /**
- * Validates a given user value and checks whether it passes basic sanity checking, such as types.
- *
- * @param $userValues The value provided by the user
- *
- * @return bool TRUE if the validation passes
- * @throws \Exception If validation fails
- */
- public function validate($userValues): bool
- {
- $this->validateEnums($userValues);
- $this->validateType($userValues);
-
- if ($this->isArray()) {
- $this->validateArray($userValues);
- } elseif ($this->isObject()) {
- $this->validateObject($userValues);
- }
-
- return true;
- }
-
- 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)
- ));
- }
- }
-
- 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
- ));
- }
- }
-
- private function validateArray($userValues)
- {
- foreach ($userValues as $userValue) {
- $this->itemSchema->validate($userValue);
- }
- }
-
- private function validateObject($userValues)
- {
- foreach ($userValues as $key => $userValue) {
- $property = $this->getNestedProperty($key);
- $property->validate($userValue);
- }
- }
-
- /**
- * Internal method which retrieves a nested property for object parameters.
- *
- * @param $key The name of the child parameter
- *
- * @returns Parameter
- * @throws \Exception
- */
- private function getNestedProperty($key): Parameter
- {
- if ($this->name && stripos($this->name, 'metadata') !== false && $this->properties instanceof Parameter) {
- return $this->properties;
- } elseif (isset($this->properties[$key])) {
- return $this->properties[$key];
- } else {
- throw new \Exception(sprintf('The key provided "%s" is not defined', $key));
- }
- }
-
- /**
- * Internal method which indicates whether the user value is of the same type as the one expected
- * by this parameter.
- *
- * @param $userValue The value being checked
- *
- * @return bool
- */
- private function hasCorrectType($userValue): bool
- {
- // Helper fn to see whether an array is associative (i.e. a JSON object)
- $isAssociative = function ($value) {
- return is_array($value) && array_keys($value) !== range(0, count($value) - 1);
- };
-
- // For params defined as objects, we'll let the user get away with
- // passing in an associative array - since it's effectively a hash
- if ($this->type == 'object' && $isAssociative($userValue)) {
- return true;
- }
-
- if (class_exists($this->type) || interface_exists($this->type)) {
- return is_a($userValue, $this->type);
- }
-
- if (!$this->type) {
- return true;
- }
-
- return gettype($userValue) == $this->type;
- }
-
- /**
- * Indicates whether this parameter represents an array type
- *
- * @return bool
- */
- public function isArray(): bool
- {
- return $this->type == 'array' && $this->itemSchema instanceof Parameter;
- }
-
- /**
- * Indicates whether this parameter represents an object type
- *
- * @return bool
- */
- public function isObject(): bool
- {
- return $this->type == 'object' && !empty($this->properties);
- }
-
- public function getLocation(): string
- {
- return $this->location;
- }
-
- /**
- * Verifies whether the given location matches the parameter's location.
- *
- * @param $value
- *
- * @return bool
- */
- public function hasLocation($value): bool
- {
- return $this->location == $value;
- }
-
- /**
- * Retrieves the parameter's path.
- *
- * @return string|null
- */
- public function getPath(): string
- {
- return $this->path;
- }
-
- /**
- * Retrieves the common schema that an array parameter applies to all its child elements.
- *
- * @return Parameter|null
- */
- public function getItemSchema()
- {
- return $this->itemSchema;
- }
-
- /**
- * Sets the name of the parameter to a new value
- *
- * @param string $name
- */
- public function setName(string $name)
- {
- $this->name = $name;
- }
-
- /**
- * Retrieves the child parameter for an object parameter.
- *
- * @param string $name The name of the child property
- *
- * @return null|Parameter
- */
- public function getProperty(string $name)
- {
- if ($this->properties instanceof Parameter) {
- $this->properties->setName($name);
- return $this->properties;
- }
-
- return isset($this->properties[$name]) ? $this->properties[$name] : null;
- }
-
- /**
- * Retrieves the prefix for a parameter, if any.
- *
- * @return string|null
- */
- public function getPrefix(): string
- {
- return $this->prefix;
- }
-
- public function getPrefixedName(): string
- {
- return $this->prefix . $this->getName();
- }
-}
diff --git a/server/vendor/php-opencloud/common/src/Common/ArrayAccessTrait.php b/server/vendor/php-opencloud/common/src/Common/ArrayAccessTrait.php
deleted file mode 100644
index a9e3aba..0000000
--- a/server/vendor/php-opencloud/common/src/Common/ArrayAccessTrait.php
+++ /dev/null
@@ -1,67 +0,0 @@
-<?php declare(strict_types=1);
-
-namespace OpenCloud\Common;
-
-/**
- * Encapsulates common logic for classes which implement the SPL \ArrayAccess interface.
- *
- * @package OpenCloud\Common
- */
-trait ArrayAccessTrait
-{
- /**
- * The internal state that this object represents
- *
- * @var array
- */
- private $internalState = [];
-
- /**
- * Sets an internal key with a value.
- *
- * @param string $offset
- * @param mixed $value
- */
- public function offsetSet($offset, $value)
- {
- if (null === $offset) {
- $this->internalState[] = $value;
- } else {
- $this->internalState[$offset] = $value;
- }
- }
-
- /**
- * Checks whether an internal key exists.
- *
- * @param string $offset
- *
- * @return bool
- */
- public function offsetExists(string $offset): bool
- {
- return isset($this->internalState[$offset]);
- }
-
- /**
- * Unsets an internal key.
- *
- * @param string $offset
- */
- public function offsetUnset(string $offset)
- {
- unset($this->internalState[$offset]);
- }
-
- /**
- * Retrieves an internal key.
- *
- * @param string $offset
- *
- * @return mixed|null
- */
- public function offsetGet(string $offset)
- {
- return $this->offsetExists($offset) ? $this->internalState[$offset] : null;
- }
-}
diff --git a/server/vendor/php-opencloud/common/src/Common/Auth/AuthHandler.php b/server/vendor/php-opencloud/common/src/Common/Auth/AuthHandler.php
deleted file mode 100644
index 61a07c9..0000000
--- a/server/vendor/php-opencloud/common/src/Common/Auth/AuthHandler.php
+++ /dev/null
@@ -1,76 +0,0 @@
-<?php declare(strict_types=1);
-
-namespace OpenCloud\Common\Auth;
-
-use function GuzzleHttp\Psr7\modify_request;
-use Psr\Http\Message\RequestInterface;
-
-/**
- * This class is responsible for three tasks:
- *
- * 1. performing the initial authentication for OpenCloud services
- * 2. populating the ``X-Auth-Token`` header for every HTTP request
- * 3. checking the token expiry before each request, and re-authenticating if necessary
- */
-class AuthHandler
-{
- /** @var callable */
- private $nextHandler;
-
- /** @var callable */
- private $tokenGenerator;
-
- /** @var Token */
- private $token;
-
- /**
- * @param callable $nextHandler
- * @param callable $tokenGenerator
- */
- public function __construct(callable $nextHandler, callable $tokenGenerator, Token $token = null)
- {
- $this->nextHandler = $nextHandler;
- $this->tokenGenerator = $tokenGenerator;
- $this->token = $token;
- }
-
- /**
- * This method is invoked before every HTTP request is sent to the API. When this happens, it
- * checks to see whether a token is set and valid, and then sets the ``X-Auth-Token`` header
- * for the HTTP request before letting it continue on its merry way.
- *
- * @param RequestInterface $request
- * @param array $options
- *
- * @return mixed|void
- */
- public function __invoke(RequestInterface $request, array $options)
- {
- $fn = $this->nextHandler;
-
- if ($this->shouldIgnore($request)) {
- return $fn($request, $options);
- }
-
- if (!$this->token || $this->token->hasExpired()) {
- $this->token = call_user_func($this->tokenGenerator);
- }
-
- $modify = ['set_headers' => ['X-Auth-Token' => $this->token->getId()]];
-
- return $fn(modify_request($request, $modify), $options);
- }
-
- /**
- * Internal method which prevents infinite recursion. For certain requests, like the initial
- * auth call itself, we do NOT want to send a token.
- *
- * @param RequestInterface $request
- *
- * @return bool
- */
- private function shouldIgnore(RequestInterface $request): bool
- {
- return strpos((string) $request->getUri(), 'tokens') !== false && $request->getMethod() == 'POST';
- }
-}
diff --git a/server/vendor/php-opencloud/common/src/Common/Auth/Catalog.php b/server/vendor/php-opencloud/common/src/Common/Auth/Catalog.php
deleted file mode 100644
index 22ebc09..0000000
--- a/server/vendor/php-opencloud/common/src/Common/Auth/Catalog.php
+++ /dev/null
@@ -1,20 +0,0 @@
-<?php declare(strict_types=1);
-
-namespace OpenCloud\Common\Auth;
-
-interface Catalog
-{
- /**
- * Attempts to retrieve the base URL for a service from the catalog according to the arguments provided.
- *
- * @param string $name The name of the service as it appears in the catalog
- * @param string $type The type of the service as it appears in the catalog
- * @param string $region The region of the service as it appears in the catalog
- * @param string $urlType The URL type of the service as it appears in the catalog
- *
- * @throws \RuntimeException If no endpoint is matched
- *
- * @returns string
- */
- public function getServiceUrl(string $name, string $type, string $region, string $urlType): string;
-}
diff --git a/server/vendor/php-opencloud/common/src/Common/Auth/IdentityService.php b/server/vendor/php-opencloud/common/src/Common/Auth/IdentityService.php
deleted file mode 100644
index 1f1d91f..0000000
--- a/server/vendor/php-opencloud/common/src/Common/Auth/IdentityService.php
+++ /dev/null
@@ -1,13 +0,0 @@
-<?php declare(strict_types=1);
-
-namespace OpenCloud\Common\Auth;
-
-interface IdentityService
-{
- /**
- * Authenticates and retrieves back a token and catalog.
- *
- * @return array The FIRST key is {@see Token} instance, the SECOND key is a {@see Catalog} instance
- */
- public function authenticate(array $options): array;
-}
diff --git a/server/vendor/php-opencloud/common/src/Common/Auth/Token.php b/server/vendor/php-opencloud/common/src/Common/Auth/Token.php
deleted file mode 100644
index 642ea46..0000000
--- a/server/vendor/php-opencloud/common/src/Common/Auth/Token.php
+++ /dev/null
@@ -1,15 +0,0 @@
-<?php declare(strict_types=1);
-
-namespace OpenCloud\Common\Auth;
-
-interface Token
-{
- public function getId(): string;
-
- /**
- * Indicates whether the token has expired or not.
- *
- * @return bool TRUE if the token has expired, FALSE if it is still valid
- */
- public function hasExpired(): bool;
-}
diff --git a/server/vendor/php-opencloud/common/src/Common/Error/BadResponseError.php b/server/vendor/php-opencloud/common/src/Common/Error/BadResponseError.php
deleted file mode 100644
index faa7128..0000000
--- a/server/vendor/php-opencloud/common/src/Common/Error/BadResponseError.php
+++ /dev/null
@@ -1,40 +0,0 @@
-<?php declare(strict_types=1);
-
-namespace OpenCloud\Common\Error;
-
-use Psr\Http\Message\RequestInterface;
-use Psr\Http\Message\ResponseInterface;
-
-/**
- * Represents a HTTP-specific error, caused by 4xx or 5xx response statuses.
- *
- * @package OpenCloud\Common\Error
- */
-class BadResponseError extends BaseError
-{
- /** @var RequestInterface */
- private $request;
-
- /** @var ResponseInterface */
- private $response;
-
- public function setRequest(RequestInterface $request)
- {
- $this->request = $request;
- }
-
- public function setResponse(ResponseInterface $response)
- {
- $this->response = $response;
- }
-
- public function getRequest(): RequestInterface
- {
- return $this->request;
- }
-
- public function getResponse(): ResponseInterface
- {
- return $this->response;
- }
-}
diff --git a/server/vendor/php-opencloud/common/src/Common/Error/BaseError.php b/server/vendor/php-opencloud/common/src/Common/Error/BaseError.php
deleted file mode 100644
index 1776890..0000000
--- a/server/vendor/php-opencloud/common/src/Common/Error/BaseError.php
+++ /dev/null
@@ -1,12 +0,0 @@
-<?php declare(strict_types=1);
-
-namespace OpenCloud\Common\Error;
-
-/**
- * Base error class.
- *
- * @package OpenCloud\Common\Error
- */
-class BaseError extends \Exception
-{
-}
diff --git a/server/vendor/php-opencloud/common/src/Common/Error/Builder.php b/server/vendor/php-opencloud/common/src/Common/Error/Builder.php
deleted file mode 100644
index f9762b7..0000000
--- a/server/vendor/php-opencloud/common/src/Common/Error/Builder.php
+++ /dev/null
@@ -1,179 +0,0 @@
-<?php declare(strict_types=1);
-
-namespace OpenCloud\Common\Error;
-
-use GuzzleHttp\Client;
-use GuzzleHttp\ClientInterface;
-use GuzzleHttp\Exception\ClientException;
-use Psr\Http\Message\MessageInterface;
-use Psr\Http\Message\RequestInterface;
-use Psr\Http\Message\ResponseInterface;
-
-/**
- * Class responsible for building meaningful exceptions. For HTTP problems, it produces a {@see HttpError}
- * exception, and supplies a error message with reasonable defaults. For user input problems, it produces a
- * {@see UserInputError} exception. For both, the problem is described, a potential solution is offered and
- * a link to further information is included.
- *
- * @package OpenCloud\Common\Error
- */
-class Builder
-{
- /**
- * The default domain to use for further link documentation.
- *
- * @var string
- */
- private $docDomain = 'http://docs.php-opencloud.com/en/latest/';
-
- /**
- * The HTTP client required to validate the further links.
- *
- * @var ClientInterface
- */
- private $client;
-
- /**
- * @param ClientInterface $client
- */
- public function __construct(ClientInterface $client = null)
- {
- $this->client = $client ?: new Client();
- }
-
- /**
- * Internal method used when outputting headers in the error description.
- *
- * @param $name
- *
- * @return string
- */
- private function header(string $name): string
- {
- return sprintf("%s\n%s\n", $name, str_repeat('~', strlen($name)));
- }
-
- /**
- * Before outputting custom links, it is validated to ensure that the user is not
- * directed off to a broken link. If a 404 is detected, it is hidden.
- *
- * @param $link The proposed link
- *
- * @return bool
- */
- private function linkIsValid(string $link): bool
- {
- $link = $this->docDomain . $link;
-
- try {
- return $this->client->request('HEAD', $link)->getStatusCode() < 400;
- } catch (ClientException $e) {
- return false;
- }
- }
-
- /**
- * @param MessageInterface $message
- *
- * @codeCoverageIgnore
- * @return string
- */
- public function str(MessageInterface $message): string
- {
- if ($message instanceof RequestInterface) {
- $msg = trim($message->getMethod() . ' '
- . $message->getRequestTarget())
- . ' HTTP/' . $message->getProtocolVersion();
- if (!$message->hasHeader('host')) {
- $msg .= "\r\nHost: " . $message->getUri()->getHost();
- }
- } elseif ($message instanceof ResponseInterface) {
- $msg = 'HTTP/' . $message->getProtocolVersion() . ' '
- . $message->getStatusCode() . ' '
- . $message->getReasonPhrase();
- }
-
- foreach ($message->getHeaders() as $name => $values) {
- $msg .= "\r\n{$name}: " . implode(', ', $values);
- }
-
- if ($message->getBody()->getSize() < ini_get('memory_limit')) {
- $msg .= "\r\n\r\n" . $message->getBody();
- }
-
- return $msg;
- }
-
- /**
- * Helper method responsible for constructing and returning {@see BadResponseError} exceptions.
- *
- * @param RequestInterface $request The faulty request
- * @param ResponseInterface $response The error-filled response
- *
- * @return BadResponseError
- */
- public function httpError(RequestInterface $request, ResponseInterface $response): BadResponseError
- {
- $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 .= $this->header('Request');
- $message .= trim($this->str($request)) . PHP_EOL . PHP_EOL;
-
- $message .= $this->header('Response');
- $message .= trim($this->str($response)) . PHP_EOL . PHP_EOL;
-
- $message .= $this->header('Further information');
- $message .= $this->getStatusCodeMessage($response->getStatusCode());
-
- $message .= "Visit http://docs.php-opencloud.com/en/latest/http-codes for more information about debugging "
- . "HTTP status codes, or file a support issue on https://github.com/php-opencloud/openstack/issues.";
-
- $e = new BadResponseError($message);
- $e->setRequest($request);
- $e->setResponse($response);
-
- return $e;
- }
-
- private function getStatusCodeMessage(int $statusCode): string
- {
- $errors = [
- 400 => 'Please ensure that your input values are valid and well-formed. ',
- 401 => 'Please ensure that your authentication credentials are valid. ',
- 404 => "Please ensure that the resource you're trying to access actually exists. ",
- 500 => 'Please try this operation again once you know the remote server is operational. ',
- ];
-
- return isset($errors[$statusCode]) ? $errors[$statusCode] : '';
- }
-
- /**
- * Helper method responsible for constructing and returning {@see UserInputError} exceptions.
- *
- * @param string $expectedType The type that was expected from the user
- * @param mixed $userValue The incorrect value the user actually provided
- * @param string|null $furtherLink A link to further information if necessary (optional).
- *
- * @return UserInputError
- */
- public function userInputError(string $expectedType, $userValue, string $furtherLink = null): UserInputError
- {
- $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 .= "Please ensure that the value adheres to the expectation above. ";
-
- if ($furtherLink && $this->linkIsValid($furtherLink)) {
- $message .= sprintf("Visit %s for more information about input arguments. ", $this->docDomain . $furtherLink);
- }
-
- $message .= 'If you run into trouble, please open a support issue on https://github.com/php-opencloud/openstack/issues.';
-
- return new UserInputError($message);
- }
-}
diff --git a/server/vendor/php-opencloud/common/src/Common/Error/NotImplementedError.php b/server/vendor/php-opencloud/common/src/Common/Error/NotImplementedError.php
deleted file mode 100644
index db18f62..0000000
--- a/server/vendor/php-opencloud/common/src/Common/Error/NotImplementedError.php
+++ /dev/null
@@ -1,12 +0,0 @@
-<?php declare(strict_types=1);
-
-namespace OpenCloud\Common\Error;
-
-/**
- * Error to indicate functionality which has not been implemented yet.
- *
- * @package OpenCloud\Common\Error
- */
-class NotImplementedError extends BaseError
-{
-}
diff --git a/server/vendor/php-opencloud/common/src/Common/Error/UserInputError.php b/server/vendor/php-opencloud/common/src/Common/Error/UserInputError.php
deleted file mode 100644
index e92ab92..0000000
--- a/server/vendor/php-opencloud/common/src/Common/Error/UserInputError.php
+++ /dev/null
@@ -1,12 +0,0 @@
-<?php declare(strict_types=1);
-
-namespace OpenCloud\Common\Error;
-
-/**
- * Represents a user input error, caused by an incorrect type or malformed value.
- *
- * @package OpenCloud\Common\Error
- */
-class UserInputError extends BaseError
-{
-}
diff --git a/server/vendor/php-opencloud/common/src/Common/HydratorStrategyTrait.php b/server/vendor/php-opencloud/common/src/Common/HydratorStrategyTrait.php
deleted file mode 100644
index 5b87ad6..0000000
--- a/server/vendor/php-opencloud/common/src/Common/HydratorStrategyTrait.php
+++ /dev/null
@@ -1,35 +0,0 @@
-<?php declare(strict_types=1);
-
-namespace OpenCloud\Common;
-
-/**
- * Represents common functionality for populating, or "hydrating", an object with arbitrary data.
- *
- * @package OpenCloud\Common
- */
-trait HydratorStrategyTrait
-{
- /**
- * Hydrates an object with set data
- *
- * @param array $data The data to set
- * @param array $aliases Any aliases
- */
- private function hydrate(array $data, array $aliases = [])
- {
- foreach ($data as $key => $val) {
- $key = isset($aliases[$key]) ? $aliases[$key] : $key;
- if (property_exists($this, $key)) {
- $this->$key = $val;
- }
- }
- }
-
- private function set(string $key, $property, array $data, callable $fn = null)
- {
- if (isset($data[$key]) && property_exists($this, $property)) {
- $value = $fn ? call_user_func($fn, $data[$key]) : $data[$key];
- $this->$property = $value;
- }
- }
-}
diff --git a/server/vendor/php-opencloud/common/src/Common/JsonPath.php b/server/vendor/php-opencloud/common/src/Common/JsonPath.php
deleted file mode 100644
index b1a7b34..0000000
--- a/server/vendor/php-opencloud/common/src/Common/JsonPath.php
+++ /dev/null
@@ -1,122 +0,0 @@
-<?php declare(strict_types = 1);
-
-namespace OpenCloud\Common;
-
-/**
- * This class allows arbitrary data structures to be inserted into, and extracted from, deep arrays
- * and JSON-serialized strings. Say, for example, that you have this array as an input:
- *
- * <pre><code>['foo' => ['bar' => ['baz' => 'some_value']]]</code></pre>
- *
- * and you wanted to insert or extract an element. Usually, you would use:
- *
- * <pre><code>$array['foo']['bar']['baz'] = 'new_value';</code></pre>
- *
- * but sometimes you do not have access to the variable - so a string representation is needed. Using
- * XPath-like syntax, this class allows you to do this:
- *
- * <pre><code>$jsonPath = new JsonPath($array);
- * $jsonPath->set('foo.bar.baz', 'new_value');
- * $val = $jsonPath->get('foo.bar.baz');
- * </code></pre>
- *
- * @package OpenCloud\Common
- */
-class JsonPath
-{
- /** @var array */
- private $jsonStructure;
-
- /**
- * @param $structure The initial data structure to extract from and insert into. Typically this will be a
- * multidimensional associative array; but well-formed JSON strings are also acceptable.
- */
- public function __construct($structure)
- {
- $this->jsonStructure = is_string($structure) ? json_decode($structure, true) : $structure;
- }
-
- /**
- * Set a node in the structure
- *
- * @param $path The XPath to use
- * @param $value The new value of the node
- */
- public function set(string $path, $value)
- {
- $this->jsonStructure = $this->setPath($path, $value, $this->jsonStructure);
- }
-
- /**
- * Internal method for recursive calls.
- *
- * @param $path
- * @param $value
- * @param $json
- *
- * @return mixed
- */
- private function setPath(string $path, $value, array $json): array
- {
- $nodes = explode('.', $path);
- $point = array_shift($nodes);
-
- if (!isset($json[$point])) {
- $json[$point] = [];
- }
-
- if (!empty($nodes)) {
- $json[$point] = $this->setPath(implode('.', $nodes), $value, $json[$point]);
- } else {
- $json[$point] = $value;
- }
-
- return $json;
- }
-
- /**
- * Return the updated structure.
- *
- * @return mixed
- */
- public function getStructure()
- {
- return $this->jsonStructure;
- }
-
- /**
- * Get a path's value. If no path can be matched, NULL is returned.
- *
- * @param $path
- *
- * @return mixed|null
- */
- public function get(string $path)
- {
- return $this->getPath($path, $this->jsonStructure);
- }
-
- /**
- * Internal method for recursion.
- *
- * @param $path
- * @param $json
- *
- * @return null
- */
- private function getPath(string $path, $json)
- {
- $nodes = explode('.', $path);
- $point = array_shift($nodes);
-
- if (!isset($json[$point])) {
- return null;
- }
-
- if (empty($nodes)) {
- return $json[$point];
- } else {
- return $this->getPath(implode('.', $nodes), $json[$point]);
- }
- }
-}
diff --git a/server/vendor/php-opencloud/common/src/Common/JsonSchema/JsonPatch.php b/server/vendor/php-opencloud/common/src/Common/JsonSchema/JsonPatch.php
deleted file mode 100644
index 74d2a78..0000000
--- a/server/vendor/php-opencloud/common/src/Common/JsonSchema/JsonPatch.php
+++ /dev/null
@@ -1,117 +0,0 @@
-<?php declare(strict_types=1);
-
-namespace OpenCloud\Common\JsonSchema;
-
-class JsonPatch
-{
- const OP_ADD = 'add';
- const OP_REPLACE = 'replace';
- const OP_REMOVE = 'remove';
-
- public static function diff($src, $dest)
- {
- return (new static)->makeDiff($src, $dest);
- }
-
- public function makeDiff($srcStruct, $desStruct, string $path = ''): array
- {
- $changes = [];
-
- if (is_object($srcStruct)) {
- $changes = $this->handleObject($srcStruct, $desStruct, $path);
- } elseif (is_array($srcStruct)) {
- $changes = $this->handleArray($srcStruct, $desStruct, $path);
- } elseif ($srcStruct != $desStruct) {
- $changes[] = $this->makePatch(self::OP_REPLACE, $path, $desStruct);
- }
-
- return $changes;
- }
-
- protected function handleArray(array $srcStruct, array $desStruct, string $path): array
- {
- $changes = [];
-
- if ($diff = $this->arrayDiff($desStruct, $srcStruct)) {
- foreach ($diff as $key => $val) {
- if (is_object($val)) {
- $changes = array_merge($changes, $this->makeDiff($srcStruct[$key], $val, $this->path($path, $key)));
- } else {
- $op = array_key_exists($key, $srcStruct) && !in_array($srcStruct[$key], $desStruct, true)
- ? self::OP_REPLACE : self::OP_ADD;
- $changes[] = $this->makePatch($op, $this->path($path, $key), $val);
- }
- }
- } elseif ($srcStruct != $desStruct) {
- foreach ($srcStruct as $key => $val) {
- if (!in_array($val, $desStruct, true)) {
- $changes[] = $this->makePatch(self::OP_REMOVE, $this->path($path, $key));
- }
- }
- }
-
- return $changes;
- }
-
- protected function handleObject(\stdClass $srcStruct, \stdClass $desStruct, string $path): array
- {
- $changes = [];
-
- if ($this->shouldPartiallyReplace($srcStruct, $desStruct)) {
- foreach ($desStruct as $key => $val) {
- if (!property_exists($srcStruct, $key)) {
- $changes[] = $this->makePatch(self::OP_ADD, $this->path($path, $key), $val);
- } elseif ($srcStruct->$key != $val) {
- $changes = array_merge($changes, $this->makeDiff($srcStruct->$key, $val, $this->path($path, $key)));
- }
- }
- } elseif ($this->shouldPartiallyReplace($desStruct, $srcStruct)) {
- foreach ($srcStruct as $key => $val) {
- if (!property_exists($desStruct, $key)) {
- $changes[] = $this->makePatch(self::OP_REMOVE, $this->path($path, $key));
- }
- }
- }
-
- return $changes;
- }
-
- protected function shouldPartiallyReplace(\stdClass $o1, \stdClass $o2): bool
- {
- return count(array_diff_key((array) $o1, (array) $o2)) < count($o1);
- }
-
- protected function arrayDiff(array $a1, array $a2): array
- {
- $result = [];
-
- foreach ($a1 as $key => $val) {
- if (!in_array($val, $a2, true)) {
- $result[$key] = $val;
- }
- }
-
- return $result;
- }
-
- protected function path(string $root, $path): string
- {
- $path = (string) $path;
-
- if ($path === '_empty_') {
- $path = '';
- }
-
- return rtrim($root, '/') . '/' . ltrim($path, '/');
- }
-
- protected function makePatch(string $op, string $path, $val = null): array
- {
- switch ($op) {
- default:
- return ['op' => $op, 'path' => $path, 'value' => $val];
- case self::OP_REMOVE:
- return ['op' => $op, 'path' => $path];
- }
- }
-}
diff --git a/server/vendor/php-opencloud/common/src/Common/JsonSchema/Schema.php b/server/vendor/php-opencloud/common/src/Common/JsonSchema/Schema.php
deleted file mode 100644
index e1e3f65..0000000
--- a/server/vendor/php-opencloud/common/src/Common/JsonSchema/Schema.php
+++ /dev/null
@@ -1,75 +0,0 @@
-<?php declare(strict_types=1);
-
-namespace OpenCloud\Common\JsonSchema;
-
-use JsonSchema\Validator;
-
-class Schema
-{
- /** @var object */
- private $body;
-
- /** @var Validator */
- private $validator;
-
- public function __construct($body, Validator $validator = null)
- {
- $this->body = (object) $body;
- $this->validator = $validator ?: new Validator();
- }
-
- public function getPropertyPaths(): array
- {
- $paths = [];
-
- foreach ($this->body->properties as $propertyName => $property) {
- $paths[] = sprintf("/%s", $propertyName);
- }
-
- return $paths;
- }
-
- public function normalizeObject($subject, array $aliases): \stdClass
- {
- $out = new \stdClass;
-
- foreach ($this->body->properties as $propertyName => $property) {
- $name = isset($aliases[$propertyName]) ? $aliases[$propertyName] : $propertyName;
- if (isset($property->readOnly) && $property->readOnly === true) {
- continue;
- } elseif (property_exists($subject, $name)) {
- $out->$propertyName = $subject->$name;
- } elseif (property_exists($subject, $propertyName)) {
- $out->$propertyName = $subject->$propertyName;
- }
- }
-
- return $out;
- }
-
- public function validate($data)
- {
- $this->validator->check($data, $this->body);
- }
-
- public function isValid(): bool
- {
- return $this->validator->isValid();
- }
-
- public function getErrors(): array
- {
- return $this->validator->getErrors();
- }
-
- public function getErrorString(): string
- {
- $msg = "Provided values do not validate. Errors:\n";
-
- foreach ($this->getErrors() as $error) {
- $msg .= sprintf("[%s] %s\n", $error['property'], $error['message']);
- }
-
- return $msg;
- }
-}
diff --git a/server/vendor/php-opencloud/common/src/Common/Resource/AbstractResource.php b/server/vendor/php-opencloud/common/src/Common/Resource/AbstractResource.php
deleted file mode 100644
index 989fde7..0000000
--- a/server/vendor/php-opencloud/common/src/Common/Resource/AbstractResource.php
+++ /dev/null
@@ -1,245 +0,0 @@
-<?php declare(strict_types=1);
-
-namespace OpenCloud\Common\Resource;
-
-use OpenCloud\Common\Api\Operator;
-use OpenCloud\Common\Transport\Utils;
-use Psr\Http\Message\ResponseInterface;
-
-/**
- * Represents a top-level abstraction of a remote API resource. Usually a resource represents a discrete
- * entity such as a Server, Container, Load Balancer. Apart from a representation of state, a resource can
- * also execute RESTFul operations on itself (updating, deleting, listing) or on other models.
- *
- * @package OpenCloud\Common\Resource
- */
-abstract class AbstractResource extends Operator implements ResourceInterface
-{
- const DEFAULT_MARKER_KEY = 'id';
-
- /**
- * The JSON key that indicates how the API nests singular resources. For example, when
- * performing a GET, it could respond with ``{"server": {"id": "12345"}}``. In this case,
- * "server" is the resource key, since the essential state of the server is nested inside.
- *
- * @var string
- */
- protected $resourceKey;
-
- /**
- * The key that indicates how the API nests resource collections. For example, when
- * performing a GET, it could respond with ``{"servers": [{}, {}]}``. In this case, "servers"
- * is the resources key, since the array of servers is nested inside.
- *
- * @var string
- */
- protected $resourcesKey;
-
- /**
- * Indicates which attribute of the current resource should be used for pagination markers.
- *
- * @var string
- */
- protected $markerKey;
-
- /**
- * An array of aliases that will be checked when the resource is being populated. For example,
- *
- * 'FOO_BAR' => 'fooBar'
- *
- * will extract FOO_BAR from the response, and save it as 'fooBar' in the resource.
- *
- * @var array
- */
- protected $aliases = [];
-
- /**
- * Populates the current resource from a response object.
- *
- * @param ResponseInterface $response
- *
- * @return $this|ResourceInterface
- */
- public function populateFromResponse(ResponseInterface $response): self
- {
- if (strpos($response->getHeaderLine('Content-Type'), 'application/json') === 0) {
- $json = Utils::jsonDecode($response);
- if (!empty($json)) {
- $this->populateFromArray(Utils::flattenJson($json, $this->resourceKey));
- }
- }
-
- return $this;
- }
-
- /**
- * Populates the current resource from a data array.
- *
- * @param array $array
- *
- * @return mixed|void
- */
- public function populateFromArray(array $array): self
- {
- $reflClass = new \ReflectionClass($this);
-
- foreach ($array as $key => $val) {
- $propertyName = (string) (isset($this->aliases[$key]) ? $this->aliases[$key] : $key);
-
- if (property_exists($this, $propertyName)) {
- if ($type = $this->extractTypeFromDocBlock($reflClass, $propertyName)) {
- $val = $this->parseDocBlockValue($type, $val);
- }
-
- $this->$propertyName = $val;
- }
- }
-
- return $this;
- }
-
- private function parseDocBlockValue(string $type, $val)
- {
- if (strpos($type, '[]') === 0 && is_array($val)) {
- $array = [];
- foreach ($val as $subVal) {
- $array[] = $this->model($this->normalizeModelClass(substr($type, 2)), $subVal);
- }
- $val = $array;
- } elseif (strcasecmp($type, '\datetimeimmutable') === 0) {
- $val = new \DateTimeImmutable($val);
- } elseif ($this->isNotNativeType($type)) {
- $val = $this->model($this->normalizeModelClass($type), $val);
- }
-
- return $val;
- }
-
- private function isNotNativeType(string $type): bool
- {
- return !in_array($type, [
- 'string', 'bool', 'boolean', 'double', 'null', 'array', 'object', 'int', 'integer', 'float', 'numeric',
- 'mixed'
- ]);
- }
-
- private function normalizeModelClass(string $class): string
- {
- if (strpos($class, '\\') === false) {
- $currentNamespace = (new \ReflectionClass($this))->getNamespaceName();
- $class = sprintf("%s\\%s", $currentNamespace, $class);
- }
-
- return $class;
- }
-
- private function extractTypeFromDocBlock(\ReflectionClass $reflClass, string $propertyName)
- {
- $docComment = $reflClass->getProperty($propertyName)->getDocComment();
-
- if (!$docComment) {
- return false;
- }
-
- $matches = [];
- preg_match('#@var ((\[\])?[\w|\\\]+)#', $docComment, $matches);
- return isset($matches[1]) ? $matches[1] : null;
- }
-
- /**
- * Internal method which retrieves the values of provided keys.
- *
- * @param array $keys
- *
- * @return array
- */
- protected function getAttrs(array $keys)
- {
- $output = [];
-
- foreach ($keys as $key) {
- if (property_exists($this, $key) && $this->$key !== null) {
- $output[$key] = $this->$key;
- }
- }
-
- return $output;
- }
-
- /**
- * @param array $definition
- *
- * @return mixed
- */
- public function executeWithState(array $definition)
- {
- return $this->execute($definition, $this->getAttrs(array_keys($definition['params'])));
- }
-
- private function getResourcesKey(): string
- {
- $resourcesKey = $this->resourcesKey;
-
- if (!$resourcesKey) {
- $class = substr(static::class, strrpos(static::class, '\\') + 1);
- $resourcesKey = strtolower(preg_replace('/([a-z])([A-Z])/', '$1_$2', $class)) . 's';
- }
-
- return $resourcesKey;
- }
-
- /**
- * {@inheritDoc}
- */
- public function enumerate(array $def, array $userVals = [], callable $mapFn = null): \Generator
- {
- $operation = $this->getOperation($def);
-
- $requestFn = function ($marker) use ($operation, $userVals) {
- if ($marker) {
- $userVals['marker'] = $marker;
- }
- return $this->sendRequest($operation, $userVals);
- };
-
- $resourceFn = function (array $data) {
- $resource = $this->newInstance();
- $resource->populateFromArray($data);
- return $resource;
- };
-
- $opts = [
- 'limit' => isset($userVals['limit']) ? $userVals['limit'] : null,
- 'resourcesKey' => $this->getResourcesKey(),
- 'markerKey' => $this->markerKey,
- 'mapFn' => $mapFn,
- ];
-
- $iterator = new Iterator($opts, $requestFn, $resourceFn);
- return $iterator();
- }
-
- public function extractMultipleInstances(ResponseInterface $response, string $key = null): array
- {
- $key = $key ?: $this->getResourcesKey();
- $resourcesData = Utils::jsonDecode($response)[$key];
-
- $resources = [];
-
- foreach ($resourcesData as $resourceData) {
- $resource = $this->newInstance();
- $resource->populateFromArray($resourceData);
- $resources[] = $resource;
- }
-
- return $resources;
- }
-
- protected function getService()
- {
- $class = static::class;
- $service = substr($class, 0, strpos($class, 'Models') - 1) . '\\Service';
-
- return new $service($this->client, $this->api);
- }
-}
diff --git a/server/vendor/php-opencloud/common/src/Common/Resource/Creatable.php b/server/vendor/php-opencloud/common/src/Common/Resource/Creatable.php
deleted file mode 100644
index 5f16bfa..0000000
--- a/server/vendor/php-opencloud/common/src/Common/Resource/Creatable.php
+++ /dev/null
@@ -1,19 +0,0 @@
-<?php declare(strict_types=1);
-
-namespace OpenCloud\Common\Resource;
-
-/**
- * Represents a resource that can be created.
- *
- * @package OpenCloud\Common\Resource
- */
-interface Creatable
-{
- /**
- * Create a new resource according to the configuration set in the options.
- *
- * @param array $userOptions
- * @return self
- */
- public function create(array $userOptions): Creatable;
-}
diff --git a/server/vendor/php-opencloud/common/src/Common/Resource/Deletable.php b/server/vendor/php-opencloud/common/src/Common/Resource/Deletable.php
deleted file mode 100644
index c825861..0000000
--- a/server/vendor/php-opencloud/common/src/Common/Resource/Deletable.php
+++ /dev/null
@@ -1,18 +0,0 @@
-<?php declare(strict_types=1);
-
-namespace OpenCloud\Common\Resource;
-
-/**
- * Represents a resource that can be deleted.
- *
- * @package OpenCloud\Common\Resource
- */
-interface Deletable
-{
- /**
- * Permanently delete this resource.
- *
- * @return void
- */
- public function delete();
-}
diff --git a/server/vendor/php-opencloud/common/src/Common/Resource/HasMetadata.php b/server/vendor/php-opencloud/common/src/Common/Resource/HasMetadata.php
deleted file mode 100644
index 4bdb53d..0000000
--- a/server/vendor/php-opencloud/common/src/Common/Resource/HasMetadata.php
+++ /dev/null
@@ -1,67 +0,0 @@
-<?php declare(strict_types=1);
-
-namespace OpenCloud\Common\Resource;
-
-use Psr\Http\Message\ResponseInterface;
-
-interface HasMetadata
-{
- /**
- * Retrieves the metadata for the resource in the form of an associative array or hash. Each key represents the
- * metadata item's name, and each value represents the metadata item's remote value.
- *
- * @return array
- */
- public function getMetadata(): array;
-
- /**
- * Merges a set of new values with those which already exist (on the remote API) for a resource. For example, if
- * the resource has this metadata already set:
- *
- * Foo: val1
- * Bar: val2
- *
- * and mergeMetadata(['Foo' => 'val3', 'Baz' => 'val4']); is called, then the resource will have the following
- * metadata:
- *
- * Foo: val3
- * Bar: val2
- * Baz: val4
- *
- * You will notice that any metadata items which are not specified in the call are preserved.
- *
- * @param array $metadata The new metadata items
- *
- * @return void
- */
- public function mergeMetadata(array $metadata);
-
- /**
- * Replaces all of the existing metadata items for a resource with a new set of values. Any metadata items which
- * are not provided in the call are removed from the resource. For example, if the resource has this metadata
- * already set:
- *
- * Foo: val1
- * Bar: val2
- *
- * and resetMetadata(['Foo' => 'val3', 'Baz' => 'val4']); is called, then the resource will have the following
- * metadata:
- *
- * Foo: val3
- * Baz: val4
- *
- * @param array $metadata The new metadata items
- *
- * @return void
- */
- public function resetMetadata(array $metadata);
-
- /**
- * Extracts metadata from a response object and returns it in the form of an associative array.
- *
- * @param ResponseInterface $response
- *
- * @return array
- */
- public function parseMetadata(ResponseInterface $response): array;
-}
diff --git a/server/vendor/php-opencloud/common/src/Common/Resource/HasWaiterTrait.php b/server/vendor/php-opencloud/common/src/Common/Resource/HasWaiterTrait.php
deleted file mode 100644
index ddc4bef..0000000
--- a/server/vendor/php-opencloud/common/src/Common/Resource/HasWaiterTrait.php
+++ /dev/null
@@ -1,124 +0,0 @@
-<?php declare(strict_types=1);
-
-namespace OpenCloud\Common\Resource;
-
-use OpenCloud\Common\Error\BadResponseError;
-
-/**
- * Contains reusable functionality for resources that have long operations which require waiting in
- * order to reach a particular state.
- *
- * @codeCoverageIgnore
- *
- * @package OpenCloud\Common\Resource
- */
-trait HasWaiterTrait
-{
- /**
- * Provides a blocking operation until the resource has reached a particular state. The method
- * will enter a loop, requesting feedback from the remote API until it sends back an appropriate
- * status.
- *
- * @param string $status The state to be reached
- * @param int $timeout The maximum timeout. If the total time taken by the waiter has reached
- * or exceed this timeout, the blocking operation will immediately cease.
- * @param int $sleepPeriod The amount of time to pause between each HTTP request.
- */
- public function waitUntil(string $status, $timeout = 60, int $sleepPeriod = 1)
- {
- $startTime = time();
-
- while (true) {
- $this->retrieve();
-
- if ($this->status == $status || $this->shouldHalt($timeout, $startTime)) {
- break;
- }
-
- sleep($sleepPeriod);
- }
- }
-
- /**
- * Provides a blocking operation until the resource has reached a particular state. The method
- * will enter a loop, executing the callback until TRUE is returned. This provides great
- * flexibility.
- *
- * @param callable $fn An anonymous function that will be executed on every iteration. You can
- * encapsulate your own logic to determine whether the resource has
- * successfully transitioned. When TRUE is returned by the callback,
- * the loop will end.
- * @param int|bool $timeout The maximum timeout in seconds. If the total time taken by the waiter has reached
- * or exceed this timeout, the blocking operation will immediately cease. If FALSE
- * is provided, the timeout will never be considered.
- * @param int $sleepPeriod The amount of time to pause between each HTTP request.
- */
- public function waitWithCallback(callable $fn, $timeout = 60, int $sleepPeriod = 1)
- {
- $startTime = time();
-
- while (true) {
- $this->retrieve();
-
- $response = call_user_func_array($fn, [$this]);
-
- if ($response === true || $this->shouldHalt($timeout, $startTime)) {
- break;
- }
-
- sleep($sleepPeriod);
- }
- }
-
- /**
- * Internal method used to identify whether a timeout has been exceeded.
- *
- * @param bool|int $timeout
- * @param int $startTime
- *
- * @return bool
- */
- private function shouldHalt($timeout, int $startTime)
- {
- if ($timeout === false) {
- return false;
- }
-
- return time() - $startTime >= $timeout;
- }
-
- /**
- * Convenience method providing a blocking operation until the resource transitions to an
- * ``ACTIVE`` status.
- *
- * @param int|bool $timeout The maximum timeout in seconds. If the total time taken by the waiter has reached
- * or exceed this timeout, the blocking operation will immediately cease. If FALSE
- * is provided, the timeout will never be considered.
- */
- public function waitUntilActive($timeout = false)
- {
- $this->waitUntil('ACTIVE', $timeout);
- }
-
- public function waitUntilDeleted($timeout = 60, int $sleepPeriod = 1)
- {
- $startTime = time();
-
- while (true) {
- try {
- $this->retrieve();
- } catch (BadResponseError $e) {
- if ($e->getResponse()->getStatusCode() === 404) {
- break;
- }
- throw $e;
- }
-
- if ($this->shouldHalt($timeout, $startTime)) {
- break;
- }
-
- sleep($sleepPeriod);
- }
- }
-}
diff --git a/server/vendor/php-opencloud/common/src/Common/Resource/Iterator.php b/server/vendor/php-opencloud/common/src/Common/Resource/Iterator.php
deleted file mode 100644
index 05507f0..0000000
--- a/server/vendor/php-opencloud/common/src/Common/Resource/Iterator.php
+++ /dev/null
@@ -1,97 +0,0 @@
-<?php declare(strict_types=1);
-
-namespace OpenCloud\Common\Resource;
-
-use OpenCloud\Common\Transport\Utils;
-
-class Iterator
-{
- private $requestFn;
- private $resourceFn;
- private $limit;
- private $count;
- private $resourcesKey;
- private $markerKey;
- private $mapFn;
- private $currentMarker;
-
- public function __construct(array $options, callable $requestFn, callable $resourceFn)
- {
- $this->limit = isset($options['limit']) ? $options['limit'] : false;
- $this->count = 0;
-
- if (isset($options['resourcesKey'])) {
- $this->resourcesKey = $options['resourcesKey'];
- }
-
- if (isset($options['markerKey'])) {
- $this->markerKey = $options['markerKey'];
- }
-
- if (isset($options['mapFn']) && is_callable($options['mapFn'])) {
- $this->mapFn = $options['mapFn'];
- }
-
- $this->requestFn = $requestFn;
- $this->resourceFn = $resourceFn;
- }
-
- private function fetchResources()
- {
- if ($this->shouldNotSendAnotherRequest()) {
- return false;
- }
-
- $response = call_user_func($this->requestFn, $this->currentMarker);
-
- $json = Utils::flattenJson(Utils::jsonDecode($response), $this->resourcesKey);
-
- if ($response->getStatusCode() === 204 || empty($json)) {
- return false;
- }
-
- return $json;
- }
-
- private function assembleResource(array $data)
- {
- $resource = call_user_func($this->resourceFn, $data);
-
- // Invoke user-provided fn if provided
- if ($this->mapFn) {
- call_user_func_array($this->mapFn, [&$resource]);
- }
-
- // Update marker if operation supports it
- if ($this->markerKey) {
- $this->currentMarker = $resource->{$this->markerKey};
- }
-
- return $resource;
- }
-
- private function totalReached()
- {
- return $this->limit && $this->count >= $this->limit;
- }
-
- private function shouldNotSendAnotherRequest()
- {
- return $this->totalReached() || ($this->count > 0 && !$this->markerKey);
- }
-
- public function __invoke()
- {
- while ($resources = $this->fetchResources()) {
- foreach ($resources as $resourceData) {
- if ($this->totalReached()) {
- break;
- }
-
- $this->count++;
-
- yield $this->assembleResource($resourceData);
- }
- }
- }
-}
diff --git a/server/vendor/php-opencloud/common/src/Common/Resource/Listable.php b/server/vendor/php-opencloud/common/src/Common/Resource/Listable.php
deleted file mode 100644
index c3041d5..0000000
--- a/server/vendor/php-opencloud/common/src/Common/Resource/Listable.php
+++ /dev/null
@@ -1,28 +0,0 @@
-<?php declare(strict_types=1);
-
-namespace OpenCloud\Common\Resource;
-
-/**
- * Represents a resource that can be enumerated (listed over).
- *
- * @package OpenCloud\Common\Resource
- */
-interface Listable
-{
- /**
- * This method iterates over a collection of resources. It sends the operation's request to the API,
- * parses the response, converts each element into {@see self} and - if pagination is supported - continues
- * to send requests until an empty collection is received back.
- *
- * For paginated collections, it sends subsequent requests according to a marker URL query. The value
- * of the marker will depend on the last element returned in the previous response. If a limit is
- * provided, the loop will continue up until that point.
- *
- * @param array $def The operation definition
- * @param array $userVals The user values
- * @param callable $mapFn An optional callback that will be executed on every resource iteration.
- *
- * @returns void
- */
- public function enumerate(array $def, array $userVals = [], callable $mapFn = null);
-}
diff --git a/server/vendor/php-opencloud/common/src/Common/Resource/ResourceInterface.php b/server/vendor/php-opencloud/common/src/Common/Resource/ResourceInterface.php
deleted file mode 100644
index ffe3d20..0000000
--- a/server/vendor/php-opencloud/common/src/Common/Resource/ResourceInterface.php
+++ /dev/null
@@ -1,29 +0,0 @@
-<?php declare(strict_types=1);
-
-namespace OpenCloud\Common\Resource;
-
-use Psr\Http\Message\ResponseInterface;
-
-/**
- * Represents an API resource.
- *
- * @package OpenCloud\Common\Resource
- */
-interface ResourceInterface
-{
- /**
- * All models which represent an API resource should be able to be populated
- * from a {@see ResponseInterface} object.
- *
- * @param ResponseInterface $response
- *
- * @return self
- */
- public function populateFromResponse(ResponseInterface $response);
-
- /**
- * @param array $data
- * @return mixed
- */
- public function populateFromArray(array $data);
-}
diff --git a/server/vendor/php-opencloud/common/src/Common/Resource/Retrievable.php b/server/vendor/php-opencloud/common/src/Common/Resource/Retrievable.php
deleted file mode 100644
index 1e3b726..0000000
--- a/server/vendor/php-opencloud/common/src/Common/Resource/Retrievable.php
+++ /dev/null
@@ -1,18 +0,0 @@
-<?php declare(strict_types=1);
-
-namespace OpenCloud\Common\Resource;
-
-/**
- * A resource that supports a GET or HEAD operation to retrieve more details.
- *
- * @package OpenCloud\Common\Resource
- */
-interface Retrievable
-{
- /**
- * Retrieve details of the current resource from the remote API.
- *
- * @return void
- */
- public function retrieve();
-}
diff --git a/server/vendor/php-opencloud/common/src/Common/Resource/Updateable.php b/server/vendor/php-opencloud/common/src/Common/Resource/Updateable.php
deleted file mode 100644
index 228c496..0000000
--- a/server/vendor/php-opencloud/common/src/Common/Resource/Updateable.php
+++ /dev/null
@@ -1,18 +0,0 @@
-<?php declare(strict_types=1);
-
-namespace OpenCloud\Common\Resource;
-
-/**
- * Represents a resource that can be updated.
- *
- * @package OpenCloud\Common\Resource
- */
-interface Updateable
-{
- /**
- * Update the current resource with the configuration set out in the user options.
- *
- * @return void
- */
- public function update();
-}
diff --git a/server/vendor/php-opencloud/common/src/Common/Service/AbstractService.php b/server/vendor/php-opencloud/common/src/Common/Service/AbstractService.php
deleted file mode 100644
index 660d7bb..0000000
--- a/server/vendor/php-opencloud/common/src/Common/Service/AbstractService.php
+++ /dev/null
@@ -1,14 +0,0 @@
-<?php declare(strict_types=1);
-
-namespace OpenCloud\Common\Service;
-
-use OpenCloud\Common\Api\Operator;
-
-/**
- * Represents the top-level abstraction of a service.
- *
- * @package OpenCloud\Common\Service
- */
-abstract class AbstractService extends Operator implements ServiceInterface
-{
-}
diff --git a/server/vendor/php-opencloud/common/src/Common/Service/Builder.php b/server/vendor/php-opencloud/common/src/Common/Service/Builder.php
deleted file mode 100644
index 9ccd90d..0000000
--- a/server/vendor/php-opencloud/common/src/Common/Service/Builder.php
+++ /dev/null
@@ -1,168 +0,0 @@
-<?php declare(strict_types = 1);
-
-namespace OpenCloud\Common\Service;
-
-use GuzzleHttp\Client;
-use GuzzleHttp\ClientInterface;
-use GuzzleHttp\Middleware as GuzzleMiddleware;
-use OpenCloud\Common\Auth\IdentityService;
-use OpenCloud\Common\Auth\Token;
-use OpenCloud\Common\Transport\HandlerStack;
-use OpenCloud\Common\Transport\Middleware;
-use OpenCloud\Common\Transport\Utils;
-
-/**
- * A Builder for easily creating OpenCloud services.
- *
- * @package OpenCloud\Common\Service
- */
-class Builder
-{
- /**
- * Global options that will be applied to every service created by this builder.
- *
- * @var array
- */
- private $globalOptions = [];
-
- /** @var string */
- private $rootNamespace;
-
- /**
- * Defaults that will be applied to options if no values are provided by the user.
- *
- * @var array
- */
- private $defaults = ['urlType' => 'publicURL'];
-
- /**
- * @param array $globalOptions Options that will be applied to every service created by this builder.
- * Eventually they will be merged (and if necessary overridden) by the
- * service-specific options passed in.
- */
- public function __construct(array $globalOptions = [], $rootNamespace = 'OpenCloud')
- {
- $this->globalOptions = $globalOptions;
- $this->rootNamespace = $rootNamespace;
- }
-
- /**
- * Internal method which resolves the API and Service classes for a service.
- *
- * @param string $serviceName The name of the service, e.g. Compute
- * @param int $serviceVersion The major version of the service, e.g. 2
- *
- * @return array
- */
- private function getClasses(string $serviceName, int $serviceVersion)
- {
- $rootNamespace = sprintf("%s\\%s\\v%d", $this->rootNamespace, $serviceName, $serviceVersion);
-
- return [
- sprintf("%s\\Api", $rootNamespace),
- sprintf("%s\\Service", $rootNamespace),
- ];
- }
-
- /**
- * This method will return an OpenCloud service ready fully built and ready for use. There is
- * some initial setup that may prohibit users from directly instantiating the service class
- * directly - this setup includes the configuration of the HTTP client's base URL, and the
- * attachment of an authentication handler.
- *
- * @param string $serviceName The name of the service as it appears in the OpenCloud\* namespace
- * @param int $serviceVersion The major version of the service
- * @param array $serviceOptions The service-specific options to use
- *
- * @return \OpenCloud\Common\Service\ServiceInterface
- *
- * @throws \Exception
- */
- public function createService(string $serviceName, int $serviceVersion, array $serviceOptions = []): ServiceInterface
- {
- $options = $this->mergeOptions($serviceOptions);
-
- $this->stockAuthHandler($options);
- $this->stockHttpClient($options, $serviceName);
-
- list($apiClass, $serviceClass) = $this->getClasses($serviceName, $serviceVersion);
-
- return new $serviceClass($options['httpClient'], new $apiClass());
- }
-
- private function stockHttpClient(array &$options, string $serviceName)
- {
- if (!isset($options['httpClient']) || !($options['httpClient'] instanceof ClientInterface)) {
- if (strcasecmp($serviceName, 'identity') === 0) {
- $baseUrl = $options['authUrl'];
- $stack = $this->getStack($options['authHandler']);
- } else {
- list($token, $baseUrl) = $options['identityService']->authenticate($options);
- $stack = $this->getStack($options['authHandler'], $token);
- }
-
- $this->addDebugMiddleware($options, $stack);
-
- $options['httpClient'] = $this->httpClient($baseUrl, $stack);
- }
- }
-
- /**
- * @codeCoverageIgnore
- */
- private function addDebugMiddleware(array $options, HandlerStack &$stack)
- {
- if (!empty($options['debugLog'])
- && !empty($options['logger'])
- && !empty($options['messageFormatter'])
- ) {
- $stack->push(GuzzleMiddleware::log($options['logger'], $options['messageFormatter']));
- }
- }
-
- /**
- * @param array $options
- *
- * @codeCoverageIgnore
- */
- private function stockAuthHandler(array &$options)
- {
- if (!isset($options['authHandler'])) {
- $options['authHandler'] = function () use ($options) {
- return $options['identityService']->generateToken($options);
- };
- }
- }
-
- private function getStack(callable $authHandler, Token $token = null): HandlerStack
- {
- $stack = HandlerStack::create();
- $stack->push(Middleware::authHandler($authHandler, $token));
- return $stack;
- }
-
- private function httpClient(string $baseUrl, HandlerStack $stack): ClientInterface
- {
- return new Client([
- 'base_uri' => Utils::normalizeUrl($baseUrl),
- 'handler' => $stack,
- ]);
- }
-
- private function mergeOptions(array $serviceOptions): array
- {
- $options = array_merge($this->defaults, $this->globalOptions, $serviceOptions);
-
- if (!isset($options['authUrl'])) {
- throw new \InvalidArgumentException('"authUrl" is a required option');
- }
-
- if (!isset($options['identityService']) || !($options['identityService'] instanceof IdentityService)) {
- throw new \InvalidArgumentException(sprintf(
- '"identityService" must be specified and implement %s', IdentityService::class
- ));
- }
-
- return $options;
- }
-} \ No newline at end of file
diff --git a/server/vendor/php-opencloud/common/src/Common/Service/ServiceInterface.php b/server/vendor/php-opencloud/common/src/Common/Service/ServiceInterface.php
deleted file mode 100644
index 0f2f23c..0000000
--- a/server/vendor/php-opencloud/common/src/Common/Service/ServiceInterface.php
+++ /dev/null
@@ -1,14 +0,0 @@
-<?php declare(strict_types=1);
-
-namespace OpenCloud\Common\Service;
-
-use OpenCloud\Common\Api\OperatorInterface;
-
-/**
- * Service interface.
- *
- * @package OpenCloud\Common\Service
- */
-interface ServiceInterface extends OperatorInterface
-{
-}
diff --git a/server/vendor/php-opencloud/common/src/Common/Transport/HandlerStack.php b/server/vendor/php-opencloud/common/src/Common/Transport/HandlerStack.php
deleted file mode 100644
index 8e7b8db..0000000
--- a/server/vendor/php-opencloud/common/src/Common/Transport/HandlerStack.php
+++ /dev/null
@@ -1,19 +0,0 @@
-<?php declare(strict_types=1);
-
-namespace OpenCloud\Common\Transport;
-
-use function GuzzleHttp\choose_handler;
-use GuzzleHttp\HandlerStack as GuzzleStack;
-
-class HandlerStack extends GuzzleStack
-{
- public static function create(callable $handler = null): self
- {
- $stack = new self($handler ?: choose_handler());
-
- $stack->push(Middleware::httpErrors());
- $stack->push(Middleware::prepareBody());
-
- return $stack;
- }
-}
diff --git a/server/vendor/php-opencloud/common/src/Common/Transport/JsonSerializer.php b/server/vendor/php-opencloud/common/src/Common/Transport/JsonSerializer.php
deleted file mode 100644
index 4d0b2e4..0000000
--- a/server/vendor/php-opencloud/common/src/Common/Transport/JsonSerializer.php
+++ /dev/null
@@ -1,95 +0,0 @@
-<?php declare(strict_types=1);
-
-namespace OpenCloud\Common\Transport;
-
-use OpenCloud\Common\Api\Parameter;
-use OpenCloud\Common\JsonPath;
-
-/**
- * Class responsible for populating the JSON body of a {@see GuzzleHttp\Message\Request} object.
- *
- * @package OpenCloud\Common\Transport
- */
-class JsonSerializer
-{
- /**
- * Populates the actual value into a JSON field, i.e. it has reached the end of the line and no
- * further nesting is required.
- *
- * @param Parameter $param The schema that defines how the JSON field is being populated
- * @param mixed $userValue The user value that is populating a JSON field
- * @param array $json The existing JSON structure that will be populated
- *
- * @return array|mixed
- */
- private function stockValue(Parameter $param, $userValue, array $json): array
- {
- $name = $param->getName();
- if ($path = $param->getPath()) {
- $jsonPath = new JsonPath($json);
- $jsonPath->set(sprintf("%s.%s", $path, $name), $userValue);
- $json = $jsonPath->getStructure();
- } elseif ($name) {
- $json[$name] = $userValue;
- } else {
- $json[] = $userValue;
- }
-
- return $json;
- }
-
- /**
- * Populates a value into an array-like structure.
- *
- * @param Parameter $param The schema that defines how the JSON field is being populated
- * @param mixed $userValue The user value that is populating a JSON field
- *
- * @return array|mixed
- */
- private function stockArrayJson(Parameter $param, array $userValue): array
- {
- $elems = [];
- foreach ($userValue as $item) {
- $elems = $this->stockJson($param->getItemSchema(), $item, $elems);
- }
- return $elems;
- }
-
- /**
- * Populates a value into an object-like structure.
- *
- * @param Parameter $param The schema that defines how the JSON field is being populated
- * @param mixed $userValue The user value that is populating a JSON field
- *
- * @return array
- */
- private function stockObjectJson(Parameter $param, \stdClass $userValue): array
- {
- $object = [];
- foreach ($userValue as $key => $val) {
- $object = $this->stockJson($param->getProperty($key), $val, $object);
- }
- return $object;
- }
-
- /**
- * A generic method that will populate a JSON structure with a value according to a schema. It
- * supports multiple types and will delegate accordingly.
- *
- * @param Parameter $param The schema that defines how the JSON field is being populated
- * @param mixed $userValue The user value that is populating a JSON field
- * @param array $json The existing JSON structure that will be populated
- *
- * @return array
- */
- public function stockJson(Parameter $param, $userValue, array $json): array
- {
- if ($param->isArray()) {
- $userValue = $this->stockArrayJson($param, $userValue);
- } elseif ($param->isObject()) {
- $userValue = $this->stockObjectJson($param, (object) $userValue);
- }
- // Populate the final value
- return $this->stockValue($param, $userValue, $json);
- }
-}
diff --git a/server/vendor/php-opencloud/common/src/Common/Transport/Middleware.php b/server/vendor/php-opencloud/common/src/Common/Transport/Middleware.php
deleted file mode 100644
index 2b407a4..0000000
--- a/server/vendor/php-opencloud/common/src/Common/Transport/Middleware.php
+++ /dev/null
@@ -1,96 +0,0 @@
-<?php declare(strict_types=1);
-
-namespace OpenCloud\Common\Transport;
-
-use function GuzzleHttp\Psr7\modify_request;
-use GuzzleHttp\MessageFormatter;
-use GuzzleHttp\Middleware as GuzzleMiddleware;
-use OpenCloud\Common\Auth\AuthHandler;
-use OpenCloud\Common\Auth\Token;
-use OpenCloud\Common\Error\Builder;
-use Psr\Http\Message\ResponseInterface;
-use Psr\Log\LoggerInterface;
-use Psr\Log\LogLevel;
-
-final class Middleware
-{
- /**
- * @return callable
- */
- 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) {
- if ($response->getStatusCode() < 400) {
- return $response;
- }
- throw (new Builder())->httpError($request, $response);
- }
- );
- };
- };
- }
-
- /**
- * @param callable $tokenGenerator
- * @param Token $token
- *
- * @return callable
- */
- public static function authHandler(callable $tokenGenerator, Token $token = null): callable
- {
- return function (callable $handler) use ($tokenGenerator, $token) {
- return new AuthHandler($handler, $tokenGenerator, $token);
- };
- }
-
- /**
- * @codeCoverageIgnore
- */
- public static function history(array &$container): callable
- {
- return GuzzleMiddleware::history($container);
- }
-
- /**
- * @codeCoverageIgnore
- */
- public static function retry(callable $decider, callable $delay = null): callable
- {
- return GuzzleMiddleware::retry($decider, $delay);
- }
-
- /**
- * @codeCoverageIgnore
- */
- public static function log(LoggerInterface $logger, MessageFormatter $formatter, $logLevel = LogLevel::INFO): callable
- {
- return GuzzleMiddleware::log($logger, $formatter, $logLevel);
- }
-
- /**
- * @codeCoverageIgnore
- */
- public static function prepareBody(): callable
- {
- return GuzzleMiddleware::prepareBody();
- }
-
- /**
- * @codeCoverageIgnore
- */
- public static function mapRequest(callable $fn): callable
- {
- return GuzzleMiddleware::mapRequest($fn);
- }
-
- /**
- * @codeCoverageIgnore
- */
- public static function mapResponse(callable $fn): callable
- {
- return GuzzleMiddleware::mapResponse($fn);
- }
-}
diff --git a/server/vendor/php-opencloud/common/src/Common/Transport/RequestSerializer.php b/server/vendor/php-opencloud/common/src/Common/Transport/RequestSerializer.php
deleted file mode 100644
index 61533fb..0000000
--- a/server/vendor/php-opencloud/common/src/Common/Transport/RequestSerializer.php
+++ /dev/null
@@ -1,85 +0,0 @@
-<?php declare(strict_types=1);
-
-namespace OpenCloud\Common\Transport;
-
-use function GuzzleHttp\uri_template;
-use function GuzzleHttp\Psr7\build_query;
-use function GuzzleHttp\Psr7\modify_request;
-use OpenCloud\Common\Api\Operation;
-use OpenCloud\Common\Api\Parameter;
-
-class RequestSerializer
-{
- private $jsonSerializer;
-
- public function __construct(JsonSerializer $jsonSerializer = null)
- {
- $this->jsonSerializer = $jsonSerializer ?: new JsonSerializer();
- }
-
- public function serializeOptions(Operation $operation, array $userValues = []): array
- {
- $options = ['headers' => []];
-
- foreach ($userValues as $paramName => $paramValue) {
- if (null === ($schema = $operation->getParam($paramName))) {
- continue;
- }
-
- $method = sprintf('stock%s', ucfirst($schema->getLocation()));
- $this->$method($schema, $paramValue, $options);
- }
-
- if (!empty($options['json'])) {
- if ($key = $operation->getJsonKey()) {
- $options['json'] = [$key => $options['json']];
- }
- if (strpos(json_encode($options['json']), '\/') !== false) {
- $options['body'] = json_encode($options['json'], JSON_UNESCAPED_SLASHES);
- $options['headers']['Content-Type'] = 'application/json';
- unset($options['json']);
- }
- }
-
- return $options;
- }
-
- private function stockUrl()
- {
- }
-
- private function stockQuery(Parameter $schema, $paramValue, array &$options)
- {
- $options['query'][$schema->getName()] = $paramValue;
- }
-
- private function stockHeader(Parameter $schema, $paramValue, array &$options)
- {
- $paramName = $schema->getName();
-
- if (stripos($paramName, 'metadata') !== false) {
- return $this->stockMetadataHeader($schema, $paramValue, $options);
- }
-
- $options['headers'] += is_scalar($paramValue) ? [$schema->getPrefixedName() => $paramValue] : [];
- }
-
- private function stockMetadataHeader(Parameter $schema, $paramValue, array &$options)
- {
- foreach ($paramValue as $key => $keyVal) {
- $schema = $schema->getItemSchema() ?: new Parameter(['prefix' => $schema->getPrefix(), 'name' => $key]);
- $this->stockHeader($schema, $keyVal, $options);
- }
- }
-
- private function stockJson(Parameter $schema, $paramValue, array &$options)
- {
- $json = isset($options['json']) ? $options['json'] : [];
- $options['json'] = $this->jsonSerializer->stockJson($schema, $paramValue, $json);
- }
-
- private function stockRaw(Parameter $schema, $paramValue, array &$options)
- {
- $options['body'] = $paramValue;
- }
-}
diff --git a/server/vendor/php-opencloud/common/src/Common/Transport/Utils.php b/server/vendor/php-opencloud/common/src/Common/Transport/Utils.php
deleted file mode 100644
index ffac9ce..0000000
--- a/server/vendor/php-opencloud/common/src/Common/Transport/Utils.php
+++ /dev/null
@@ -1,88 +0,0 @@
-<?php declare(strict_types=1);
-
-namespace OpenCloud\Common\Transport;
-
-use function GuzzleHttp\Psr7\uri_for;
-use Psr\Http\Message\ResponseInterface;
-use Psr\Http\Message\UriInterface;
-
-class Utils
-{
- public static function jsonDecode(ResponseInterface $response, bool $assoc = true)
- {
- $jsonErrors = [
- JSON_ERROR_DEPTH => 'JSON_ERROR_DEPTH - Maximum stack depth exceeded',
- JSON_ERROR_STATE_MISMATCH => 'JSON_ERROR_STATE_MISMATCH - Underflow or the modes mismatch',
- JSON_ERROR_CTRL_CHAR => 'JSON_ERROR_CTRL_CHAR - Unexpected control character found',
- JSON_ERROR_SYNTAX => 'JSON_ERROR_SYNTAX - Syntax error, malformed JSON',
- JSON_ERROR_UTF8 => 'JSON_ERROR_UTF8 - Malformed UTF-8 characters, possibly incorrectly encoded'
- ];
-
- $responseBody = (string) $response->getBody();
-
- if (strlen($responseBody) === 0) {
- return $responseBody;
- }
-
- $data = json_decode($responseBody, $assoc);
-
- if (JSON_ERROR_NONE !== json_last_error()) {
- $last = json_last_error();
- throw new \InvalidArgumentException(
- 'Unable to parse JSON data: ' . (isset($jsonErrors[$last]) ? $jsonErrors[$last] : 'Unknown error')
- );
- }
-
- return $data;
- }
-
- /**
- * Method for flattening a nested array.
- *
- * @param array $data The nested array
- * @param string $key The key to extract
- *
- * @return array
- */
- public static function flattenJson($data, string $key = null)
- {
- return (!empty($data) && $key && isset($data[$key])) ? $data[$key] : $data;
- }
-
- /**
- * Method for normalize an URL string.
- *
- * Append the http:// prefix if not present, and add a
- * closing url separator when missing.
- *
- * @param string $url The url representation.
- *
- * @return string
- */
- public static function normalizeUrl(string $url): string
- {
- if (strpos($url, 'http') === false) {
- $url = 'http://' . $url;
- }
-
- return rtrim($url, '/') . '/';
- }
-
- /**
- * Add an unlimited list of paths to a given URI.
- *
- * @param UriInterface $uri
- * @param ...$paths
- *
- * @return UriInterface
- */
- public static function addPaths(UriInterface $uri, ...$paths): UriInterface
- {
- return uri_for(rtrim((string) $uri, '/') . '/' . implode('/', $paths));
- }
-
- public static function appendPath(UriInterface $uri, $path): UriInterface
- {
- return uri_for(rtrim((string) $uri, '/') . '/' . $path);
- }
-}
diff --git a/server/vendor/php-opencloud/common/tests/integration/DefaultLogger.php b/server/vendor/php-opencloud/common/tests/integration/DefaultLogger.php
deleted file mode 100644
index d367600..0000000
--- a/server/vendor/php-opencloud/common/tests/integration/DefaultLogger.php
+++ /dev/null
@@ -1,20 +0,0 @@
-<?php
-
-namespace OpenCloud\Integration;
-
-use Psr\Log\AbstractLogger;
-
-class DefaultLogger extends AbstractLogger
-{
- public function log($level, $message, array $context = [])
- {
- echo $this->format($level, $message, $context);
- }
-
- private function format($level, $message, $context)
- {
- $msg = strtr($message, $context);
-
- return sprintf("%s: %s\n", strtoupper($level), $msg);
- }
-}
diff --git a/server/vendor/php-opencloud/common/tests/integration/Runner.php b/server/vendor/php-opencloud/common/tests/integration/Runner.php
deleted file mode 100644
index b1003a2..0000000
--- a/server/vendor/php-opencloud/common/tests/integration/Runner.php
+++ /dev/null
@@ -1,114 +0,0 @@
-<?php
-
-namespace OpenCloud\Integration;
-
-class Runner
-{
- private $basePath;
- private $logger;
- private $services = [];
- private $namespace;
-
- public function __construct($basePath, $testNamespace)
- {
- $this->basePath = $basePath;
- $this->namespace = $testNamespace;
-
- $this->logger = new DefaultLogger();
- $this->assembleServicesFromSamples();
- }
-
- private function traverse($path)
- {
- return new \RecursiveDirectoryIterator($path, \FilesystemIterator::SKIP_DOTS);
- }
-
- private function assembleServicesFromSamples()
- {
- foreach ($this->traverse($this->basePath) as $servicePath) {
- if ($servicePath->isDir()) {
- foreach ($this->traverse($servicePath) as $versionPath) {
- $this->services[$servicePath->getBasename()][] = $versionPath->getBasename();
- }
- }
- }
- }
-
- private function getOpts()
- {
- $opts = getopt('s:v:t:', ['service:', 'version:', 'test::', 'debug::', 'help::']);
-
- $getOpt = function (array $keys, $default) use ($opts) {
- foreach ($keys as $key) {
- if (isset($opts[$key])) {
- return $opts[$key];
- }
- }
- return $default;
- };
-
- return [
- $getOpt(['s', 'service'], 'all'),
- $getOpt(['n', 'version'], 'all'),
- $getOpt(['t', 'test'], ''),
- isset($opts['debug']) ? (int) $opts['debug'] : 0,
- ];
- }
-
- private function getRunnableServices($service, $version)
- {
- $services = $this->services;
-
- if ($service != 'all') {
- if (!isset($this->services[$service])) {
- throw new \InvalidArgumentException(sprintf("%s service does not exist", $service));
- }
-
- $versions = ($version == 'all') ? $this->services[$service] : [$version];
- $services = [$service => $versions];
- }
-
- return $services;
- }
-
- /**
- * @return TestInterface
- */
- private function getTest($serviceName, $version, $verbosity)
- {
- $className = sprintf("%s\\%s\\%sTest", $this->namespace, Utils::toCamelCase($serviceName), ucfirst($version));
-
- if (!class_exists($className)) {
- throw new \RuntimeException(sprintf("%s does not exist", $className));
- }
-
- $basePath = $this->basePath . DIRECTORY_SEPARATOR . $serviceName . DIRECTORY_SEPARATOR . $version;
- $smClass = sprintf("%s\\SampleManager", $this->namespace);
- $class = new $className($this->logger, new $smClass($basePath, $verbosity));
-
- if (!($class instanceof TestInterface)) {
- throw new \RuntimeException(sprintf("%s does not implement TestInterface", $className));
- }
-
- return $class;
- }
-
- public function runServices()
- {
- list($serviceOpt, $versionOpt, $testMethodOpt, $verbosityOpt) = $this->getOpts();
-
- foreach ($this->getRunnableServices($serviceOpt, $versionOpt) as $serviceName => $versions) {
- foreach ($versions as $version) {
- $testRunner = $this->getTest($serviceName, $version, $verbosityOpt);
-
- if ($testMethodOpt) {
- $testRunner->runOneTest($testMethodOpt);
- } else {
- $testRunner->runTests();
- }
-
- $testRunner->teardown();
- }
- }
- }
-}
diff --git a/server/vendor/php-opencloud/common/tests/integration/SampleManager.php b/server/vendor/php-opencloud/common/tests/integration/SampleManager.php
deleted file mode 100644
index 4bd8b9a..0000000
--- a/server/vendor/php-opencloud/common/tests/integration/SampleManager.php
+++ /dev/null
@@ -1,104 +0,0 @@
-<?php
-
-namespace OpenCloud\integration;
-
-class SampleManager implements SampleManagerInterface
-{
- protected $basePath;
- protected $paths = [];
- protected $verbosity;
-
- public function __construct($basePath, $verbosity)
- {
- $this->basePath = $basePath;
- $this->verbosity = $verbosity;
- }
-
- public function deletePaths()
- {
- if (!empty($this->paths)) {
- foreach ($this->paths as $path) {
- unlink($path);
- }
- }
- }
-
- protected function getGlobalReplacements()
- {
- return [
- '{userId}' => getenv('OS_USER_ID'),
- '{username}' => getenv('OS_USERNAME'),
- '{password}' => getenv('OS_PASSWORD'),
- '{domainId}' => getenv('OS_DOMAIN_ID'),
- '{authUrl}' => getenv('OS_AUTH_URL'),
- '{tenantId}' => getenv('OS_TENANT_ID'),
- '{region}' => getenv('OS_REGION'),
- '{projectId}' => getenv('OS_PROJECT_ID'),
- '{projectName}' => getenv('OS_PROJECT_NAME'),
- ];
- }
-
- protected function getConnectionTemplate()
- {
- if ($this->verbosity === 1) {
- $subst = <<<'EOL'
-use OpenCloud\Integration\DefaultLogger;
-use OpenCloud\Integration\Utils;
-use GuzzleHttp\MessageFormatter;
-
-$options = [
- 'debugLog' => true,
- 'logger' => new DefaultLogger(),
- 'messageFormatter' => new MessageFormatter(),
-];
-$openstack = new OpenCloud\OpenCloud(Utils::getAuthOpts($options));
-EOL;
- } elseif ($this->verbosity === 2) {
- $subst = <<<'EOL'
-use OpenCloud\Integration\DefaultLogger;
-use OpenCloud\Integration\Utils;
-use GuzzleHttp\MessageFormatter;
-
-$options = [
- 'debugLog' => true,
- 'logger' => new DefaultLogger(),
- 'messageFormatter' => new MessageFormatter(MessageFormatter::DEBUG),
-];
-$openstack = new OpenCloud\OpenCloud(Utils::getAuthOpts($options));
-EOL;
- } else {
- $subst = <<<'EOL'
-use OpenCloud\Integration\Utils;
-
-$openstack = new OpenCloud\OpenCloud(Utils::getAuthOpts());
-EOL;
- }
-
- return $subst;
- }
-
- public function write($path, array $replacements)
- {
- $replacements = array_merge($this->getGlobalReplacements(), $replacements);
-
- $sampleFile = rtrim($this->basePath, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . $path;
-
- if (!file_exists($sampleFile) || !is_readable($sampleFile)) {
- throw new \RuntimeException(sprintf("%s either does not exist or is not readable", $sampleFile));
- }
-
- $content = strtr(file_get_contents($sampleFile), $replacements);
- $content = str_replace("'vendor/'", "'" . dirname(dirname(__DIR__)) . DIRECTORY_SEPARATOR . "vendor'", $content);
-
- $subst = $this->getConnectionTemplate();
- $content = preg_replace('/\([^)]+\)/', '', $content, 1);
- $content = str_replace('$openstack = new OpenCloud\OpenCloud;', $subst, $content);
-
- $tmp = tempnam(sys_get_temp_dir(), 'openstack');
- file_put_contents($tmp, $content);
-
- $this->paths[] = $tmp;
-
- return $tmp;
- }
-}
diff --git a/server/vendor/php-opencloud/common/tests/integration/SampleManagerInterface.php b/server/vendor/php-opencloud/common/tests/integration/SampleManagerInterface.php
deleted file mode 100644
index c4293ba..0000000
--- a/server/vendor/php-opencloud/common/tests/integration/SampleManagerInterface.php
+++ /dev/null
@@ -1,10 +0,0 @@
-<?php
-
-namespace OpenCloud\Integration;
-
-interface SampleManagerInterface
-{
- public function write($path, array $replacements);
-
- public function deletePaths();
-}
diff --git a/server/vendor/php-opencloud/common/tests/integration/TestCase.php b/server/vendor/php-opencloud/common/tests/integration/TestCase.php
deleted file mode 100644
index cb81381..0000000
--- a/server/vendor/php-opencloud/common/tests/integration/TestCase.php
+++ /dev/null
@@ -1,115 +0,0 @@
-<?php
-
-namespace OpenCloud\Integration;
-
-use Psr\Log\LoggerInterface;
-
-abstract class TestCase extends \PHPUnit_Framework_TestCase implements TestInterface
-{
- private $logger;
- private $startPoint;
- private $lastPoint;
- private $sampleManager;
-
- public function __construct(LoggerInterface $logger, SampleManagerInterface $sampleManager)
- {
- $this->logger = $logger;
- $this->sampleManager = $sampleManager;
- }
-
- public function teardown()
- {
- $this->sampleManager->deletePaths();
- }
-
- public function runOneTest($name)
- {
- if (!method_exists($this, $name)) {
- throw new \InvalidArgumentException(sprintf("%s method does not exist", $name));
- }
-
- $this->startTimer();
- $this->$name();
- $this->outputTimeTaken();
- }
-
- protected function startTimer()
- {
- $this->startPoint = $this->lastPoint = microtime(true);
- }
-
- private function wrapColor($message, $colorPrefix)
- {
- return sprintf("%s%s", $colorPrefix, $message) . "\033[0m\033[1;0m";
- }
-
- protected function logStep($message, array $context = [])
- {
- $duration = microtime(true) - $this->lastPoint;
-
- $stepTimeTaken = sprintf('(%s)', $this->formatSecDifference($duration));
-
- if ($duration >= 10) {
- $color = "\033[0m\033[1;31m"; // red
- } elseif ($duration >= 2) {
- $color = "\033[0m\033[1;33m"; // yellow
- } else {
- $color = "\033[0m\033[1;32m"; // green
- }
-
- $message = '{timeTaken} ' . $message;
- $context['{timeTaken}'] = $this->wrapColor($stepTimeTaken, $color);
-
- $this->logger->info($message, $context);
-
- $this->lastPoint = microtime(true);
- }
-
- protected function randomStr($length = 5)
- {
- $chars = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
- $charsLen = strlen($chars);
-
- $randomString = '';
- for ($i = 0; $i < $length; $i++) {
- $randomString .= $chars[rand(0, $charsLen - 1)];
- }
-
- return 'phptest_' . $randomString;
- }
-
- private function formatMinDifference($duration)
- {
- $output = '';
-
- if (($minutes = floor($duration / 60)) > 0) {
- $output .= $minutes . 'min' . (($minutes > 1) ? 's' : '');
- }
-
- if (($seconds = number_format(fmod($duration, 60), 2)) > 0) {
- if ($minutes > 0) {
- $output .= ' ';
- }
- $output .= $seconds . 's';
- }
-
- return $output;
- }
-
- private function formatSecDifference($duration)
- {
- return number_format($duration, 2) . 's';
- }
-
- protected function outputTimeTaken()
- {
- $output = $this->formatMinDifference(microtime(true) - $this->startPoint);
-
- $this->logger->info('Finished all tests! Time taken: {output}.', ['{output}' => $output]);
- }
-
- protected function sampleFile(array $replacements, $path)
- {
- return $this->sampleManager->write($path, $replacements);
- }
-}
diff --git a/server/vendor/php-opencloud/common/tests/integration/TestInterface.php b/server/vendor/php-opencloud/common/tests/integration/TestInterface.php
deleted file mode 100644
index 418b407..0000000
--- a/server/vendor/php-opencloud/common/tests/integration/TestInterface.php
+++ /dev/null
@@ -1,16 +0,0 @@
-<?php
-
-namespace OpenCloud\Integration;
-
-use Psr\Log\LoggerInterface;
-
-interface TestInterface
-{
- public function __construct(LoggerInterface $logger, SampleManagerInterface $sampleManager);
-
- public function runTests();
-
- public function runOneTest($name);
-
- public function teardown();
-}
diff --git a/server/vendor/php-opencloud/common/tests/integration/Utils.php b/server/vendor/php-opencloud/common/tests/integration/Utils.php
deleted file mode 100644
index d24c1bb..0000000
--- a/server/vendor/php-opencloud/common/tests/integration/Utils.php
+++ /dev/null
@@ -1,13 +0,0 @@
-<?php
-
-namespace OpenCloud\Integration;
-
-use GuzzleHttp\Client;
-
-class Utils
-{
- public static function toCamelCase($word, $separator = '_')
- {
- return str_replace($separator, '', ucwords($word, $separator));
- }
-}
diff --git a/server/vendor/php-opencloud/common/tests/integration/script/compute_v2 b/server/vendor/php-opencloud/common/tests/integration/script/compute_v2
deleted file mode 100755
index 5e90b05..0000000
--- a/server/vendor/php-opencloud/common/tests/integration/script/compute_v2
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/bin/bash
-
-php tests/integration/Runner.php -s compute -v v2
diff --git a/server/vendor/php-opencloud/common/tests/integration/script/identity_v3 b/server/vendor/php-opencloud/common/tests/integration/script/identity_v3
deleted file mode 100755
index cd175b5..0000000
--- a/server/vendor/php-opencloud/common/tests/integration/script/identity_v3
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/bin/bash
-
-php tests/integration/Runner.php -s identity -v v3
diff --git a/server/vendor/php-opencloud/common/tests/integration/script/networking_v2 b/server/vendor/php-opencloud/common/tests/integration/script/networking_v2
deleted file mode 100755
index 9583f68..0000000
--- a/server/vendor/php-opencloud/common/tests/integration/script/networking_v2
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/bin/bash
-
-php tests/integration/Runner.php -s networking -v v2
diff --git a/server/vendor/php-opencloud/common/tests/integration/script/objectstore_v2 b/server/vendor/php-opencloud/common/tests/integration/script/objectstore_v2
deleted file mode 100755
index 3fb893a..0000000
--- a/server/vendor/php-opencloud/common/tests/integration/script/objectstore_v2
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/bin/bash
-
-php tests/integration/Runner.php -s objectstore -v v2
diff --git a/server/vendor/php-opencloud/common/tests/unit/Common/Api/OperationTest.php b/server/vendor/php-opencloud/common/tests/unit/Common/Api/OperationTest.php
deleted file mode 100644
index ea0f7c8..0000000
--- a/server/vendor/php-opencloud/common/tests/unit/Common/Api/OperationTest.php
+++ /dev/null
@@ -1,74 +0,0 @@
-<?php
-
-namespace OpenCloud\Test\Common\Api;
-
-use OpenCloud\Common\Api\Operation;
-use OpenCloud\Common\Api\Parameter;
-use OpenCloud\Test\Fixtures\ComputeV2Api;
-
-class OperationTest extends \PHPUnit_Framework_TestCase
-{
- private $operation;
-
- public function setUp()
- {
- $def = (new ComputeV2Api())->postServer();
-
- $this->operation = new Operation($def);
- }
-
- public function test_it_reveals_whether_params_are_set_or_not()
- {
- $this->assertFalse($this->operation->hasParam('foo'));
- $this->assertTrue($this->operation->hasParam('name'));
- }
-
- public function test_it_gets_params()
- {
- $this->assertInstanceOf(Parameter::class, $this->operation->getParam('name'));
- }
-
- public function test_it_validates_params()
- {
- $this->assertTrue($this->operation->validate([
- 'name' => 'foo',
- 'imageId' => 'bar',
- 'flavorId' => 'baz',
- ]));
- }
-
- /**
- * @expectedException \Exception
- */
- public function test_exceptions_are_propagated()
- {
- $this->assertFalse($this->operation->validate([
- 'name' => true,
- 'imageId' => 'bar',
- 'flavorId' => 'baz',
- ]));
- }
-
- /**
- * @expectedException \Exception
- */
- public function test_an_exception_is_thrown_when_user_does_not_provide_required_options()
- {
- $this->operation->validate([]);
- }
-
- /**
- * @expectedException \Exception
- */
- public function test_it_throws_exception_when_user_provides_undefined_options()
- {
- $userData = ['name' => 'new_server', 'undefined_opt' => 'bah'];
-
- $this->operation->validate($userData);
- }
-
- public function test_it_gets_json_key()
- {
- $this->assertEquals('server', $this->operation->getJsonKey());
- }
-}
diff --git a/server/vendor/php-opencloud/common/tests/unit/Common/Api/OperatorTest.php b/server/vendor/php-opencloud/common/tests/unit/Common/Api/OperatorTest.php
deleted file mode 100644
index e22c25e..0000000
--- a/server/vendor/php-opencloud/common/tests/unit/Common/Api/OperatorTest.php
+++ /dev/null
@@ -1,136 +0,0 @@
-<?php
-
-namespace OpenCloud\Test\Common\Api;
-
-use function GuzzleHttp\Psr7\uri_for;
-use GuzzleHttp\Promise\Promise;
-use GuzzleHttp\Psr7\Request;
-use GuzzleHttp\Psr7\Response;
-use GuzzleHttp\Psr7\Uri;
-use OpenCloud\Common\Api\Operator;
-use OpenCloud\Common\Resource\AbstractResource;
-use OpenCloud\Common\Resource\ResourceInterface;
-use OpenCloud\Test\Fixtures\ComputeV2Api;
-use OpenCloud\Test\TestCase;
-use Prophecy\Argument;
-
-class OperatorTest extends TestCase
-{
- private $operator;
- private $def;
-
- public function setUp()
- {
- parent::setUp();
-
- $this->rootFixturesDir = __DIR__;
-
- $this->def = [
- 'method' => 'GET',
- 'path' => 'test',
- 'params' => [],
- ];
-
- $this->operator = new TestOperator($this->client->reveal(), new ComputeV2Api());
- }
-
- public function test_it_returns_operations()
- {
- $this->assertInstanceOf(
- 'OpenCloud\Common\Api\Operation',
- $this->operator->getOperation($this->def, [])
- );
- }
-
- 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, []);
- }
-
- 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, []);
- }
-
- 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' => []];
- $this->assertInstanceOf(ResourceInterface::class, $this->operator->model(TestResource::class, $data));
- }
-
- public function test_it_wraps_sequential_ops_in_promise_when_async_is_appended_to_method_name()
- {
- $promise = $this->operator->createAsync('something');
-
- $this->assertInstanceOf(Promise::class, $promise);
-
- $promise->then(function ($val) {
- $this->assertEquals('Created something', $val);
- });
-
- $promise->wait();
- }
-
- /**
- * @expectedException \RuntimeException
- */
- public function test_it_throws_exception_when_async_is_called_on_a_non_existent_method()
- {
- $this->operator->fooAsync();
- }
-
- public function test_it_retrieves_base_http_url()
- {
- $returnedUri = uri_for('http://foo.com');
-
- $this->client->getConfig('base_uri')->shouldBeCalled()->willReturn($returnedUri);
-
- $uri = $this->operator->testBaseUri();
-
- $this->assertInstanceOf(Uri::class, $uri);
- $this->assertEquals($returnedUri, $uri);
- }
-
- /**
- * @expectedException \Exception
- */
- public function test_undefined_methods_result_in_error()
- {
- $this->operator->foo();
- }
-}
-
-class TestResource extends AbstractResource
-{
-}
-
-class TestOperator extends Operator
-{
- public function testBaseUri()
- {
- return $this->getHttpBaseUrl();
- }
-
- public function create($str)
- {
- return 'Created ' . $str;
- }
-
- public function fail()
- {
- }
-}
diff --git a/server/vendor/php-opencloud/common/tests/unit/Common/Api/ParameterTest.php b/server/vendor/php-opencloud/common/tests/unit/Common/Api/ParameterTest.php
deleted file mode 100644
index 65d4760..0000000
--- a/server/vendor/php-opencloud/common/tests/unit/Common/Api/ParameterTest.php
+++ /dev/null
@@ -1,203 +0,0 @@
-<?php
-
-namespace OpenCloud\Test\Common\Api;
-
-use OpenCloud\Common\Api\Parameter;
-use OpenCloud\Test\Fixtures\ComputeV2Api;
-
-class ParameterTest extends \PHPUnit_Framework_TestCase
-{
- const PARAMETER_CLASS = 'OpenCloud\Common\Api\Parameter';
-
- private $param;
- private $data;
- private $api;
-
- public function setUp()
- {
- $this->api = new ComputeV2Api();
-
- $this->data = $this->api->postServer()['params']['name'] + ['name' => 'name'];
- $this->param = new Parameter($this->data);
- }
-
- /**
- * @expectedException \RuntimeException
- */
- public function test_exception_is_thrown_for_invalid_locations()
- {
- $data = $this->data;
- $data['location'] = 'foo';
- new Parameter($data);
- }
-
- public function test_it_should_provide_access_to_a_name()
- {
- $this->assertEquals($this->data['name'], $this->param->getName());
- }
-
- public function test_it_should_use_sentAs_alias_for_name_if_one_is_set()
- {
- $data = $this->data + ['sentAs' => 'foo'];
- $param = new Parameter($data);
-
- $this->assertEquals($data['sentAs'], $param->getName());
- }
-
- public function test_it_indicates_whether_it_is_required_or_not()
- {
- $this->assertTrue($this->param->isRequired());
- }
-
- public function test_it_indicates_its_item_schema()
- {
- $data = $this->api->postServer()['params']['networks'] + ['name' => 'networks'];
- $param = new Parameter($data);
-
- $this->assertInstanceOf(self::PARAMETER_CLASS, $param->getItemSchema());
- }
-
- public function test_it_allows_property_retrieval()
- {
- $definition = $this->api->postServer()['params']['networks']['items'] + ['name' => 'network'];
- $param = new Parameter($definition);
-
- $this->assertInstanceOf(self::PARAMETER_CLASS, $param->getProperty('uuid'));
- }
-
- public function test_it_indicates_its_path()
- {
- $path = 'foo.bar.baz';
- $param = new Parameter($this->data + ['path' => $path]);
-
- $this->assertEquals($path, $param->getPath());
- }
-
- public function test_it_verifies_a_given_location_with_a_boolean()
- {
- $this->assertFalse($this->param->hasLocation('foo'));
- $this->assertTrue($this->param->hasLocation('json'));
- }
-
- public function test_it_should_return_true_when_required_attributes_are_provided_and_match_their_definitions()
- {
- $this->assertTrue($this->param->validate('TestName'));
- }
-
- /**
- * @expectedException \Exception
- */
- public function test_it_throws_exception_when_values_do_not_match_their_definition_types()
- {
- $data = $this->api->postServer()['params']['networks'] + ['name' => 'networks'];
- $param = new Parameter($data);
-
- $param->validate('a_network!'); // should be an array
- }
-
- /**
- * @expectedException \Exception
- */
- public function test_it_throws_exception_when_deeply_nested_values_have_wrong_types()
- {
- $data = $this->api->postServer()['params']['networks'] + ['name' => 'networks'];
-
- $param = new Parameter($data);
- $param->validate(['name' => false]); // value should be a string, not bool
- }
-
- public function test_metadata_properties_are_handled_differently()
- {
- $params = [
- 'name' => 'metadata',
- 'type' => 'object',
- 'properties' => [
- 'type' => 'string',
- ],
- ];
-
- $userValues = ['some' => 'value'];
-
- $param = new Parameter($params);
- $this->assertTrue($param->validate($userValues));
- }
-
- public function test_it_passes_validation_when_array_values_pass()
- {
- $params = [
- 'name' => 'foo',
- 'type' => 'array',
- 'items' => ['type' => 'string'],
- ];
-
- $userVals = ['1', '2', '3'];
-
- $param = new Parameter($params);
- $this->assertTrue($param->validate($userVals));
- }
-
- /**
- * @expectedException \Exception
- */
- public function test_an_exception_is_thrown_when_an_undefined_property_is_provided()
- {
- $params = ['type' => 'object', 'properties' => ['foo' => ['type' => 'string']]];
- $userVals = ['bar' => 'baz'];
-
- $param = new Parameter($params);
- $param->validate($userVals);
- }
-
- public function test_it_passes_validation_when_all_subproperties_pass()
- {
- $params = ['type' => 'object', 'properties' => ['foo' => ['type' => 'string']]];
- $userVals = ['foo' => 'baz'];
-
- $param = new Parameter($params);
- $this->assertTrue($param->validate($userVals));
- }
-
- public function test_it_sets_name()
- {
- $this->param->setName('foo');
- $this->assertEquals($this->param->getName(), 'foo');
- }
-
- public function test_it_gets_property()
- {
- $property = new Parameter([
- 'name' => 'metadata',
- 'properties' => [
- 'type' => 'string',
- 'prefix' => 'foo',
- ],
- ]);
-
- $prop = $property->getProperty('metadata');
-
- $this->assertInstanceOf(Parameter::class, $prop);
- $this->assertEquals('foo', $prop->getPrefix());
- }
-
- public function test_it_gets_prefixed_name()
- {
- $property = new Parameter([
- 'name' => 'metadata',
- 'prefix' => 'foo-',
- ]);
-
- $this->assertEquals('foo-metadata', $property->getPrefixedName());
- }
-
- /**
- * @expectedException \Exception
- */
- public function test_exception_is_thrown_when_value_is_not_in_enum_list()
- {
- $data = $this->data;
- $data['enum'] = ['foo'];
-
- $param = new Parameter($data);
- $param->validate('blah');
- }
-}
diff --git a/server/vendor/php-opencloud/common/tests/unit/Common/Api/fixtures/headers.php b/server/vendor/php-opencloud/common/tests/unit/Common/Api/fixtures/headers.php
deleted file mode 100644
index f428992..0000000
--- a/server/vendor/php-opencloud/common/tests/unit/Common/Api/fixtures/headers.php
+++ /dev/null
@@ -1,25 +0,0 @@
-<?php
-
-return [
- 'method' => 'POST',
- 'path' => 'something',
- 'params' => [
- 'name' => [
- 'type' => 'string',
- 'location' => 'header',
- 'sentAs' => 'X-Foo-Name'
- ],
- 'age' => [
- 'type' => 'integer',
- 'location' => 'header'
- ],
- 'metadata' => [
- 'type' => 'object',
- 'location' => 'header',
- 'items' => [
- 'prefix' => 'X-Meta-'
- ]
- ],
- 'other' => ['type' => 'string'] // should not be a header
- ],
-];
diff --git a/server/vendor/php-opencloud/common/tests/unit/Common/Api/fixtures/jsonBody.php b/server/vendor/php-opencloud/common/tests/unit/Common/Api/fixtures/jsonBody.php
deleted file mode 100644
index 350affd..0000000
--- a/server/vendor/php-opencloud/common/tests/unit/Common/Api/fixtures/jsonBody.php
+++ /dev/null
@@ -1,27 +0,0 @@
-<?php
-
-return [
- 'method' => 'POST',
- 'path' => 'something',
- 'params' => [
- 'name' => [
- 'type' => 'string',
- 'sentAs' => 'server_name',
- ],
- 'other' => [
- 'type' => 'array',
- 'sentAs' => 'other_params',
- 'items' => [
- 'type' => 'string'
- ]
- ],
- 'etc' => [
- 'type' => 'object',
- 'sentAs' => 'etcetc',
- 'properties' => [
- 'dob' => ['type' => 'string'],
- 'age' => ['type' => 'integer', 'sentAs' => 'current_age'],
- ]
- ],
- ],
-];
diff --git a/server/vendor/php-opencloud/common/tests/unit/Common/ArrayAccessTraitTest.php b/server/vendor/php-opencloud/common/tests/unit/Common/ArrayAccessTraitTest.php
deleted file mode 100644
index f5d1fdb..0000000
--- a/server/vendor/php-opencloud/common/tests/unit/Common/ArrayAccessTraitTest.php
+++ /dev/null
@@ -1,59 +0,0 @@
-<?php
-
-namespace OpenCloud\Test\Common;
-
-use OpenCloud\Common\ArrayAccessTrait;
-use OpenCloud\Test\TestCase;
-
-class ArrayAccessTraitTest extends TestCase
-{
- private $aa;
-
- public function setUp()
- {
- $this->aa = new ArrayAccess();
- }
-
- public function test_offset_is_set()
- {
- $this->aa->offsetSet('foo', 'bar');
- $this->assertEquals(['foo' => 'bar'], $this->aa->getElements());
- }
-
- public function test_it_appends_if_no_key_is_set()
- {
- $this->aa->offsetSet(null, 'bar');
- $this->assertEquals(['bar'], $this->aa->getElements());
- }
-
- public function test_if_checks_if_offset_exists()
- {
- $this->aa->offsetSet('bar', 'foo');
- $this->assertTrue($this->aa->offsetExists('bar'));
- $this->assertFalse($this->aa->offsetExists('baz'));
- }
-
- public function test_if_gets_offset()
- {
- $this->aa->offsetSet('bar', 'foo');
- $this->assertEquals('foo', $this->aa->offsetGet('bar'));
- $this->assertNull($this->aa->offsetGet('baz'));
- }
-
- public function test_it_unsets_offset()
- {
- $this->aa->offsetSet('bar', 'foo');
- $this->aa->offsetUnset('bar');
- $this->assertNull($this->aa->offsetGet('bar'));
- }
-}
-
-class ArrayAccess
-{
- use ArrayAccessTrait;
-
- public function getElements()
- {
- return $this->internalState;
- }
-}
diff --git a/server/vendor/php-opencloud/common/tests/unit/Common/Auth/AuthHandlerTest.php b/server/vendor/php-opencloud/common/tests/unit/Common/Auth/AuthHandlerTest.php
deleted file mode 100644
index d0d63cf..0000000
--- a/server/vendor/php-opencloud/common/tests/unit/Common/Auth/AuthHandlerTest.php
+++ /dev/null
@@ -1,63 +0,0 @@
-<?php
-
-namespace OpenCloud\Test\Common\Auth;
-
-use GuzzleHttp\Psr7\Request;
-use OpenCloud\Common\Auth\AuthHandler;
-use OpenCloud\Common\Auth\Token;
-use OpenCloud\Test\TestCase;
-use Psr\Http\Message\RequestInterface;
-
-class AuthHandlerTest extends TestCase
-{
- const TOKEN_ID = 'tokenId';
-
- private $generator;
- private $handler;
-
- public function setUp()
- {
- $this->generator = function () {
- $token = $this->prophesize(FakeToken::class);
- $token->getId()->shouldBeCalled()->willReturn(self::TOKEN_ID);
- return $token->reveal();
- };
-
- $this->handler = function (RequestInterface $r) {
- return $r;
- };
-
- $this->handler = new AuthHandler($this->handler, $this->generator);
- }
-
- public function test_it_should_bypass_auth_http_requests()
- {
- // Fake a Keystone request
- $request = new Request('POST', 'https://my-openstack.org:5000/v2.0/tokens');
-
- $this->assertEquals($request, call_user_func_array($this->handler, [$request, []]));
- }
-
- public function test_it_should_generate_a_new_token_if_the_current_token_is_either_expired_or_not_set()
- {
- $token = $this->prophesize(Token::class);
-
- // force the mock token to indicate that its expired
- $token->getId()->willReturn('');
- $token->hasExpired()->willReturn(true);
-
- $request = new Request('GET', '');
-
- $handler = new AuthHandler($this->handler, $this->generator, $token->reveal());
- $handler($request, []);
- }
-}
-
-class FakeToken implements Token
-{
- public function getId(): string
- {}
-
- public function hasExpired(): bool
- {}
-} \ No newline at end of file
diff --git a/server/vendor/php-opencloud/common/tests/unit/Common/DateTime.php b/server/vendor/php-opencloud/common/tests/unit/Common/DateTime.php
deleted file mode 100644
index 512ba30..0000000
--- a/server/vendor/php-opencloud/common/tests/unit/Common/DateTime.php
+++ /dev/null
@@ -1,16 +0,0 @@
-<?php
-
-namespace OpenCloud\Test\Common;
-
-class DateTime extends \DateTime
-{
- public static function factory($time)
- {
- return new static($time);
- }
-
- public function toIso8601()
- {
- return $this->format(self::ISO8601);
- }
-}
diff --git a/server/vendor/php-opencloud/common/tests/unit/Common/Error/BadResponseErrorTest.php b/server/vendor/php-opencloud/common/tests/unit/Common/Error/BadResponseErrorTest.php
deleted file mode 100644
index 7aa4bf1..0000000
--- a/server/vendor/php-opencloud/common/tests/unit/Common/Error/BadResponseErrorTest.php
+++ /dev/null
@@ -1,34 +0,0 @@
-<?php
-
-namespace OpenCloud\Test\Common\Error;
-
-use GuzzleHttp\Psr7\Request;
-use GuzzleHttp\Psr7\Response;
-use OpenCloud\Common\Error\BadResponseError;
-use OpenCloud\Test\TestCase;
-
-class BadResponseErrorTest extends TestCase
-{
- private $e;
-
- public function setUp()
- {
- $this->e = new BadResponseError();
- }
-
- public function test_it_gets_request()
- {
- $r = new Request('GET', '');
-
- $this->e->setRequest($r);
- $this->assertEquals($this->e->getRequest(), $r);
- }
-
- public function test_it_gets_response()
- {
- $r = new Response(500);
-
- $this->e->setResponse($r);
- $this->assertEquals($this->e->getResponse(), $r);
- }
-}
diff --git a/server/vendor/php-opencloud/common/tests/unit/Common/Error/BuilderTest.php b/server/vendor/php-opencloud/common/tests/unit/Common/Error/BuilderTest.php
deleted file mode 100644
index e23806d..0000000
--- a/server/vendor/php-opencloud/common/tests/unit/Common/Error/BuilderTest.php
+++ /dev/null
@@ -1,117 +0,0 @@
-<?php
-
-namespace OpenCloud\Test\Common\Error;
-
-use function GuzzleHttp\Psr7\{stream_for,str};
-
-use GuzzleHttp\ClientInterface;
-use GuzzleHttp\Exception\ClientException;
-use GuzzleHttp\Psr7\{Request,Response};
-use OpenCloud\Common\Error\{BadResponseError,Builder,UserInputError};
-
-class BuilderTest extends \PHPUnit_Framework_TestCase
-{
- private $builder;
- private $client;
-
- public function __construct()
- {
- $this->client = $this->prophesize(ClientInterface::class);
- $this->builder = new Builder($this->client->reveal());
- }
-
- public function test_it_injects_client()
- {
- $this->assertInstanceOf(Builder::class, new Builder($this->client->reveal()));
- }
-
- public function test_it_builds_http_errors()
- {
- $request = new Request('POST', '/servers');
- $response = new Response(400, [], stream_for('Invalid parameters'));
-
- $requestStr = trim($this->builder->str($request));
- $responseStr = trim($this->builder->str($response));
-
- $errorMessage = <<<EOT
-HTTP Error
-~~~~~~~~~~
-The remote server returned a "400 Bad Request" error for the following transaction:
-
-Request
-~~~~~~~
-$requestStr
-
-Response
-~~~~~~~~
-$responseStr
-
-Further information
-~~~~~~~~~~~~~~~~~~~
-Please ensure that your input values are valid and well-formed. Visit http://docs.php-opencloud.com/en/latest/http-codes for more information about debugging HTTP status codes, or file a support issue on https://github.com/php-opencloud/openstack/issues.
-EOT;
-
- $e = new BadResponseError($errorMessage);
- $e->setRequest($request);
- $e->setResponse($response);
-
- $this->assertEquals($e, $this->builder->httpError($request, $response));
- }
-
- public function test_it_builds_user_input_errors()
- {
- $expected = 'A well-formed string';
- $value = ['foo' => true];
- $link = 'http://docs.php-opencloud.com/en/latest/index.html';
-
- $errorMessage = <<<EOT
-User Input Error
-~~~~~~~~~~~~~~~~
-A well-formed string was expected, but the following value was passed in:
-
-Array
-(
- [foo] => 1
-)
-
-Please ensure that the value adheres to the expectation above. Visit $link for more information about input arguments. If you run into trouble, please open a support issue on https://github.com/php-opencloud/openstack/issues.
-EOT;
-
- $this->client
- ->request('HEAD', $link)
- ->shouldBeCalled()
- ->willReturn(new Response(200));
-
- $e = new UserInputError($errorMessage);
-
- $this->assertEquals($e, $this->builder->userInputError($expected, $value, 'index.html'));
- }
-
- public function test_dead_links_are_ignored()
- {
- $expected = 'A well-formed string';
- $value = ['foo' => true];
-
- $errorMessage = <<<EOT
-User Input Error
-~~~~~~~~~~~~~~~~
-A well-formed string was expected, but the following value was passed in:
-
-Array
-(
- [foo] => 1
-)
-
-Please ensure that the value adheres to the expectation above. If you run into trouble, please open a support issue on https://github.com/php-opencloud/openstack/issues.
-EOT;
-
- $this->client
- ->request('HEAD', 'http://docs.php-opencloud.com/en/latest/sdffsda')
- ->shouldBeCalled()
- ->willThrow(ClientException::class);
-
- $e = new UserInputError($errorMessage);
-
- $this->assertEquals($e, $this->builder->userInputError($expected, $value, 'sdffsda'));
- }
-}
diff --git a/server/vendor/php-opencloud/common/tests/unit/Common/HydratorStrategyTraitTes.php b/server/vendor/php-opencloud/common/tests/unit/Common/HydratorStrategyTraitTes.php
deleted file mode 100644
index 6841002..0000000
--- a/server/vendor/php-opencloud/common/tests/unit/Common/HydratorStrategyTraitTes.php
+++ /dev/null
@@ -1,52 +0,0 @@
-<?php
-
-namespace OpenCloud\Test\Common;
-
-use OpenCloud\Common\HydratorStrategyTrait;
-use OpenCloud\Test\TestCase;
-
-class HydratorStrategyTraitTest extends TestCase
-{
- private $fixture;
-
- public function setUp()
- {
- $this->fixture = new Fixture();
- }
-
- public function test_it_hydrates()
- {
- $data = ['foo' => 1, 'bar' => 2, 'baz' => 3, 'boo' => 4];
-
- $this->fixture->hydrate($data);
-
- $this->assertEquals(1, $this->fixture->foo);
- $this->assertEquals(2, $this->fixture->getBar());
- $this->assertEquals(3, $this->fixture->getBaz());
- }
-
- public function test_it_hydrates_aliases()
- {
- $this->fixture->hydrate(['FOO!' => 1], ['FOO!' => 'foo']);
-
- $this->assertEquals(1, $this->fixture->foo);
- }
-}
-
-class Fixture
-{
- public $foo;
- protected $bar;
- private $baz;
-
- use HydratorStrategyTrait;
-
- public function getBar()
- {
- return $this->bar;
- }
- public function getBaz()
- {
- return $this->baz;
- }
-}
diff --git a/server/vendor/php-opencloud/common/tests/unit/Common/JsonPathTest.php b/server/vendor/php-opencloud/common/tests/unit/Common/JsonPathTest.php
deleted file mode 100644
index 1410076..0000000
--- a/server/vendor/php-opencloud/common/tests/unit/Common/JsonPathTest.php
+++ /dev/null
@@ -1,70 +0,0 @@
-<?php
-
-namespace OpenCloud\Test\Common;
-
-use OpenCloud\Common\JsonPath;
-
-class JsonPathTest extends \PHPUnit_Framework_TestCase
-{
- private $jsonPath;
-
- public function setUp()
- {
- $this->jsonPath = new JsonPath([]);
- }
-
- public function test_it_sets_values_according_to_paths()
- {
- $this->jsonPath->set('foo.bar.baz', 'VALUE');
-
- $expected = [
- 'foo' => [
- 'bar' => [
- 'baz' => 'VALUE',
- ]
- ]
- ];
-
- $this->assertEquals($expected, $this->jsonPath->getStructure());
- }
-
- public function test_it_sets_arrays_according_to_paths()
- {
- $jsonPath = new JsonPath([
- 'foo' => [
- 'bar' => [
- 'value' => 'VALUE',
- ]
- ]
- ]);
-
- $jsonPath->set('foo.bar.items', ['item_1', 'item_2']);
-
- $expected = [
- 'foo' => [
- 'bar' => [
- 'value' => 'VALUE',
- 'items' => ['item_1', 'item_2'],
- ]
- ]
- ];
-
- $this->assertEquals($expected, $jsonPath->getStructure());
- }
-
- public function test_it_gets_values_according_to_paths()
- {
- $jsonPath = new JsonPath([
- 'foo' => [
- 'bar' => [
- 'baz' => 'VALUE_1',
- 'lol' => 'VALUE_2',
- ]
- ]
- ]);
-
- $this->assertEquals('VALUE_1', $jsonPath->get('foo.bar.baz'));
- $this->assertEquals('VALUE_2', $jsonPath->get('foo.bar.lol'));
- $this->assertNull($jsonPath->get('foo.bar.boo'));
- }
-}
diff --git a/server/vendor/php-opencloud/common/tests/unit/Common/JsonSchema/Fixtures/jsonPatchTests.json b/server/vendor/php-opencloud/common/tests/unit/Common/JsonSchema/Fixtures/jsonPatchTests.json
deleted file mode 100644
index e7f3579..0000000
--- a/server/vendor/php-opencloud/common/tests/unit/Common/JsonSchema/Fixtures/jsonPatchTests.json
+++ /dev/null
@@ -1,231 +0,0 @@
-[
- { "comment": "empty list, empty docs",
- "doc": {},
- "patch": [],
- "expected": {} },
-
- { "comment": "empty patch list",
- "doc": {"foo": 1},
- "patch": [],
- "expected": {"foo": 1} },
-
- { "comment": "rearrangements OK?",
- "doc": {"foo": 1, "bar": 2},
- "patch": [],
- "expected": {"bar":2, "foo": 1} },
-
- { "comment": "rearrangements OK? How about one level down ... array",
- "doc": [{"foo": 1, "bar": 2}],
- "patch": [],
- "expected": [{"bar":2, "foo": 1}] },
-
- { "comment": "rearrangements OK? How about one level down...",
- "doc": {"foo":{"foo": 1, "bar": 2}},
- "patch": [],
- "expected": {"foo":{"bar":2, "foo": 1}} },
-
- { "comment": "toplevel array",
- "doc": [],
- "patch": [{"op": "add", "path": "/0", "value": "foo"}],
- "expected": ["foo"] },
-
- { "comment": "toplevel array, no change",
- "doc": ["foo"],
- "patch": [],
- "expected": ["foo"] },
-
- { "comment": "toplevel object, numeric string",
- "doc": {},
- "patch": [{"op": "add", "path": "/foo", "value": "1"}],
- "expected": {"foo":"1"} },
-
- { "comment": "toplevel object, integer",
- "doc": {},
- "patch": [{"op": "add", "path": "/foo", "value": 1}],
- "expected": {"foo":1} },
-
- { "comment": "Toplevel scalar values OK?",
- "doc": "foo",
- "patch": [{"op": "replace", "path": "", "value": "bar"}],
- "expected": "bar",
- "disabled": true },
-
- { "comment": "Add, / target",
- "doc": {},
- "patch": [ {"op": "add", "path": "/", "value":1 } ],
- "expected": {"":1} },
-
- { "comment": "Add composite value at top level",
- "doc": {"foo": 1},
- "patch": [{"op": "add", "path": "/bar", "value": [1, 2]}],
- "expected": {"foo": 1, "bar": [1, 2]} },
-
- { "comment": "Add into composite value",
- "doc": {"foo": 1, "baz": [{"qux": "hello"}]},
- "patch": [{"op": "add", "path": "/baz/0/foo", "value": "world"}],
- "expected": {"foo": 1, "baz": [{"qux": "hello", "foo": "world"}]} },
-
- { "doc": {"bar": [1, 2]},
- "patch": [{"op": "add", "path": "/bar/8", "value": "5"}],
- "error": "Out of bounds (upper)" },
-
- { "doc": {"bar": [1, 2]},
- "patch": [{"op": "add", "path": "/bar/-1", "value": "5"}],
- "error": "Out of bounds (lower)" },
-
- { "doc": {"foo": 1},
- "patch": [{"op": "add", "path": "/bar", "value": true}],
- "expected": {"foo": 1, "bar": true} },
-
- { "doc": {"foo": 1},
- "patch": [{"op": "add", "path": "/bar", "value": false}],
- "expected": {"foo": 1, "bar": false} },
-
- { "doc": {"foo": 1},
- "patch": [{"op": "add", "path": "/bar", "value": null}],
- "expected": {"foo": 1, "bar": null} },
-
- { "comment": "0 can be an array index or object element name",
- "doc": {"foo": 1},
- "patch": [{"op": "add", "path": "/0", "value": "bar"}],
- "expected": {"foo": 1, "0": "bar" } },
-
- { "doc": ["foo"],
- "patch": [{"op": "add", "path": "/1", "value": "bar"}],
- "expected": ["foo", "bar"] },
-
- { "doc": ["foo", "sil"],
- "patch": [{"op": "add", "path": "/1", "value": "bar"}],
- "expected": ["foo", "bar", "sil"] },
-
- { "doc": ["foo", "sil"],
- "patch": [{"op": "add", "path": "/0", "value": "bar"}],
- "expected": ["bar", "foo", "sil"] },
-
- { "comment": "push item to array via last index + 1",
- "doc": ["foo", "sil"],
- "patch": [{"op":"add", "path": "/2", "value": "bar"}],
- "expected": ["foo", "sil", "bar"] },
-
- { "comment": "add item to array at index > length should fail",
- "doc": ["foo", "sil"],
- "patch": [{"op":"add", "path": "/3", "value": "bar"}],
- "error": "index is greater than number of items in array" },
-
- { "doc": ["foo", "sil"],
- "patch": [{"op": "add", "path": "/bar", "value": 42}],
- "error": "Object operation on array target" },
-
- { "doc": ["foo", "sil"],
- "patch": [{"op": "add", "path": "/1", "value": ["bar", "baz"]}],
- "expected": ["foo", ["bar", "baz"], "sil"],
- "comment": "value in array add not flattened" },
-
- { "doc": {"foo": 1, "bar": [1, 2, 3, 4]},
- "patch": [{"op": "remove", "path": "/bar"}],
- "expected": {"foo": 1} },
-
- { "doc": {"foo": 1, "baz": [{"qux": "hello"}]},
- "patch": [{"op": "remove", "path": "/baz/0/qux"}],
- "expected": {"foo": 1, "baz": [{}]} },
-
- { "doc": {"foo": 1, "baz": [{"qux": "hello"}]},
- "patch": [{"op": "replace", "path": "/foo", "value": [1, 2, 3, 4]}],
- "expected": {"foo": [1, 2, 3, 4], "baz": [{"qux": "hello"}]} },
-
- { "doc": {"foo": [1, 2, 3, 4], "baz": [{"qux": "hello"}]},
- "patch": [{"op": "replace", "path": "/baz/0/qux", "value": "world"}],
- "expected": {"foo": [1, 2, 3, 4], "baz": [{"qux": "world"}]} },
-
- { "doc": ["foo"],
- "patch": [{"op": "replace", "path": "/0", "value": "bar"}],
- "expected": ["bar"] },
-
- { "doc": [""],
- "patch": [{"op": "replace", "path": "/0", "value": 0}],
- "expected": [0] },
-
- { "doc": [""],
- "patch": [{"op": "replace", "path": "/0", "value": true}],
- "expected": [true] },
-
- { "doc": [""],
- "patch": [{"op": "replace", "path": "/0", "value": false}],
- "expected": [false] },
-
- { "doc": [""],
- "patch": [{"op": "replace", "path": "/0", "value": null}],
- "expected": [null] },
-
- { "doc": ["foo", "sil"],
- "patch": [{"op": "replace", "path": "/1", "value": ["bar", "baz"]}],
- "expected": ["foo", ["bar", "baz"]],
- "comment": "value in array replace not flattened" },
-
- { "comment": "replace whole document",
- "disabled": true,
- "doc": {"foo": "bar"},
- "patch": [{"op": "replace", "path": "", "value": {"baz": "qux"}}],
- "expected": {"baz": "qux"} },
-
- { "doc": {"foo": null},
- "patch": [{"op": "replace", "path": "/foo", "value": "truthy"}],
- "expected": {"foo": "truthy"},
- "comment": "null value should be valid obj property to be replaced with something truthy" },
-
- { "doc": {"foo": null},
- "patch": [{"op": "remove", "path": "/foo"}],
- "expected": {},
- "comment": "null value should be valid obj property to be removed" },
-
- { "doc": {"foo": "bar"},
- "patch": [{"op": "replace", "path": "/foo", "value": null}],
- "expected": {"foo": null},
- "comment": "null value should still be valid obj property replace other value" },
-
- { "comment": "test remove with bad number should fail",
- "doc": {"foo": 1, "baz": [{"qux": "hello"}]},
- "patch": [{"op": "remove", "path": "/baz/1e0/qux"}],
- "error": "remove op shouldn't remove from array with bad number" },
-
- { "comment": "test remove on array",
- "doc": [1, 2, 3, 4],
- "patch": [{"op": "remove", "path": "/0"}],
- "expected": [2, 3, 4] },
-
- { "comment": "test repeated removes",
- "doc": [1, 2, 3, 4],
- "patch": [{ "op": "remove", "path": "/1" },
- { "op": "remove", "path": "/3" }],
- "expected": [1, 3] },
-
- { "comment": "test remove with bad index should fail",
- "doc": [1, 2, 3, 4],
- "patch": [{"op": "remove", "path": "/1e0"}],
- "error": "remove op shouldn't remove from array with bad number" },
-
- { "comment": "test replace with bad number should fail",
- "doc": [""],
- "patch": [{"op": "replace", "path": "/1e0", "value": false}],
- "error": "replace op shouldn't replace in array with bad number" },
-
- { "comment": "test add with bad number should fail",
- "doc": ["foo", "sil"],
- "patch": [{"op": "add", "path": "/1e0", "value": "bar"}],
- "error": "add op shouldn't add to array with bad number" },
-
- { "comment": "missing 'value' parameter to add",
- "doc": [ 1 ],
- "patch": [ { "op": "add", "path": "/-" } ],
- "error": "missing 'value' parameter" },
-
- { "comment": "missing 'value' parameter to replace",
- "doc": [ 1 ],
- "patch": [ { "op": "replace", "path": "/0" } ],
- "error": "missing 'value' parameter" },
-
- { "comment": "unrecognized op should fail",
- "doc": {"foo": 1},
- "patch": [{"op": "spam", "path": "/foo", "value": 1}],
- "error": "Unrecognized op 'spam'" }
-] \ No newline at end of file
diff --git a/server/vendor/php-opencloud/common/tests/unit/Common/JsonSchema/JsonPatchTest.php b/server/vendor/php-opencloud/common/tests/unit/Common/JsonSchema/JsonPatchTest.php
deleted file mode 100644
index ee7db9e..0000000
--- a/server/vendor/php-opencloud/common/tests/unit/Common/JsonSchema/JsonPatchTest.php
+++ /dev/null
@@ -1,28 +0,0 @@
-<?php
-
-namespace OpenCloud\Test\Common\JsonSchema;
-
-use OpenCloud\Common\JsonSchema\JsonPatch;
-use OpenCloud\Test\TestCase;
-
-class JsonPatchTest extends TestCase
-{
- public function testAll()
- {
- $fixtures = json_decode(file_get_contents(__DIR__ . '/Fixtures/jsonPatchTests.json'));
-
- foreach ($fixtures as $fixture) {
- if (isset($fixture->disabled) || !isset($fixture->expected)) {
- continue;
- }
-
- $actual = JsonPatch::diff($fixture->doc, $fixture->expected);
-
- $this->assertEquals(
- json_encode($fixture->patch, JSON_UNESCAPED_SLASHES),
- json_encode($actual, JSON_UNESCAPED_SLASHES),
- isset($fixture->comment) ? sprintf("Failed asserting test: %s\n", $fixture->comment) : ''
- );
- }
- }
-}
diff --git a/server/vendor/php-opencloud/common/tests/unit/Common/JsonSchema/SchemaTest.php b/server/vendor/php-opencloud/common/tests/unit/Common/JsonSchema/SchemaTest.php
deleted file mode 100644
index 4aae8e5..0000000
--- a/server/vendor/php-opencloud/common/tests/unit/Common/JsonSchema/SchemaTest.php
+++ /dev/null
@@ -1,102 +0,0 @@
-<?php
-
-namespace OpenCloud\Test\Common\JsonSchema;
-
-use JsonSchema\Validator;
-use OpenCloud\Common\JsonSchema\Schema;
-use OpenCloud\Test\TestCase;
-
-class SchemaTest extends TestCase
-{
- /** @var Schema */
- private $schema;
-
- /** @var Validator */
- private $validator;
- private $body;
-
- public function setUp()
- {
- $this->body = [
- 'properties' => [
- 'foo' => (object)[],
- 'bar' => (object)[],
- 'baz' => (object)['readOnly' => true],
- ],
- ];
-
- $this->validator = $this->prophesize(Validator::class);
- $this->schema = new Schema($this->body, $this->validator->reveal());
- }
-
- public function test_it_gets_errors()
- {
- $this->validator->getErrors()
- ->shouldBeCalled()
- ->willReturn([]);
-
- $this->assertEquals([], $this->schema->getErrors());
- }
-
- public function test_it_gets_error_string()
- {
- $this->validator->getErrors()
- ->shouldBeCalled()
- ->willReturn([['property' => 'foo', 'message' => 'bar']]);
-
- $errorMsg = sprintf("Provided values do not validate. Errors:\n[foo] bar\n");
-
- $this->assertEquals($errorMsg, $this->schema->getErrorString());
- }
-
- public function test_it_gets_property_paths()
- {
- $this->assertEquals(['/foo', '/bar', '/baz'], $this->schema->getPropertyPaths());
- }
-
- public function test_it_ignores_readOnly_attrs()
- {
- $expected = (object)[
- 'foo' => true,
- 'bar' => false,
- ];
-
- $subject = (object)[
- 'foo' => true,
- 'bar' => false,
- 'baz' => true,
- ];
-
- $this->assertEquals((object)$expected, $this->schema->normalizeObject((object)$subject, []));
- }
-
- public function test_it_stocks_aliases()
- {
- $subject = (object)[
- 'fooAlias' => true,
- 'bar' => false,
- 'other' => true,
- ];
-
- $expected = (object)[
- 'foo' => true,
- 'bar' => false,
- ];
-
- $this->assertEquals($expected, $this->schema->normalizeObject($subject, ['foo' => 'fooAlias', 'bar' => 'lol']));
- }
-
- public function test_it_validates()
- {
- $this->validator->check([], (object) $this->body)->shouldBeCalled();
-
- $this->schema->validate([]);
- }
-
- public function test_it_checks_validity()
- {
- $this->validator->isValid()->shouldBeCalled()->willReturn(true);
-
- $this->schema->isValid();
- }
-} \ No newline at end of file
diff --git a/server/vendor/php-opencloud/common/tests/unit/Common/Resource/AbstractResourceTest.php b/server/vendor/php-opencloud/common/tests/unit/Common/Resource/AbstractResourceTest.php
deleted file mode 100644
index f334292..0000000
--- a/server/vendor/php-opencloud/common/tests/unit/Common/Resource/AbstractResourceTest.php
+++ /dev/null
@@ -1,161 +0,0 @@
-<?php
-
-namespace OpenCloud\Test\Common\Resource;
-
-use function GuzzleHttp\Psr7\stream_for;
-use GuzzleHttp\Psr7\Response;
-use OpenCloud\Common\Resource\AbstractResource;
-use OpenCloud\Common\Resource\Generator;
-use OpenCloud\Test\Fixtures\ComputeV2Api;
-use OpenCloud\Test\TestCase;
-use Prophecy\Argument;
-
-class AbstractResourceTest extends TestCase
-{
- private $resource;
-
- public function setUp()
- {
- parent::setUp();
-
- $this->rootFixturesDir = __DIR__;
- $this->resource = new TestResource($this->client->reveal(), new ComputeV2Api());
- }
-
- public function test_it_populates_from_response()
- {
- $response = new Response(200, ['Content-Type' => 'application/json'], stream_for(
- json_encode(['foo' => ['bar' => '1']])
- ));
-
- $this->resource->populateFromResponse($response);
-
- $this->assertEquals('1', $this->resource->bar);
- }
-
- public function test_it_populates_datetimes_from_arrays()
- {
- $dt = new \DateTimeImmutable('2015');
-
- $this->resource->populateFromArray(['created' => '2015']);
-
- $this->assertEquals($this->resource->created, $dt);
- }
-
- public function test_it_populates_arrays_from_arrays()
- {
- $this->resource->populateFromArray(['children' => [$this->resource, $this->resource]]);
-
- $this->assertInstanceOf(TestResource::class, $this->resource->children[0]);
- }
-
- public function test_it_gets_attrs()
- {
- $this->resource->bar = 'foo';
-
- $this->assertEquals(['bar' => 'foo'], $this->resource->getAttrs(['bar']));
- }
-
- public function test_it_executes_with_state()
- {
- $this->resource->id = 'foo';
- $this->resource->bar = 'bar';
-
- $expectedJson = ['id' => 'foo', 'bar' => 'bar'];
-
- $this->setupMock('GET', 'foo', $expectedJson, [], new Response(204));
-
- $this->resource->executeWithState((new ComputeV2Api())->test());
- }
-
- public function test_it_executes_operations_until_a_204_is_received()
- {
- $this->client
- ->request('GET', 'servers', ['headers' => []])
- ->shouldBeCalled()
- ->willReturn($this->getFixture('servers-page1'));
-
- $this->client
- ->request('GET', 'servers', ['query' => ['marker' => '5'], 'headers' => []])
- ->shouldBeCalled()
- ->willReturn(new Response(204));
-
- $count = 0;
-
- $api = new ComputeV2Api();
-
- foreach ($this->resource->enumerate($api->getServers()) as $item) {
- $count++;
- $this->assertInstanceOf(TestResource::class, $item);
- }
-
- $this->assertEquals(5, $count);
- }
-
- public function test_it_invokes_function_if_provided()
- {
- $this->client
- ->request('GET', 'servers', ['headers' => []])
- ->shouldBeCalled()
- ->willReturn($this->getFixture('servers-page1'));
-
- $this->client
- ->request('GET', 'servers', ['query' => ['marker' => '5'], 'headers' => []])
- ->shouldBeCalled()
- ->willReturn(new Response(204));
-
- $api = new ComputeV2Api();
-
- $count = 0;
-
- $fn = function () use (&$count) {
- $count++;
- };
-
- foreach ($this->resource->enumerate($api->getServers(), [], $fn) as $item) {
- }
-
- $this->assertEquals(5, $count);
- }
-
- public function test_it_halts_when_user_provided_limit_is_reached()
- {
- $this->client
- ->request('GET', 'servers', ['query' => ['limit' => 2], 'headers' => []])
- ->shouldBeCalled()
- ->willReturn($this->getFixture('servers-page1'));
-
- $count = 0;
-
- $api = new ComputeV2Api();
-
- foreach ($this->resource->enumerate($api->getServers(), ['limit' => 2]) as $item) {
- $count++;
- }
-
- $this->assertEquals(2, $count);
- }
-}
-
-class TestResource extends AbstractResource
-{
- protected $resourceKey = 'foo';
- protected $resourcesKey = 'servers';
- protected $markerKey = 'id';
-
- /** @var string */
- public $bar;
-
- public $id;
-
- /** @var \DateTimeImmutable */
- public $created;
-
- /** @var []TestResource */
- public $children;
-
- public function getAttrs(array $keys)
- {
- return parent::getAttrs($keys);
- }
-}
diff --git a/server/vendor/php-opencloud/common/tests/unit/Common/Resource/Fixtures/servers-empty.resp b/server/vendor/php-opencloud/common/tests/unit/Common/Resource/Fixtures/servers-empty.resp
deleted file mode 100644
index 655a35b..0000000
--- a/server/vendor/php-opencloud/common/tests/unit/Common/Resource/Fixtures/servers-empty.resp
+++ /dev/null
@@ -1,6 +0,0 @@
-HTTP/1.1 200 OK
-Content-Type: application/json
-
-{
- "servers": []
-} \ No newline at end of file
diff --git a/server/vendor/php-opencloud/common/tests/unit/Common/Resource/Fixtures/servers-page1.resp b/server/vendor/php-opencloud/common/tests/unit/Common/Resource/Fixtures/servers-page1.resp
deleted file mode 100644
index adebcaf..0000000
--- a/server/vendor/php-opencloud/common/tests/unit/Common/Resource/Fixtures/servers-page1.resp
+++ /dev/null
@@ -1,77 +0,0 @@
-HTTP/1.1 200 OK
-Content-Type: application/json
-
-{
- "servers": [
- {
- "id": "1",
- "links": [
- {
- "href": "http://openstack.example.com/v2/openstack/servers/616fb98f-46ca-475e-917e-2563e5a8cd19",
- "rel": "self"
- },
- {
- "href": "http://openstack.example.com/openstack/servers/616fb98f-46ca-475e-917e-2563e5a8cd19",
- "rel": "bookmark"
- }
- ],
- "name": "server1"
- },
- {
- "id": "2",
- "links": [
- {
- "href": "http://openstack.example.com/v2/openstack/servers/616fb98f-46ca-475e-917e-2563e5a8cd19",
- "rel": "self"
- },
- {
- "href": "http://openstack.example.com/openstack/servers/616fb98f-46ca-475e-917e-2563e5a8cd19",
- "rel": "bookmark"
- }
- ],
- "name": "server2"
- },
- {
- "id": "3",
- "links": [
- {
- "href": "http://openstack.example.com/v2/openstack/servers/616fb98f-46ca-475e-917e-2563e5a8cd19",
- "rel": "self"
- },
- {
- "href": "http://openstack.example.com/openstack/servers/616fb98f-46ca-475e-917e-2563e5a8cd19",
- "rel": "bookmark"
- }
- ],
- "name": "server3"
- },
- {
- "id": "4",
- "links": [
- {
- "href": "http://openstack.example.com/v2/openstack/servers/616fb98f-46ca-475e-917e-2563e5a8cd19",
- "rel": "self"
- },
- {
- "href": "http://openstack.example.com/openstack/servers/616fb98f-46ca-475e-917e-2563e5a8cd19",
- "rel": "bookmark"
- }
- ],
- "name": "server4"
- },
- {
- "id": "5",
- "links": [
- {
- "href": "http://openstack.example.com/v2/openstack/servers/616fb98f-46ca-475e-917e-2563e5a8cd19",
- "rel": "self"
- },
- {
- "href": "http://openstack.example.com/openstack/servers/616fb98f-46ca-475e-917e-2563e5a8cd19",
- "rel": "bookmark"
- }
- ],
- "name": "server5"
- }
- ]
-} \ No newline at end of file
diff --git a/server/vendor/php-opencloud/common/tests/unit/Common/Resource/Fixtures/servers-page2.resp b/server/vendor/php-opencloud/common/tests/unit/Common/Resource/Fixtures/servers-page2.resp
deleted file mode 100644
index 6be6b04..0000000
--- a/server/vendor/php-opencloud/common/tests/unit/Common/Resource/Fixtures/servers-page2.resp
+++ /dev/null
@@ -1,77 +0,0 @@
-HTTP/1.1 200 OK
-Content-Type: application/json
-
-{
- "servers": [
- {
- "id": "6",
- "links": [
- {
- "href": "http://openstack.example.com/v2/openstack/servers/616fb98f-46ca-475e-917e-2563e5a8cd19",
- "rel": "self"
- },
- {
- "href": "http://openstack.example.com/openstack/servers/616fb98f-46ca-475e-917e-2563e5a8cd19",
- "rel": "bookmark"
- }
- ],
- "name": "server6"
- },
- {
- "id": "7",
- "links": [
- {
- "href": "http://openstack.example.com/v2/openstack/servers/616fb98f-46ca-475e-917e-2563e5a8cd19",
- "rel": "self"
- },
- {
- "href": "http://openstack.example.com/openstack/servers/616fb98f-46ca-475e-917e-2563e5a8cd19",
- "rel": "bookmark"
- }
- ],
- "name": "server7"
- },
- {
- "id": "8",
- "links": [
- {
- "href": "http://openstack.example.com/v2/openstack/servers/616fb98f-46ca-475e-917e-2563e5a8cd19",
- "rel": "self"
- },
- {
- "href": "http://openstack.example.com/openstack/servers/616fb98f-46ca-475e-917e-2563e5a8cd19",
- "rel": "bookmark"
- }
- ],
- "name": "server8"
- },
- {
- "id": "9",
- "links": [
- {
- "href": "http://openstack.example.com/v2/openstack/servers/616fb98f-46ca-475e-917e-2563e5a8cd19",
- "rel": "self"
- },
- {
- "href": "http://openstack.example.com/openstack/servers/616fb98f-46ca-475e-917e-2563e5a8cd19",
- "rel": "bookmark"
- }
- ],
- "name": "server9"
- },
- {
- "id": "10",
- "links": [
- {
- "href": "http://openstack.example.com/v2/openstack/servers/616fb98f-46ca-475e-917e-2563e5a8cd19",
- "rel": "self"
- },
- {
- "href": "http://openstack.example.com/openstack/servers/616fb98f-46ca-475e-917e-2563e5a8cd19",
- "rel": "bookmark"
- }
- ],
- "name": "server10"
- }
- ]
-} \ No newline at end of file
diff --git a/server/vendor/php-opencloud/common/tests/unit/Common/Service/BuilderTest.php b/server/vendor/php-opencloud/common/tests/unit/Common/Service/BuilderTest.php
deleted file mode 100644
index 09e9918..0000000
--- a/server/vendor/php-opencloud/common/tests/unit/Common/Service/BuilderTest.php
+++ /dev/null
@@ -1,164 +0,0 @@
-<?php
-
-namespace OpenCloud\Test\Common\Service;
-
-use GuzzleHttp\ClientInterface;
-use OpenCloud\Common\Service\Builder;
-use OpenCloud\Identity\v2\Models\Token;
-use OpenCloud\Identity\v2\Service as IdentityV2;
-use OpenCloud\Identity\v3\Service as IdentityV3;
-use OpenCloud\Compute\v2\Service as ComputeV2;
-use OpenCloud\Test\Common\Auth\FakeToken;
-use OpenCloud\Test\TestCase;
-use Prophecy\Argument;
-
-class BuilderTest extends TestCase
-{
- private $builder;
- private $opts;
-
- public function setUp()
- {
- $this->builder = new Builder([]);
-
- $this->opts = [
- 'username' => '1',
- 'password' => '2',
- 'tenantId' => '3',
- 'authUrl' => '4',
- 'region' => '5',
- 'catalogName' => '6',
- 'catalogType' => '7',
- ];
- }
-
- /**
- * @expectedException \Exception
- */
- public function test_it_throws_exception_if_username_is_missing()
- {
- $this->builder->createService('Compute', 2, []);
- }
-
- /**
- * @expectedException \Throwable
- */
- public function test_it_throws_exception_if_password_is_missing()
- {
- $this->builder->createService('Compute', 2, ['username' => 1]);
- }
-
- /**
- * @expectedException \Throwable
- */
- public function test_it_throws_exception_if_both_tenantId_and_tenantName_is_missing()
- {
- $this->builder->createService('Compute', 2, [
- 'username' => 1, 'password' => 2, 'authUrl' => 4, 'region' => 5, 'catalogName' => 6, 'catalogType' => 7,
- ]);
- }
-
- /**
- * @expectedException \Throwable
- */
- public function test_it_throws_exception_if_authUrl_is_missing()
- {
- $this->builder->createService('Compute', 2, ['username' => 1, 'password' => 2, 'tenantId' => 3]);
- }
-
- /**
- * @expectedException \Throwable
- */
- public function test_it_throws_exception_if_region_is_missing()
- {
- $this->builder->createService('Compute', 2, [
- 'username' => 1, 'password' => 2, 'tenantId' => 3, 'authUrl' => 4,
- ]);
- }
-
- /**
- * @expectedException \Throwable
- */
- public function test_it_throws_exception_if_catalogName_is_missing()
- {
- $this->builder->createService('Compute', 2, [
- 'username' => 1, 'password' => 2, 'tenantId' => 3, 'authUrl' => 4,
- ]);
- }
-
- /**
- * @expectedException \Throwable
- */
- public function test_it_throws_exception_if_catalogType_is_missing()
- {
- $this->builder->createService('Compute', 2, [
- 'username' => 1, 'password' => 2, 'tenantId' => 3, 'authUrl' => 4, 'region' => 5, 'catalogName' => 6,
- ]);
- }
-
-// public function test_it_builds_services_with_custom_identity_service()
-// {
-// $this->rootFixturesDir = dirname(dirname(__DIR__)) . '/Identity/v2/';
-//
-// $token = $this->prophesize(FakeToken::class)->reveal();
-// $service = $this->prophesize(IdentityService::class);
-// $service->authenticate(Argument::type('array'))->shouldBeCalled()->willReturn([$token, '']);
-//
-// $this->opts += [
-// 'identityService' => $service->reveal(),
-// 'catalogName' => 'nova',
-// 'catalogType' => 'compute',
-// 'region' => 'RegionOne',
-// ];
-//
-// $service = $this->builder->createService('Compute', 2, $this->opts);
-// $this->assertInstanceOf(ComputeV2::class, $service);
-// }
-
- private function setupHttpClient()
- {
- $this->rootFixturesDir = dirname(dirname(__DIR__)) . '/Identity/v3/';
-
- $response = $this->getFixture('token-get');
-
- $expectedJson = [
- 'auth' => [
- 'identity' => [
- 'methods' => ['password'],
- 'password' => ['user' => ['id' => '0ca8f6', 'password' => 'secretsecret']]
- ]
- ]
- ];
-
- $httpClient = $this->prophesize(ClientInterface::class);
- $httpClient->request('POST', 'tokens', ['json' => $expectedJson])->shouldBeCalled()->willReturn($response);
-
- return $httpClient;
- }
-
- public function it_builds_services_with_default_identity()
- {
- $httpClient = $this->setupHttpClient();
-
- $options = [
- 'httpClient' => $httpClient->reveal(),
- 'catalogName' => 'nova',
- 'catalogType' => 'compute',
- 'region' => 'RegionOne',
- 'user' => [
- 'id' => '0ca8f6',
- 'password' => 'secretsecret',
- ]
- ];
-
- $service = $this->builder->createService('Compute', 2, $options);
- $this->assertInstanceOf(ComputeV2::class, $service);
- }
-
-// public function test_it_does_not_authenticate_when_creating_identity_services()
-// {
-// $this->assertInstanceOf(IdentityV3::class, $this->builder->createService('Identity', 3, [
-// 'authUrl' => 'foo.com',
-// ]));
-// }
-} \ No newline at end of file
diff --git a/server/vendor/php-opencloud/common/tests/unit/Common/Transport/HandlerStackTest.php b/server/vendor/php-opencloud/common/tests/unit/Common/Transport/HandlerStackTest.php
deleted file mode 100644
index ec1cf85..0000000
--- a/server/vendor/php-opencloud/common/tests/unit/Common/Transport/HandlerStackTest.php
+++ /dev/null
@@ -1,15 +0,0 @@
-<?php
-
-namespace OpenCloud\Test\Common\Transport;
-
-use GuzzleHttp\Handler\MockHandler;
-use OpenCloud\Common\Transport\HandlerStack;
-use OpenCloud\Test\TestCase;
-
-class HandlerStackTest extends TestCase
-{
- public function test_it_is_created()
- {
- $this->assertInstanceOf(HandlerStack::class, HandlerStack::create(new MockHandler()));
- }
-}
diff --git a/server/vendor/php-opencloud/common/tests/unit/Common/Transport/JsonSerializerTest.php b/server/vendor/php-opencloud/common/tests/unit/Common/Transport/JsonSerializerTest.php
deleted file mode 100644
index 5e21833..0000000
--- a/server/vendor/php-opencloud/common/tests/unit/Common/Transport/JsonSerializerTest.php
+++ /dev/null
@@ -1,85 +0,0 @@
-<?php
-
-namespace OpenCloud\Test\Common\Transport;
-
-use OpenCloud\Common\Api\Parameter;
-use OpenCloud\Common\Transport\JsonSerializer;
-
-class JsonSerializerTest extends \PHPUnit_Framework_TestCase
-{
- private $serializer;
-
- public function setUp()
- {
- $this->serializer = new JsonSerializer();
- }
-
- public function test_it_embeds_params_according_to_path()
- {
- $param = $this->prophesize(Parameter::class);
- $param->isArray()->shouldBeCalled()->willReturn(false);
- $param->isObject()->shouldBeCalled()->willReturn(false);
- $param->getName()->shouldBeCalled()->willReturn('username');
- $param->getPath()->shouldBeCalled()->willReturn('auth.passwordCredentials');
-
- $userValue = 'fooBar';
-
- $expected = [
- 'auth' => [
- 'passwordCredentials' => [
- 'username' => $userValue,
- ],
- ],
- ];
-
- $actual = $this->serializer->stockJson($param->reveal(), $userValue, []);
-
- $this->assertEquals($expected, $actual);
- }
-
- public function test_it_serializes_arrays()
- {
- $param = $this->prophesize(Parameter::class);
- $param->isArray()->shouldBeCalled()->willReturn(true);
- $param->getName()->shouldBeCalled()->willReturn('fooBar');
- $param->getPath()->shouldBeCalled()->willReturn(false);
-
- $itemSchema = $this->prophesize(Parameter::class);
- $itemSchema->isArray()->shouldBeCalled()->willReturn(false);
- $itemSchema->isObject()->shouldBeCalled()->willReturn(false);
- $itemSchema->getName()->shouldBeCalled()->willReturn('');
- $itemSchema->getPath()->shouldBeCalled()->willReturn('');
-
- $param->getItemSchema()->shouldBeCalled()->willReturn($itemSchema);
-
- $userValues = ['1', '2', '3'];
-
- $expected = ['fooBar' => $userValues];
-
- $actual = $this->serializer->stockJson($param->reveal(), $userValues, []);
-
- $this->assertEquals($expected, $actual);
- }
-
- public function test_it_serializes_objects()
- {
- $prop = $this->prophesize(Parameter::class);
- $prop->isArray()->shouldBeCalled()->willReturn(false);
- $prop->isObject()->shouldBeCalled()->willReturn(false);
- $prop->getName()->shouldBeCalled()->willReturn('foo');
- $prop->getPath()->shouldBeCalled()->willReturn('');
-
- $param = $this->prophesize(Parameter::class);
- $param->isArray()->shouldBeCalled()->willReturn(false);
- $param->isObject()->shouldBeCalled()->willReturn(true);
- $param->getName()->shouldBeCalled()->willReturn('topLevel');
- $param->getPath()->shouldBeCalled()->willReturn(false);
- $param->getProperty('foo')->shouldBeCalled()->willReturn($prop);
-
- $expected = ['topLevel' => ['foo' => true]];
-
- $json = $this->serializer->stockJson($param->reveal(), (object) ['foo' => true], []);
-
- $this->assertEquals($expected, $json);
- }
-}
diff --git a/server/vendor/php-opencloud/common/tests/unit/Common/Transport/MiddlewareTest.php b/server/vendor/php-opencloud/common/tests/unit/Common/Transport/MiddlewareTest.php
deleted file mode 100644
index c445783..0000000
--- a/server/vendor/php-opencloud/common/tests/unit/Common/Transport/MiddlewareTest.php
+++ /dev/null
@@ -1,59 +0,0 @@
-<?php
-
-namespace unit\Common\Transport;
-
-use GuzzleHttp\Handler\MockHandler;
-use GuzzleHttp\Psr7\Request;
-use GuzzleHttp\Psr7\Response;
-use OpenCloud\Common\Transport\Middleware;
-use OpenCloud\Test\TestCase;
-use OpenCloud\Common\Auth\AuthHandler;
-
-class MiddlewareTest extends TestCase
-{
- /**
- * @expectedException \OpenCloud\Common\Error\BadResponseError
- */
- public function test_exception_is_thrown_for_4xx_statuses()
- {
- $middleware = Middleware::httpErrors();
-
- $handler = new MockHandler([new Response(404)]);
- $fn = $middleware($handler);
-
- $promise = $fn(new Request('GET', 'http://foo.com'), []);
- $this->assertEquals('pending', $promise->getState());
-
- $promise->wait();
- $this->assertEquals('rejected', $promise->getState());
- }
-
- public function test_responses_are_left_alone_when_status_under_400()
- {
- $middleware = Middleware::httpErrors();
-
- $response = new Response(204);
- $handler = new MockHandler([$response]);
- $fn = $middleware($handler);
-
- $promise = $fn(new Request('GET', 'http://foo.com'), []);
-
- $promise->then(function ($val) use ($response) {
- $this->assertEquals($val, $response);
- });
-
- $promise->wait();
- }
-
- public function test_auth_handler_is_returned()
- {
- $generator = function () {};
-
- $middleware = Middleware::authHandler($generator);
-
- $handler = new MockHandler([new Response(204)]);
- $fn = $middleware($handler);
-
- $this->assertInstanceOf(AuthHandler::class, $fn);
- }
-}
diff --git a/server/vendor/php-opencloud/common/tests/unit/Common/Transport/RequestSerializerTest.php b/server/vendor/php-opencloud/common/tests/unit/Common/Transport/RequestSerializerTest.php
deleted file mode 100644
index cf06220..0000000
--- a/server/vendor/php-opencloud/common/tests/unit/Common/Transport/RequestSerializerTest.php
+++ /dev/null
@@ -1,112 +0,0 @@
-<?php
-
-namespace OpenCloud\Test\Common\Transport;
-
-use OpenCloud\Common\Api\Operation;
-use OpenCloud\Common\Api\Parameter;
-use OpenCloud\Common\Transport\JsonSerializer;
-use OpenCloud\Common\Transport\RequestSerializer;
-use OpenCloud\Test\TestCase;
-
-class RequestSerializerTest extends TestCase
-{
- private $rs;
- private $js;
-
- public function setUp()
- {
- $this->js = $this->prophesize(JsonSerializer::class);
-
- $this->rs = new RequestSerializer($this->js->reveal());
- }
-
- public function test_it_ignores_undefined_params()
- {
- $op = $this->prophesize(Operation::class);
- $op->getParam('foo')->shouldBeCalled()->willReturn(null);
-
- $this->assertEquals(['headers' => []], $this->rs->serializeOptions($op->reveal(), ['foo' => 'bar']));
- }
-
- public function test_it_serializes_queries()
- {
- $sch = $this->prophesize(Parameter::class);
- $sch->getName()->shouldBeCalled()->willReturn('fooAlias');
- $sch->getLocation()->shouldBeCalled()->willReturn('query');
-
- $op = $this->prophesize(Operation::class);
- $op->getParam('foo')->shouldBeCalled()->willReturn($sch);
-
- $actual = $this->rs->serializeOptions($op->reveal(), ['foo' => 'bar']);
- $expected = ['query' => ['fooAlias' => 'bar'], 'headers' => []];
-
- $this->assertEquals($expected, $actual);
- }
-
- public function test_it_serializes_headers()
- {
- $sch = $this->prophesize(Parameter::class);
- $sch->getLocation()->shouldBeCalled()->willReturn('header');
- $sch->getName()->shouldBeCalled()->willReturn('fooAlias');
- $sch->getPrefixedName()->shouldBeCalled()->willReturn('prefix-fooAlias');
-
- $op = $this->prophesize(Operation::class);
- $op->getParam('foo')->shouldBeCalled()->willReturn($sch);
-
- $actual = $this->rs->serializeOptions($op->reveal(), ['foo' => 'bar']);
- $expected = ['headers' => ['prefix-fooAlias' => 'bar']];
-
- $this->assertEquals($expected, $actual);
- }
-
- public function test_it_serializes_metadata_headers()
- {
- $itemSch = $this->prophesize(Parameter::class);
- $itemSch->getName()->shouldBeCalled()->willReturn('foo');
- $itemSch->getPrefixedName()->shouldBeCalled()->willReturn('prefix-foo');
-
- $sch = $this->prophesize(Parameter::class);
- $sch->getItemSchema()->shouldBeCalled()->willReturn($itemSch);
- $sch->getLocation()->shouldBeCalled()->willReturn('header');
- $sch->getName()->shouldBeCalled()->willReturn('metadata');
-
- $op = $this->prophesize(Operation::class);
- $op->getParam('metadata')->shouldBeCalled()->willReturn($sch);
-
- $actual = $this->rs->serializeOptions($op->reveal(), ['metadata' => ['foo' => 'bar']]);
- $expected = ['headers' => ['prefix-foo' => 'bar']];
-
- $this->assertEquals($expected, $actual);
- }
-
- public function test_it_serializes_json()
- {
- $sch = $this->prophesize(Parameter::class);
- $sch->getLocation()->shouldBeCalled()->willReturn('json');
-
- $op = $this->prophesize(Operation::class);
- $op->getParam('foo')->shouldBeCalled()->willReturn($sch);
- $op->getJsonKey()->shouldBeCalled()->willReturn('jsonKey');
-
- $this->js->stockJson($sch, 'bar', [])->shouldBeCalled()->willReturn(['foo' => 'bar']);
-
- $actual = $this->rs->serializeOptions($op->reveal(), ['foo' => 'bar']);
- $expected = ['json' => ['jsonKey' => ['foo' => 'bar']], 'headers' => []];
-
- $this->assertEquals($expected, $actual);
- }
-
- public function test_it_serializes_raw_vals()
- {
- $sch = $this->prophesize(Parameter::class);
- $sch->getLocation()->shouldBeCalled()->willReturn('raw');
-
- $op = $this->prophesize(Operation::class);
- $op->getParam('foo')->shouldBeCalled()->willReturn($sch);
-
- $actual = $this->rs->serializeOptions($op->reveal(), ['foo' => 'bar']);
- $expected = ['body' => 'bar', 'headers' => []];
-
- $this->assertEquals($expected, $actual);
- }
-}
diff --git a/server/vendor/php-opencloud/common/tests/unit/Common/Transport/UtilsTest.php b/server/vendor/php-opencloud/common/tests/unit/Common/Transport/UtilsTest.php
deleted file mode 100644
index 3103ad4..0000000
--- a/server/vendor/php-opencloud/common/tests/unit/Common/Transport/UtilsTest.php
+++ /dev/null
@@ -1,30 +0,0 @@
-<?php
-
-namespace OpenCloud\Test\Common\Transport;
-
-use GuzzleHttp\Psr7\Response;
-use function GuzzleHttp\Psr7\uri_for;
-use GuzzleHttp\Psr7\Uri;
-use OpenCloud\Common\Transport\Utils;
-use OpenCloud\Test\TestCase;
-
-class UtilsTest extends TestCase
-{
- /**
- * @expectedException \InvalidArgumentException
- */
- public function test_decoding_malformed_json_throws_error()
- {
- $response = new Response(200, [], \GuzzleHttp\Psr7\stream_for('{'));
-
- Utils::jsonDecode($response);
- }
-
- public function test_it_adds_paths()
- {
- $uri = Utils::addPaths(uri_for('http://openstack.org/foo'), 'bar', 'baz', '1', '2');
-
- $this->assertInstanceOf(Uri::class, $uri);
- $this->assertEquals(uri_for('http://openstack.org/foo/bar/baz/1/2'), $uri);
- }
-}
diff --git a/server/vendor/php-opencloud/common/tests/unit/Fixtures/ComputeV2Api.php b/server/vendor/php-opencloud/common/tests/unit/Fixtures/ComputeV2Api.php
deleted file mode 100644
index 8c6858d..0000000
--- a/server/vendor/php-opencloud/common/tests/unit/Fixtures/ComputeV2Api.php
+++ /dev/null
@@ -1,117 +0,0 @@
-<?php
-
-namespace OpenCloud\Test\Fixtures;
-
-use OpenCloud\Common\Api\ApiInterface;
-
-class ComputeV2Api implements ApiInterface
-{
- private $idParam = ['type' => 'string', 'required' => true, 'location' => 'url'];
-
- public function getImage()
- {
- return [
- 'method' => 'GET',
- 'path' => 'images/{id}',
- 'params' => [self::$idParam]
- ];
- }
-
- public function postServer()
- {
- return [
- 'path' => 'servers',
- 'method' => 'POST',
- 'jsonKey' => 'server',
- 'params' => [
- 'removeMetadata' => [
- 'type' => 'object',
- 'properties' => ['type' => 'string'],
- ],
- 'securityGroups' => [
- 'type' => 'array',
- 'items' => [
- 'type' => 'object',
- 'properties' => [
- 'name' => ['type' => 'string']
- ]
- ],
- 'sentAs' => 'security_groups',
- ],
- 'userData' => ['type' => 'string', 'sentAs' => 'user_data'],
- 'availabilityZone' => ['type' => 'string', 'sentAs' => 'availability_zone'],
- 'imageId' => ['type' => 'string', 'required' => true, 'sentAs' => 'imageRef'],
- 'flavorId' => ['type' => 'string', 'required' => true, 'sentAs' => 'flavorRef'],
- 'networks' => [
- 'type' => 'array',
- 'items' => [
- 'type' => 'object',
- 'properties' => [
- 'uuid' => ['type' => 'string'],
- 'port' => ['type' => 'string'],
- ]
- ]
- ],
- 'name' => ['type' => 'string', 'required' => true],
- 'metadata' => [
- 'type' => 'object',
- 'location' => 'json',
- 'description' => 'An arbitrary key/value pairing that will be used for metadata.',
- 'properties' => [
- 'type' => 'string',
- 'description' => <<<TYPEOTHER
-The value being set for your key. Bear in mind that "key" is just an example, you can name it anything.
-TYPEOTHER
- ]
- ],
- 'personality' => ['type' => 'string'],
- 'blockDeviceMapping' => [
- 'type' => 'array',
- 'sentAs' => 'block_device_mapping_v2',
- 'items' => [
- 'type' => 'object',
- 'properties' => [
- 'configDrive' => ['type' => 'string', 'sentAs' => 'config_drive'],
- 'bootIndex' => ['type' => 'string', 'sentAs' => 'boot_index'],
- 'deleteOnTermination' => ['type' => 'boolean', 'sentAs' => 'delete_on_termination'],
- 'guestFormat' => ['type' => 'string', 'sentAs' => 'guest_format'],
- 'destinationType' => ['type' => 'string', 'sentAs' => 'destination_type'],
- 'sourceType' => ['type' => 'string', 'sentAs' => 'source_type'],
- 'deviceName' => ['type' => 'string', 'sentAs' => 'device_name'],
- ]
- ],
- ],
- ]
- ];
- }
-
- public function test()
- {
- return [
- 'method' => 'GET',
- 'path' => 'foo',
- 'params' => [
- 'id' => ['type' => 'string', 'location' => 'json'],
- 'bar' => ['type' => 'string', 'location' => 'json'],
- ]
- ];
- }
-
- public function getServers()
- {
- return [
- 'method' => 'GET',
- 'path' => 'servers',
- 'params' => [
- 'changesSince' => ['sentAs' => 'changes-since', 'type' => 'string', 'location' => 'query'],
- 'imageId' => ['sentAs' => 'image', 'type' => 'string', 'location' => 'query'],
- 'flavorId' => ['sentAs' => 'flavor', 'type' => 'string', 'location' => 'query'],
- 'name' => ['type' => 'string', 'location' => 'query'],
- 'marker' => ['type' => 'string', 'location' => 'query'],
- 'limit' => ['type' => 'integer', 'location' => 'query'],
- 'status' => ['type' => 'string', 'location' => 'query'],
- 'host' => ['type' => 'string', 'location' => 'query']
- ],
- ];
- }
-}
diff --git a/server/vendor/php-opencloud/common/tests/unit/Fixtures/IdentityV2Api.php b/server/vendor/php-opencloud/common/tests/unit/Fixtures/IdentityV2Api.php
deleted file mode 100644
index 4cc66b5..0000000
--- a/server/vendor/php-opencloud/common/tests/unit/Fixtures/IdentityV2Api.php
+++ /dev/null
@@ -1,36 +0,0 @@
-<?php
-
-namespace OpenCloud\Test\Fixtures;
-
-use OpenCloud\Common\Api\ApiInterface;
-
-class IdentityV2Api implements ApiInterface
-{
- public function postToken()
- {
- return [
- 'method' => 'POST',
- 'path' => 'tokens',
- 'params' => [
- 'username' => [
- 'type' => 'string',
- 'required' => true,
- 'path' => 'auth.passwordCredentials'
- ],
- 'password' => [
- 'type' => 'string',
- 'required' => true,
- 'path' => 'auth.passwordCredentials'
- ],
- 'tenantId' => [
- 'type' => 'string',
- 'path' => 'auth',
- ],
- 'tenantName' => [
- 'type' => 'string',
- 'path' => 'auth',
- ]
- ],
- ];
- }
-}
diff --git a/server/vendor/php-opencloud/common/tests/unit/Fixtures/IdentityV3Api.php b/server/vendor/php-opencloud/common/tests/unit/Fixtures/IdentityV3Api.php
deleted file mode 100644
index 2fc922f..0000000
--- a/server/vendor/php-opencloud/common/tests/unit/Fixtures/IdentityV3Api.php
+++ /dev/null
@@ -1,75 +0,0 @@
-<?php
-
-namespace OpenCloud\Test\Fixtures;
-
-class IdentityV3Api
-{
- private function domainParam()
- {
- return [
- 'type' => 'object',
- 'params' => [
- 'id' => ['type' => 'string'],
- 'name' => ['type' => 'string']
- ]
- ];
- }
-
- private function projectParam()
- {
- return [
- 'type' => 'object',
- 'params' => [
- 'id' => ['type' => 'string'],
- 'name' => ['type' => 'string'],
- 'domain' => $this->domainParam(),
- ]
- ];
- }
-
- public function postTokens()
- {
- return [
- 'method' => 'POST',
- 'path' => 'tokens',
- 'params' => [
- 'methods' => [
- 'type' => 'array',
- 'path' => 'auth.identity',
- 'items' => [
- 'type' => 'string'
- ]
- ],
- 'user' => [
- 'path' => 'auth.identity.password',
- 'type' => 'object',
- 'properties' => [
- 'id' => [
- 'type' => 'string',
- ],
- 'name' => [
- 'type' => 'string',
- ],
- 'password' => [
- 'type' => 'string',
- ],
- 'domain' => $this->domainParam()
- ]
- ],
- 'tokenId' => [
- 'type' => 'string',
- 'path' => 'auth.identity.token',
- 'sentAs' => 'id',
- ],
- 'scope' => [
- 'type' => 'object',
- 'path' => 'auth',
- 'properties' => [
- 'project' => $this->projectParam(),
- 'domain' => $this->domainParam()
- ]
- ]
- ]
- ];
- }
-}
diff --git a/server/vendor/php-opencloud/common/tests/unit/TestCase.php b/server/vendor/php-opencloud/common/tests/unit/TestCase.php
deleted file mode 100644
index 610d88a..0000000
--- a/server/vendor/php-opencloud/common/tests/unit/TestCase.php
+++ /dev/null
@@ -1,99 +0,0 @@
-<?php
-
-namespace OpenCloud\Test;
-
-use function GuzzleHttp\Psr7\stream_for;
-use function GuzzleHttp\Psr7\parse_response;
-use GuzzleHttp\ClientInterface;
-use GuzzleHttp\Psr7\Response;
-use Prophecy\Argument;
-
-abstract class TestCase extends \PHPUnit_Framework_TestCase
-{
- /** @var \Prophecy\Prophecy\ObjectProphecy */
- protected $client;
-
- /** @var string */
- protected $rootFixturesDir;
-
- protected $api;
-
- protected function setUp()
- {
- $this->client = $this->prophesize(ClientInterface::class);
- }
-
- protected function createResponse($status, array $headers, array $json)
- {
- return new Response($status, $headers, stream_for(json_encode($json)));
- }
-
- protected function getFixture($file)
- {
- if (!$this->rootFixturesDir) {
- throw new \RuntimeException('Root fixtures dir not set');
- }
-
- $path = $this->rootFixturesDir . '/Fixtures/' . $file . '.resp';
-
- if (!file_exists($path)) {
- throw new \RuntimeException(sprintf("%s does not exist", $path));
- }
-
- return parse_response(file_get_contents($path));
- }
-
- protected function setupMock($method, $path, $body = null, array $headers = [], $response)
- {
- $options = ['headers' => $headers];
-
- if (!empty($body)) {
- $options[is_array($body) ? 'json' : 'body'] = $body;
- }
-
- if (is_string($response)) {
- $response = $this->getFixture($response);
- }
-
- $this->client
- ->request($method, $path, $options)
- ->shouldBeCalled()
- ->willReturn($response);
- }
-
- protected function createFn($receiver, $method, $args)
- {
- return function () use ($receiver, $method, $args) {
- return $receiver->$method($args);
- };
- }
-
- protected function listTest(callable $call, $urlPath, $modelName = null, $responseFile = null)
- {
- $modelName = $modelName ?: $urlPath;
- $responseFile = $responseFile ?: $urlPath;
-
- $this->setupMock('GET', $urlPath, null, [], $responseFile);
-
- $resources = call_user_func($call);
-
- $this->assertInstanceOf('\Generator', $resources);
-
- $count = 0;
-
- foreach ($resources as $resource) {
- $this->assertInstanceOf('OpenStack\Identity\v3\Models\\' . ucfirst($modelName), $resource);
- ++$count;
- }
-
- $this->assertEquals(2, $count);
- }
-
- protected function getTest(callable $call, $modelName)
- {
- $resource = call_user_func($call);
-
- $this->assertInstanceOf('OpenStack\Identity\v3\Models\\' . ucfirst($modelName), $resource);
- $this->assertEquals('id', $resource->id);
- }
-}
diff --git a/server/vendor/php-opencloud/openstack b/server/vendor/php-opencloud/openstack
deleted file mode 160000
-Subproject 61626420361a1dab3ed6f9455e1057bda18cc33