summaryrefslogtreecommitdiff
path: root/server/vendor/php-opencloud/common/tests
diff options
context:
space:
mode:
Diffstat (limited to 'server/vendor/php-opencloud/common/tests')
-rw-r--r--server/vendor/php-opencloud/common/tests/integration/DefaultLogger.php2
-rw-r--r--server/vendor/php-opencloud/common/tests/integration/Runner.php12
-rw-r--r--server/vendor/php-opencloud/common/tests/integration/SampleManagerInterface.php2
-rw-r--r--server/vendor/php-opencloud/common/tests/integration/TestCase.php2
-rw-r--r--server/vendor/php-opencloud/common/tests/integration/TestInterface.php2
-rw-r--r--server/vendor/php-opencloud/common/tests/integration/Utils.php48
-rw-r--r--server/vendor/php-opencloud/common/tests/integration/run.php10
-rw-r--r--server/vendor/php-opencloud/common/tests/unit/Common/Api/OperatorTest.php3
-rw-r--r--server/vendor/php-opencloud/common/tests/unit/Common/Auth/AuthHandlerTest.php10
-rw-r--r--server/vendor/php-opencloud/common/tests/unit/Common/JsonSchema/SchemaTest.php4
-rw-r--r--server/vendor/php-opencloud/common/tests/unit/Common/Transport/JsonSerializerTest.php8
-rw-r--r--server/vendor/php-opencloud/common/tests/unit/Fixtures/ComputeV2Api.php12
12 files changed, 37 insertions, 78 deletions
diff --git a/server/vendor/php-opencloud/common/tests/integration/DefaultLogger.php b/server/vendor/php-opencloud/common/tests/integration/DefaultLogger.php
index a546c70..d367600 100644
--- a/server/vendor/php-opencloud/common/tests/integration/DefaultLogger.php
+++ b/server/vendor/php-opencloud/common/tests/integration/DefaultLogger.php
@@ -1,6 +1,6 @@
<?php
-namespace OpenCloud\integration;
+namespace OpenCloud\Integration;
use Psr\Log\AbstractLogger;
diff --git a/server/vendor/php-opencloud/common/tests/integration/Runner.php b/server/vendor/php-opencloud/common/tests/integration/Runner.php
index 98d094c..b1003a2 100644
--- a/server/vendor/php-opencloud/common/tests/integration/Runner.php
+++ b/server/vendor/php-opencloud/common/tests/integration/Runner.php
@@ -1,16 +1,19 @@
<?php
-namespace OpenCloud\integration;
+namespace OpenCloud\Integration;
class Runner
{
private $basePath;
private $logger;
private $services = [];
+ private $namespace;
- public function __construct($basePath)
+ public function __construct($basePath, $testNamespace)
{
$this->basePath = $basePath;
+ $this->namespace = $testNamespace;
+
$this->logger = new DefaultLogger();
$this->assembleServicesFromSamples();
}
@@ -73,15 +76,14 @@ class Runner
*/
private function getTest($serviceName, $version, $verbosity)
{
- $namespace = (new \ReflectionClass($this))->getNamespaceName();
- $className = sprintf("%s\\%s\\%sTest", $namespace, Utils::toCamelCase($serviceName), ucfirst($version));
+ $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", $namespace);
+ $smClass = sprintf("%s\\SampleManager", $this->namespace);
$class = new $className($this->logger, new $smClass($basePath, $verbosity));
if (!($class instanceof TestInterface)) {
diff --git a/server/vendor/php-opencloud/common/tests/integration/SampleManagerInterface.php b/server/vendor/php-opencloud/common/tests/integration/SampleManagerInterface.php
index f0fe848..c4293ba 100644
--- a/server/vendor/php-opencloud/common/tests/integration/SampleManagerInterface.php
+++ b/server/vendor/php-opencloud/common/tests/integration/SampleManagerInterface.php
@@ -1,6 +1,6 @@
<?php
-namespace OpenCloud\integration;
+namespace OpenCloud\Integration;
interface SampleManagerInterface
{
diff --git a/server/vendor/php-opencloud/common/tests/integration/TestCase.php b/server/vendor/php-opencloud/common/tests/integration/TestCase.php
index 687760a..cb81381 100644
--- a/server/vendor/php-opencloud/common/tests/integration/TestCase.php
+++ b/server/vendor/php-opencloud/common/tests/integration/TestCase.php
@@ -1,6 +1,6 @@
<?php
-namespace OpenCloud\integration;
+namespace OpenCloud\Integration;
use Psr\Log\LoggerInterface;
diff --git a/server/vendor/php-opencloud/common/tests/integration/TestInterface.php b/server/vendor/php-opencloud/common/tests/integration/TestInterface.php
index a89e8af..418b407 100644
--- a/server/vendor/php-opencloud/common/tests/integration/TestInterface.php
+++ b/server/vendor/php-opencloud/common/tests/integration/TestInterface.php
@@ -1,6 +1,6 @@
<?php
-namespace OpenCloud\integration;
+namespace OpenCloud\Integration;
use Psr\Log\LoggerInterface;
diff --git a/server/vendor/php-opencloud/common/tests/integration/Utils.php b/server/vendor/php-opencloud/common/tests/integration/Utils.php
index daa1426..d24c1bb 100644
--- a/server/vendor/php-opencloud/common/tests/integration/Utils.php
+++ b/server/vendor/php-opencloud/common/tests/integration/Utils.php
@@ -1,57 +1,11 @@
<?php
-namespace OpenCloud\integration;
+namespace OpenCloud\Integration;
use GuzzleHttp\Client;
-use OpenCloud\Identity\v2\Api;
-use OpenCloud\Identity\v2\Service;
-use OpenCloud\Common\Transport\HandlerStack;
-use OpenCloud\Common\Transport\Utils as CommonUtils;
class Utils
{
- public static function getAuthOptsV3()
- {
- return [
- 'authUrl' => getenv('OS_AUTH_URL'),
- 'region' => getenv('OS_REGION_NAME'),
- 'user' => [
- 'id' => getenv('OS_USER_ID'),
- 'password' => getenv('OS_PASSWORD'),
- ],
- 'scope' => [
- 'project' => [
- 'id' => getenv('OS_PROJECT_ID'),
- ]
- ]
- ];
- }
-
- public static function getAuthOptsV2()
- {
- $httpClient = new Client([
- 'base_uri' => CommonUtils::normalizeUrl(getenv('OS_AUTH_URL')),
- 'handler' => HandlerStack::create(),
- ]);
- return [
- 'authUrl' => getenv('OS_AUTH_URL'),
- 'region' => getenv('OS_REGION_NAME'),
- 'username' => getenv('OS_USERNAME'),
- 'password' => getenv('OS_PASSWORD'),
- 'tenantName' => getenv('OS_TENANT_NAME'),
- 'identityService' => new Service($httpClient, new Api),
- ];
- }
-
- public static function getAuthOpts(array $options = [])
- {
- $authOptions = getenv('OS_IDENTITY_API_VERSION') == '2.0'
- ? self::getAuthOptsV2()
- : self::getAuthOptsV3();
-
- return array_merge($authOptions, $options);
- }
-
public static function toCamelCase($word, $separator = '_')
{
return str_replace($separator, '', ucwords($word, $separator));
diff --git a/server/vendor/php-opencloud/common/tests/integration/run.php b/server/vendor/php-opencloud/common/tests/integration/run.php
deleted file mode 100644
index 5bc5548..0000000
--- a/server/vendor/php-opencloud/common/tests/integration/run.php
+++ /dev/null
@@ -1,10 +0,0 @@
-<?php
-
-$rootDir = dirname(dirname(__DIR__));
-
-require_once $rootDir . '/vendor/autoload.php';
-
-$basePath = $rootDir . '/samples';
-
-$runner = new \OpenCloud\Integration\Runner($basePath);
-$runner->runServices();
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
index 43c5804..e22c25e 100644
--- a/server/vendor/php-opencloud/common/tests/unit/Common/Api/OperatorTest.php
+++ b/server/vendor/php-opencloud/common/tests/unit/Common/Api/OperatorTest.php
@@ -10,7 +10,6 @@ use GuzzleHttp\Psr7\Uri;
use OpenCloud\Common\Api\Operator;
use OpenCloud\Common\Resource\AbstractResource;
use OpenCloud\Common\Resource\ResourceInterface;
-use OpenCloud\Compute\v2\Models\Server;
use OpenCloud\Test\Fixtures\ComputeV2Api;
use OpenCloud\Test\TestCase;
use Prophecy\Argument;
@@ -45,7 +44,7 @@ class OperatorTest extends TestCase
public function test_it_sends_a_request_when_operations_are_executed()
{
- $this->client->request('GET', 'test', ['headers' => []])->willReturn(new Request('GET', 'test'));
+ $this->client->request('GET', 'test', ['headers' => []])->willReturn(new Response());
$this->operator->execute($this->def, []);
}
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
index 3c77dde..d0d63cf 100644
--- a/server/vendor/php-opencloud/common/tests/unit/Common/Auth/AuthHandlerTest.php
+++ b/server/vendor/php-opencloud/common/tests/unit/Common/Auth/AuthHandlerTest.php
@@ -53,7 +53,11 @@ class AuthHandlerTest extends TestCase
}
}
-class FakeToken implements Token {
- public function getId() {}
- public function hasExpired() {}
+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/JsonSchema/SchemaTest.php b/server/vendor/php-opencloud/common/tests/unit/Common/JsonSchema/SchemaTest.php
index 22663ef..4aae8e5 100644
--- a/server/vendor/php-opencloud/common/tests/unit/Common/JsonSchema/SchemaTest.php
+++ b/server/vendor/php-opencloud/common/tests/unit/Common/JsonSchema/SchemaTest.php
@@ -95,8 +95,8 @@ class SchemaTest extends TestCase
public function test_it_checks_validity()
{
- $this->validator->isValid()->shouldBeCalled();
+ $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/Transport/JsonSerializerTest.php b/server/vendor/php-opencloud/common/tests/unit/Common/Transport/JsonSerializerTest.php
index 9075594..5e21833 100644
--- a/server/vendor/php-opencloud/common/tests/unit/Common/Transport/JsonSerializerTest.php
+++ b/server/vendor/php-opencloud/common/tests/unit/Common/Transport/JsonSerializerTest.php
@@ -47,8 +47,8 @@ class JsonSerializerTest extends \PHPUnit_Framework_TestCase
$itemSchema = $this->prophesize(Parameter::class);
$itemSchema->isArray()->shouldBeCalled()->willReturn(false);
$itemSchema->isObject()->shouldBeCalled()->willReturn(false);
- $itemSchema->getName()->shouldBeCalled()->willReturn(null);
- $itemSchema->getPath()->shouldBeCalled()->willReturn(null);
+ $itemSchema->getName()->shouldBeCalled()->willReturn('');
+ $itemSchema->getPath()->shouldBeCalled()->willReturn('');
$param->getItemSchema()->shouldBeCalled()->willReturn($itemSchema);
@@ -67,7 +67,7 @@ class JsonSerializerTest extends \PHPUnit_Framework_TestCase
$prop->isArray()->shouldBeCalled()->willReturn(false);
$prop->isObject()->shouldBeCalled()->willReturn(false);
$prop->getName()->shouldBeCalled()->willReturn('foo');
- $prop->getPath()->shouldBeCalled()->willReturn(null);
+ $prop->getPath()->shouldBeCalled()->willReturn('');
$param = $this->prophesize(Parameter::class);
$param->isArray()->shouldBeCalled()->willReturn(false);
@@ -78,7 +78,7 @@ class JsonSerializerTest extends \PHPUnit_Framework_TestCase
$expected = ['topLevel' => ['foo' => true]];
- $json = $this->serializer->stockJson($param->reveal(), ['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/Fixtures/ComputeV2Api.php b/server/vendor/php-opencloud/common/tests/unit/Fixtures/ComputeV2Api.php
index d395d10..8c6858d 100644
--- a/server/vendor/php-opencloud/common/tests/unit/Fixtures/ComputeV2Api.php
+++ b/server/vendor/php-opencloud/common/tests/unit/Fixtures/ComputeV2Api.php
@@ -53,7 +53,17 @@ class ComputeV2Api implements ApiInterface
]
],
'name' => ['type' => 'string', 'required' => true],
- 'metadata' => ['type' => 'object', 'location' => 'json'],
+ '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',