Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ before_script:
after_script:
- php vendor/bin/coveralls -v

after_success:
- travis_retry php vendor/bin/php-coveralls -v

notifications:
email:
- jamie.hannaford@rackspace.com
31 changes: 17 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# PHP OpenStack SDK

[![Build Status](https://travis-ci.org/php-opencloud/openstack.svg?branch=master)](https://travis-ci.org/php-opencloud/openstack)
[![Code Coverage](https://scrutinizer-ci.com/g/php-opencloud/openstack/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/php-opencloud/openstack/?branch=master)
[![Coverage Status](https://coveralls.io/repos/github/php-opencloud/openstack/badge.svg?branch=master)](https://coveralls.io/github/php-opencloud/openstack?branch=master)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/php-opencloud/openstack/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/php-opencloud/openstack/?branch=master)

`php-opencloud/openstack` is an SDK which allows PHP developers to easily connect to OpenStack APIs in a simple and
Expand All @@ -15,28 +15,31 @@ OpenStack services, and versions of services, are supported.
* [Contributing guide](/CONTRIBUTING.md)
* [Code of Conduct](/CODE_OF_CONDUCT.md)

## Backward incompatibility
## Getting help

- Meet us on Slack: https://phpopencloud.slack.com ([Get your invitation](https://launchpass.com/phpopencloud))
- Report an issue: https://github.com/php-opencloud/openstack/issues

Due to new [object typehint](https://wiki.php.net/rfc/object-typehint) since PHP 7.2, `Object` is a reserved keyword
thus class `OpenStack\ObjectStore\v1\Models\Object` had to be renamed to
`OpenStack\ObjectStore\v1\Models\StorageObject`. See [#184](https://github.com/php-opencloud/openstack/pull/184) for
details.

### Version Guidance
## Version Guidance

| Version | Status | PHP Version | Life span |
| Version | Status | PHP Version | End of life |
| --------- | --------------------------- | ------------- | ----------------------- |
| `^2.0` | Maintained (Bug fixes only) | `>=7.0,<7.2` | March 2016 - March 2018 |
| `^3.0` | Latest | `>=7.0` | March 2018 - March 2020 |
| `^3.0` | Latest | `>=7.0` | March 2020 |
| `^2.0` | Maintained (Bug fixes only) | `>=7.0,<7.2` | March 2018 |

## Getting help

- Meet us on Slack: https://phpopencloud.slack.com ([Get your invitation](https://launchpass.com/phpopencloud))
- Report and issue: https://github.com/php-opencloud/openstack/issues
## Upgrade from 2.x to 3.x

Due to new [object typehint](https://wiki.php.net/rfc/object-typehint) since PHP 7.2, `Object` is a reserved keyword
thus class `OpenStack\ObjectStore\v1\Models\Object` had to be renamed to
`OpenStack\ObjectStore\v1\Models\StorageObject`.

This change was introduced in [#184](https://github.com/php-opencloud/openstack/pull/184).

## Requirements

* PHP 7.0
* `ext-curl`

## How to install

Expand Down
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@
"justinrainbow/json-schema": "~5.2"
},
"require-dev": {
"phpunit/phpunit": "~4.0",
"phpunit/phpunit": "^6.5",
"sami/sami": "dev-master",
"psr/log": "~1.0",
"satooshi/php-coveralls": "~1.0",
"jakub-onderka/php-parallel-lint": "0.*",
"psr/log": "^1.0",
"satooshi/php-coveralls": "^2.0",
"jakub-onderka/php-parallel-lint": "^1.0",
"friendsofphp/php-cs-fixer": "^2.9"
}
}
8 changes: 5 additions & 3 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit bootstrap="./vendor/autoload.php" colors="true">

<phpunit bootstrap="./vendor/autoload.php" colors="true" strict="true">
<logging>
<log type="coverage-clover" target="build/logs/clover.xml"/>
</logging>
<testsuites>
<testsuite name="OpenStack">
<directory>tests/unit</directory>
Expand All @@ -18,4 +20,4 @@
</whitelist>
</filter>

</phpunit>
</phpunit>
3 changes: 2 additions & 1 deletion tests/integration/Compute/v2/CoreTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,8 @@ private function attachVolumeToServer()

$this->volume->waitUntil('in-use');

$this->logStep('Attached volume {volumeId} to server {serverId} with volume attachment id {volumeAttachmentId}',
$this->logStep(
'Attached volume {volumeId} to server {serverId} with volume attachment id {volumeAttachmentId}',
array_merge($replacements, ['{volumeAttachmentId}' => $volumeAttachment->id])
);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use OpenStack\Common\Resource\Deletable;
use Psr\Log\LoggerInterface;

abstract class TestCase extends \PHPUnit_Framework_TestCase implements TestInterface
abstract class TestCase extends \PHPUnit\Framework\TestCase implements TestInterface
{
protected $logger;
private $startPoint;
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/Common/Api/OperationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
use OpenStack\Common\Api\Parameter;
use OpenStack\Test\Fixtures\ComputeV2Api;

class OperationTest extends \PHPUnit_Framework_TestCase
class OperationTest extends \PHPUnit\Framework\TestCase
{
private $operation;

Expand Down
6 changes: 6 additions & 0 deletions tests/unit/Common/Api/OperatorTraitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,17 @@ public function test_it_sends_a_request_when_operations_are_executed()
$this->client->request('GET', 'test', ['headers' => []])->willReturn(new Response());

$this->operator->execute($this->def, []);

$this->addToAssertionCount(1);
}

public function test_it_sends_a_request_when_async_operations_are_executed()
{
$this->client->requestAsync('GET', 'test', ['headers' => []])->willReturn(new Promise());

$this->operator->executeAsync($this->def, []);

$this->addToAssertionCount(1);
}

public function test_it_wraps_sequential_ops_in_promise_when_async_is_appended_to_method_name()
Expand Down Expand Up @@ -90,10 +94,12 @@ public function test_it_returns_a_model_instance()
{
$this->assertInstanceOf(ResourceInterface::class, $this->operator->model(TestResource::class));
}

public function test_it_populates_models_from_response()
{
$this->assertInstanceOf(ResourceInterface::class, $this->operator->model(TestResource::class, new Response(200)));
}

public function test_it_populates_models_from_arrays()
{
$data = ['flavor' => [], 'image' => []];
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/Common/Api/ParameterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use OpenStack\Common\Api\Parameter;
use OpenStack\Test\Fixtures\ComputeV2Api;

class ParameterTest extends \PHPUnit_Framework_TestCase
class ParameterTest extends \PHPUnit\Framework\TestCase
{
private $param;
private $data;
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/Common/Error/BuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
use OpenStack\Common\Error\Builder;
use OpenStack\Common\Error\UserInputError;

class BuilderTest extends \PHPUnit_Framework_TestCase
class BuilderTest extends \PHPUnit\Framework\TestCase
{
private $builder;
private $client;

public function __construct()
public function setUp()
{
$this->client = $this->prophesize(ClientInterface::class);
$this->builder = new Builder($this->client->reveal());
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/Common/JsonPathTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use OpenStack\Common\JsonPath;

class JsonPathTest extends \PHPUnit_Framework_TestCase
class JsonPathTest extends \PHPUnit\Framework\TestCase
{
private $jsonPath;

Expand Down
2 changes: 1 addition & 1 deletion tests/unit/Common/Transport/JsonSerializerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
use OpenStack\Common\Resource\OperatorResource;
use OpenStack\Common\Transport\JsonSerializer;

class JsonSerializerTest extends \PHPUnit_Framework_TestCase
class JsonSerializerTest extends \PHPUnit\Framework\TestCase
{
/** @var JsonSerializer */
private $serializer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,20 +49,34 @@ public function test_it_retrieves()

$this->floatingIp->retrieve();

$this->assertEquals('376da547-b977-4cfe-9cba-275c80debf57',
$this->floatingIp->floatingNetworkId);
$this->assertEquals('d23abc8d-2991-4a55-ba98-2aaea84cc72f',
$this->floatingIp->routerId);
$this->assertEquals('10.0.0.3',
$this->floatingIp->fixedIpAddress);
$this->assertEquals('172.24.4.228',
$this->floatingIp->floatingIpAddress);
$this->assertEquals('4969c491a3c74ee4af974e6d800c62de',
$this->floatingIp->tenantId);
$this->assertEquals(
'376da547-b977-4cfe-9cba-275c80debf57',
$this->floatingIp->floatingNetworkId
);
$this->assertEquals(
'd23abc8d-2991-4a55-ba98-2aaea84cc72f',
$this->floatingIp->routerId
);
$this->assertEquals(
'10.0.0.3',
$this->floatingIp->fixedIpAddress
);
$this->assertEquals(
'172.24.4.228',
$this->floatingIp->floatingIpAddress
);
$this->assertEquals(
'4969c491a3c74ee4af974e6d800c62de',
$this->floatingIp->tenantId
);
$this->assertEquals('ACTIVE', $this->floatingIp->status);
$this->assertEquals('ce705c24-c1ef-408a-bda3-7bbd946164ab',
$this->floatingIp->portId);
$this->assertEquals('2f245a7b-796b-4f26-9cf9-9e82d248fda7',
$this->floatingIp->id);
$this->assertEquals(
'ce705c24-c1ef-408a-bda3-7bbd946164ab',
$this->floatingIp->portId
);
$this->assertEquals(
'2f245a7b-796b-4f26-9cf9-9e82d248fda7',
$this->floatingIp->id
);
}
}
2 changes: 1 addition & 1 deletion tests/unit/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
use GuzzleHttp\Psr7\Response;
use Prophecy\Argument;

abstract class TestCase extends \PHPUnit_Framework_TestCase
abstract class TestCase extends \PHPUnit\Framework\TestCase
{
/** @var \Prophecy\Prophecy\ObjectProphecy */
protected $client;
Expand Down