Adjust API to work with Guzzle 6

This commit is contained in:
ayeo 2016-04-09 16:42:46 +02:00
parent 10569180da
commit fa38e68045
4 changed files with 98 additions and 64 deletions

1
.gitignore vendored
View File

@ -1,5 +1,6 @@
node_modules
.DS_Store
.idea
/sftp-config.json
static

141
composer.lock generated
View File

@ -4,39 +4,43 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"hash": "2587ec4642e574482832632b73b74202",
"content-hash": "598abc0b07c38c31f8cc44bbf293dae3",
"hash": "f56993fb68e4fc434e430eb51d888364",
"content-hash": "5162d1dac05611d2abcb5407954ef2df",
"packages": [
{
"name": "guzzlehttp/guzzle",
"version": "5.3.0",
"version": "6.2.0",
"source": {
"type": "git",
"url": "https://github.com/guzzle/guzzle.git",
"reference": "f3c8c22471cb55475105c14769644a49c3262b93"
"reference": "d094e337976dff9d8e2424e8485872194e768662"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/guzzle/guzzle/zipball/f3c8c22471cb55475105c14769644a49c3262b93",
"reference": "f3c8c22471cb55475105c14769644a49c3262b93",
"url": "https://api.github.com/repos/guzzle/guzzle/zipball/d094e337976dff9d8e2424e8485872194e768662",
"reference": "d094e337976dff9d8e2424e8485872194e768662",
"shasum": ""
},
"require": {
"guzzlehttp/ringphp": "^1.1",
"php": ">=5.4.0"
"guzzlehttp/promises": "~1.0",
"guzzlehttp/psr7": "~1.1",
"php": ">=5.5.0"
},
"require-dev": {
"ext-curl": "*",
"phpunit/phpunit": "^4.0",
"psr/log": "^1.0"
"phpunit/phpunit": "~4.0",
"psr/log": "~1.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "5.0-dev"
"dev-master": "6.2-dev"
}
},
"autoload": {
"files": [
"src/functions_include.php"
],
"psr-4": {
"GuzzleHttp\\": "src/"
}
@ -52,7 +56,7 @@
"homepage": "https://github.com/mtdowling"
}
],
"description": "Guzzle is a PHP HTTP client library and framework for building RESTful web service clients",
"description": "Guzzle is a PHP HTTP client library",
"homepage": "http://guzzlephp.org/",
"keywords": [
"client",
@ -63,44 +67,41 @@
"rest",
"web service"
],
"time": "2015-05-20 03:47:55"
"time": "2016-03-21 20:02:09"
},
{
"name": "guzzlehttp/ringphp",
"name": "guzzlehttp/promises",
"version": "1.1.0",
"source": {
"type": "git",
"url": "https://github.com/guzzle/RingPHP.git",
"reference": "dbbb91d7f6c191e5e405e900e3102ac7f261bc0b"
"url": "https://github.com/guzzle/promises.git",
"reference": "bb9024c526b22f3fe6ae55a561fd70653d470aa8"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/guzzle/RingPHP/zipball/dbbb91d7f6c191e5e405e900e3102ac7f261bc0b",
"reference": "dbbb91d7f6c191e5e405e900e3102ac7f261bc0b",
"url": "https://api.github.com/repos/guzzle/promises/zipball/bb9024c526b22f3fe6ae55a561fd70653d470aa8",
"reference": "bb9024c526b22f3fe6ae55a561fd70653d470aa8",
"shasum": ""
},
"require": {
"guzzlehttp/streams": "~3.0",
"php": ">=5.4.0",
"react/promise": "~2.0"
"php": ">=5.5.0"
},
"require-dev": {
"ext-curl": "*",
"phpunit/phpunit": "~4.0"
},
"suggest": {
"ext-curl": "Guzzle will use specific adapters if cURL is present"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.1-dev"
"dev-master": "1.0-dev"
}
},
"autoload": {
"psr-4": {
"GuzzleHttp\\Ring\\": "src/"
}
"GuzzleHttp\\Promise\\": "src/"
},
"files": [
"src/functions_include.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
@ -113,25 +114,32 @@
"homepage": "https://github.com/mtdowling"
}
],
"description": "Provides a simple API and specification that abstracts away the details of HTTP into a single PHP function.",
"time": "2015-05-20 03:37:09"
"description": "Guzzle promises library",
"keywords": [
"promise"
],
"time": "2016-03-08 01:15:46"
},
{
"name": "guzzlehttp/streams",
"version": "3.0.0",
"name": "guzzlehttp/psr7",
"version": "1.2.3",
"source": {
"type": "git",
"url": "https://github.com/guzzle/streams.git",
"reference": "47aaa48e27dae43d39fc1cea0ccf0d84ac1a2ba5"
"url": "https://github.com/guzzle/psr7.git",
"reference": "2e89629ff057ebb49492ba08e6995d3a6a80021b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/guzzle/streams/zipball/47aaa48e27dae43d39fc1cea0ccf0d84ac1a2ba5",
"reference": "47aaa48e27dae43d39fc1cea0ccf0d84ac1a2ba5",
"url": "https://api.github.com/repos/guzzle/psr7/zipball/2e89629ff057ebb49492ba08e6995d3a6a80021b",
"reference": "2e89629ff057ebb49492ba08e6995d3a6a80021b",
"shasum": ""
},
"require": {
"php": ">=5.4.0"
"php": ">=5.4.0",
"psr/http-message": "~1.0"
},
"provide": {
"psr/http-message-implementation": "1.0"
},
"require-dev": {
"phpunit/phpunit": "~4.0"
@ -139,13 +147,16 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.0-dev"
"dev-master": "1.0-dev"
}
},
"autoload": {
"psr-4": {
"GuzzleHttp\\Stream\\": "src/"
}
"GuzzleHttp\\Psr7\\": "src/"
},
"files": [
"src/functions_include.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
@ -158,13 +169,14 @@
"homepage": "https://github.com/mtdowling"
}
],
"description": "Provides a simple abstraction over streams of data",
"homepage": "http://guzzlephp.org/",
"description": "PSR-7 message implementation",
"keywords": [
"Guzzle",
"stream"
"http",
"message",
"stream",
"uri"
],
"time": "2014-10-12 19:18:40"
"time": "2016-02-18 21:54:00"
},
{
"name": "league/commonmark",
@ -287,35 +299,32 @@
"time": "2015-07-09 02:14:40"
},
{
"name": "react/promise",
"version": "v2.4.0",
"name": "psr/http-message",
"version": "1.0",
"source": {
"type": "git",
"url": "https://github.com/reactphp/promise.git",
"reference": "f942da7b505d1a294284ab343d05df42d02ad6d9"
"url": "https://github.com/php-fig/http-message.git",
"reference": "85d63699f0dbedb190bbd4b0d2b9dc707ea4c298"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/reactphp/promise/zipball/f942da7b505d1a294284ab343d05df42d02ad6d9",
"reference": "f942da7b505d1a294284ab343d05df42d02ad6d9",
"url": "https://api.github.com/repos/php-fig/http-message/zipball/85d63699f0dbedb190bbd4b0d2b9dc707ea4c298",
"reference": "85d63699f0dbedb190bbd4b0d2b9dc707ea4c298",
"shasum": ""
},
"require": {
"php": ">=5.4.0"
"php": ">=5.3.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.0-dev"
"dev-master": "1.0.x-dev"
}
},
"autoload": {
"psr-4": {
"React\\Promise\\": "src/"
},
"files": [
"src/functions_include.php"
]
"Psr\\Http\\Message\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
@ -323,12 +332,20 @@
],
"authors": [
{
"name": "Jan Sorgalla",
"email": "jsorgalla@gmail.com"
"name": "PHP-FIG",
"homepage": "http://www.php-fig.org/"
}
],
"description": "A lightweight implementation of CommonJS Promises/A for PHP",
"time": "2016-03-31 13:10:33"
"description": "Common interface for HTTP messages",
"keywords": [
"http",
"http-message",
"psr",
"psr-7",
"request",
"response"
],
"time": "2015-05-04 20:22:00"
},
{
"name": "symfony/console",

View File

@ -24,10 +24,14 @@ class Api
$this->space = $space_id;
}
protected function getClient()
/**
* This method is public due to test purposes
* @return Client
*/
public function getClient()
{
$options = [
'base_url' => $this->base_url . 'rest/api/',
'base_uri' => $this->base_url . 'rest/api/',
'defaults' => [
'auth' => [$this->user, $this->pass]
]

View File

@ -0,0 +1,12 @@
<?php
namespace Todaymade\Daux\Format\Confluence;
class BuilderTest extends \PHPUnit_Framework_TestCase
{
// this test supports upgrade Guzzle to version 6
public function testClientOptions()
{
$api = new Api("http://test.com/", "user", "pass");
$this->assertEquals("test.com", $api->getClient()->getConfig()['base_uri']->getHost());
}
}