Test
This commit is contained in:
commit
53f65de9d4
88 changed files with 3596 additions and 694 deletions
|
@ -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, []);
|
||||
}
|
||||
|
|
|
@ -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
|
||||
{}
|
||||
}
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue