mirror of
https://github.com/ovh/php-ovh.git
synced 2023-11-05 03:20:26 +01:00
chore: bump to php 7.4, guzzle 7, phpunit 9
This commit is contained in:
parent
c473b3d67e
commit
f322f6a819
@ -5,14 +5,10 @@ addons:
|
||||
|
||||
language: php
|
||||
php:
|
||||
- 7.3
|
||||
- 7.2
|
||||
- 7.1
|
||||
- 7.0
|
||||
- 5.6
|
||||
- 7.4
|
||||
|
||||
before_script:
|
||||
- composer self-update
|
||||
- composer install
|
||||
|
||||
script: vendor/bin/phing test -Donly.units=true
|
||||
script: vendor/bin/phpunit
|
||||
|
@ -3,15 +3,17 @@
|
||||
"description": "Wrapper for OVH APIs",
|
||||
"license": "BSD-3-Clause",
|
||||
"require": {
|
||||
"guzzlehttp/guzzle": "^6.0"
|
||||
"php": ">=7.3",
|
||||
"guzzlehttp/guzzle": "^6.0||^7.0"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {"Ovh\\": "src/"}
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "4.*",
|
||||
"phpdocumentor/phpdocumentor": "2.*",
|
||||
"squizlabs/php_codesniffer": "2.*",
|
||||
"phing/phing": "^2.14"
|
||||
"phpunit/phpunit": "^9.5",
|
||||
"phpdocumentor/phpdocumentor": "v3.0.0",
|
||||
"squizlabs/php_codesniffer": "^3.5",
|
||||
"phpdocumentor/graphviz": "^2.0@dev",
|
||||
"symfony/flex": "^1.11"
|
||||
}
|
||||
}
|
||||
|
@ -1,19 +1,19 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<phpunit colors="true" bootstrap="tests/bootstrap.php">
|
||||
<testsuites>
|
||||
<testsuite name="OVH APIs wrapper">
|
||||
<directory>tests</directory>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
<php>
|
||||
<env name="ENDPOINT" value=""/>
|
||||
<env name="APP_KEY" value=""/>
|
||||
<env name="APP_SECRET" value=""/>
|
||||
<env name="CONSUMER" value=""/>
|
||||
</php>
|
||||
<filter>
|
||||
<whitelist>
|
||||
<directory>src</directory>
|
||||
</whitelist>
|
||||
</filter>
|
||||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" colors="true" bootstrap="tests/bootstrap.php" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
|
||||
<coverage>
|
||||
<include>
|
||||
<directory>src</directory>
|
||||
</include>
|
||||
</coverage>
|
||||
<testsuites>
|
||||
<testsuite name="OVH APIs wrapper">
|
||||
<directory>tests</directory>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
<php>
|
||||
<env name="ENDPOINT" value=""/>
|
||||
<env name="APP_KEY" value=""/>
|
||||
<env name="APP_SECRET" value=""/>
|
||||
<env name="CONSUMER" value=""/>
|
||||
</php>
|
||||
</phpunit>
|
||||
|
@ -28,7 +28,9 @@
|
||||
namespace Ovh\tests;
|
||||
|
||||
use GuzzleHttp\Client;
|
||||
use GuzzleHttp\Exception\ClientException;
|
||||
use Ovh\Api;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/**
|
||||
* Functional tests of Api class
|
||||
@ -36,7 +38,7 @@ use Ovh\Api;
|
||||
* @package Ovh
|
||||
* @category Ovh
|
||||
*/
|
||||
class ApiFunctionalTest extends \PHPUnit_Framework_TestCase
|
||||
class ApiFunctionalTest extends TestCase
|
||||
{
|
||||
|
||||
/**
|
||||
@ -82,7 +84,7 @@ class ApiFunctionalTest extends \PHPUnit_Framework_TestCase
|
||||
/**
|
||||
* Define id to create object
|
||||
*/
|
||||
protected function setUp()
|
||||
protected function setUp() :void
|
||||
{
|
||||
$this->application_key = getenv('APP_KEY');
|
||||
$this->application_secret = getenv('APP_SECRET');
|
||||
@ -238,7 +240,7 @@ class ApiFunctionalTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testApiGetWithParameters()
|
||||
{
|
||||
$this->setExpectedException('\\GuzzleHttp\\Exception\\ClientException', '400');
|
||||
$this->expectException(ClientException::class);
|
||||
|
||||
$this->api->get('/me/accessRestriction/ip', ['foo' => 'bar']);
|
||||
}
|
||||
|
@ -28,10 +28,13 @@
|
||||
namespace Ovh\tests;
|
||||
|
||||
use GuzzleHttp\Client;
|
||||
use GuzzleHttp\Exception\ClientException;
|
||||
use GuzzleHttp\Middleware;
|
||||
use GuzzleHttp\Psr7\Response;
|
||||
use GuzzleHttp\Psr7\Request;
|
||||
use Ovh\Api;
|
||||
use Ovh\Exceptions\InvalidParameterException;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/**
|
||||
* Test Api class
|
||||
@ -39,7 +42,7 @@ use Ovh\Api;
|
||||
* @package Ovh
|
||||
* @category Ovh
|
||||
*/
|
||||
class ApiTest extends \PHPUnit_Framework_TestCase
|
||||
class ApiTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @var Client
|
||||
@ -69,7 +72,7 @@ class ApiTest extends \PHPUnit_Framework_TestCase
|
||||
/**
|
||||
* Define id to create object
|
||||
*/
|
||||
protected function setUp()
|
||||
protected function setUp() :void
|
||||
{
|
||||
$this->application_key = 'app_key';
|
||||
$this->application_secret = 'app_secret';
|
||||
@ -116,7 +119,7 @@ class ApiTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testMissingApplicationKey()
|
||||
{
|
||||
$this->setExpectedException('\\Ovh\\Exceptions\\InvalidParameterException', 'Application key');
|
||||
$this->expectException(InvalidParameterException::class);
|
||||
$api = new Api(null, $this->application_secret, $this->endpoint, $this->consumer_key, $this->client);
|
||||
$api->get('/me');
|
||||
}
|
||||
@ -126,7 +129,7 @@ class ApiTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testMissingApplicationSecret()
|
||||
{
|
||||
$this->setExpectedException('\\Ovh\\Exceptions\\InvalidParameterException', 'Application secret');
|
||||
$this->expectException(InvalidParameterException::class);
|
||||
$api = new Api($this->application_key, null, $this->endpoint, $this->consumer_key, $this->client);
|
||||
$api->get('/me');
|
||||
}
|
||||
@ -157,7 +160,7 @@ class ApiTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testMissingApiEndpoint()
|
||||
{
|
||||
$this->setExpectedException('\\Ovh\\Exceptions\\InvalidParameterException', 'Endpoint');
|
||||
$this->expectException(InvalidParameterException::class);
|
||||
new Api($this->application_key, $this->application_secret, null, $this->consumer_key, $this->client);
|
||||
}
|
||||
|
||||
@ -166,7 +169,7 @@ class ApiTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testBadApiEndpoint()
|
||||
{
|
||||
$this->setExpectedException('\\Ovh\\Exceptions\\InvalidParameterException', 'Unknown');
|
||||
$this->expectException(InvalidParameterException::class);
|
||||
new Api($this->application_key, $this->application_secret, 'i_am_invalid', $this->consumer_key, $this->client);
|
||||
}
|
||||
|
||||
@ -243,9 +246,8 @@ class ApiTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testInvalidApplicationKey()
|
||||
{
|
||||
$this->setExpectedException(
|
||||
'\GuzzleHttp\Exception\ClientException'
|
||||
);
|
||||
|
||||
$this->expectException(ClientException::class);
|
||||
|
||||
$handlerStack = $this->client->getConfig('handler');
|
||||
$handlerStack->push(Middleware::mapResponse(function (Response $response) {
|
||||
@ -276,9 +278,7 @@ class ApiTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testInvalidRight()
|
||||
{
|
||||
$this->setExpectedException(
|
||||
'\GuzzleHttp\Exception\ClientException'
|
||||
);
|
||||
$this->expectException(ClientException::class);
|
||||
|
||||
$handlerStack = $this->client->getConfig('handler');
|
||||
$handlerStack->push(Middleware::mapResponse(function (Response $response) {
|
||||
|
Loading…
Reference in New Issue
Block a user