Skip to content

Update promise dependencies #30

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 25, 2015
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: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@
"require": {
"php": ">=5.4",
"php-http/httplug": "1.0.0-beta",
"php-http/client-tools": "^0.1@dev",
"php-http/message-factory": "^1.0",
"php-http/promise": "^0.1.1",
"php-http/client-common": "^0.1",
"symfony/options-resolver": "^2.6|^3.0"
},
"require-dev": {
Expand Down
4 changes: 2 additions & 2 deletions spec/CachePluginSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace spec\Http\Client\Plugin;

use Http\Client\Tools\Promise\FulfilledPromise;
use Http\Message\StreamFactory;
use Http\Promise\FulfilledPromise;
use PhpSpec\ObjectBehavior;
use Psr\Cache\CacheItemInterface;
use Psr\Cache\CacheItemPoolInterface;
Expand Down Expand Up @@ -115,4 +115,4 @@ function it_calculate_age_from_response(CacheItemPoolInterface $pool, CacheItemI

$this->handleRequest($request, $next, function () {});
}
}
}
2 changes: 1 addition & 1 deletion spec/CookiePluginSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace spec\Http\Client\Plugin;

use Http\Client\Tools\Promise\FulfilledPromise;
use Http\Promise\FulfilledPromise;
use Http\Cookie\Cookie;
use Http\Cookie\CookieJar;
use Http\Promise\Promise;
Expand Down
2 changes: 1 addition & 1 deletion spec/DecoderPluginSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace spec\Http\Client\Plugin;

use Http\Client\Tools\Promise\FulfilledPromise;
use Http\Promise\FulfilledPromise;
use Psr\Http\Message\RequestInterface;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\StreamInterface;
Expand Down
8 changes: 4 additions & 4 deletions spec/ErrorPluginSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace spec\Http\Client\Plugin;

use Http\Client\Tools\Promise\FulfilledPromise;
use Http\Promise\FulfilledPromise;
use Psr\Http\Message\RequestInterface;
use Psr\Http\Message\ResponseInterface;
use PhpSpec\ObjectBehavior;
Expand Down Expand Up @@ -30,7 +30,7 @@ function it_throw_request_exception_on_500_error(RequestInterface $request, Resp
}
};

$this->handleRequest($request, $next, function () {})->shouldReturnAnInstanceOf('Http\Client\Tools\Promise\RejectedPromise');
$this->handleRequest($request, $next, function () {})->shouldReturnAnInstanceOf('Http\Promise\RejectedPromise');
}

function it_returns_response(RequestInterface $request, ResponseInterface $response)
Expand All @@ -43,7 +43,7 @@ function it_returns_response(RequestInterface $request, ResponseInterface $respo
}
};

$this->handleRequest($request, $next, function () {})->shouldReturnAnInstanceOf('Http\Client\Tools\Promise\FulfilledPromise');
$this->handleRequest($request, $next, function () {})->shouldReturnAnInstanceOf('Http\Promise\FulfilledPromise');
}

function it_throws_request_exception_on_custom_regex(RequestInterface $request, ResponseInterface $response)
Expand All @@ -57,6 +57,6 @@ function it_throws_request_exception_on_custom_regex(RequestInterface $request,
}
};

$this->handleRequest($request, $next, function () {})->shouldReturnAnInstanceOf('Http\Client\Tools\Promise\RejectedPromise');
$this->handleRequest($request, $next, function () {})->shouldReturnAnInstanceOf('Http\Promise\RejectedPromise');
}
}
4 changes: 2 additions & 2 deletions spec/HistoryPluginSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

use Http\Client\Exception\TransferException;
use Http\Client\Plugin\Journal\Journal;
use Http\Client\Tools\Promise\FulfilledPromise;
use Http\Client\Tools\Promise\RejectedPromise;
use Http\Promise\FulfilledPromise;
use Http\Promise\RejectedPromise;
use Psr\Http\Message\RequestInterface;
use Psr\Http\Message\ResponseInterface;
use PhpSpec\ObjectBehavior;
Expand Down
4 changes: 2 additions & 2 deletions spec/LoggerPluginSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

use Http\Client\Exception\HttpException;
use Http\Client\Exception\NetworkException;
use Http\Client\Tools\Promise\FulfilledPromise;
use Http\Client\Tools\Promise\RejectedPromise;
use Http\Promise\FulfilledPromise;
use Http\Promise\RejectedPromise;
use PhpSpec\ObjectBehavior;
use Prophecy\Argument;
use Psr\Http\Message\RequestInterface;
Expand Down
14 changes: 7 additions & 7 deletions spec/RedirectPluginSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace spec\Http\Client\Plugin;

use Http\Client\Plugin\RedirectPlugin;
use Http\Client\Tools\Promise\FulfilledPromise;
use Http\Promise\FulfilledPromise;
use Http\Promise\Promise;
use Psr\Http\Message\RequestInterface;
use Psr\Http\Message\ResponseInterface;
Expand Down Expand Up @@ -63,7 +63,7 @@ function it_redirects_on_302(
$promise->wait()->shouldBeCalled()->willReturn($finalResponse);

$finalPromise = $this->handleRequest($request, $next, $first);
$finalPromise->shouldReturnAnInstanceOf('Http\Client\Tools\Promise\FulfilledPromise');
$finalPromise->shouldReturnAnInstanceOf('Http\Promise\FulfilledPromise');
$finalPromise->wait()->shouldReturn($finalResponse);
}

Expand Down Expand Up @@ -192,7 +192,7 @@ function it_throws_http_exception_on_no_location(RequestInterface $request, Resp
$responseRedirect->hasHeader('Location')->willReturn(false);

$promise = $this->handleRequest($request, $next, function () {});
$promise->shouldReturnAnInstanceOf('Http\Client\Tools\Promise\RejectedPromise');
$promise->shouldReturnAnInstanceOf('Http\Promise\RejectedPromise');
$promise->shouldThrow('Http\Client\Exception\HttpException')->duringWait();
}

Expand All @@ -211,7 +211,7 @@ function it_throws_http_exception_on_invalid_location(RequestInterface $request,
$responseRedirect->hasHeader('Location')->willReturn(true);

$promise = $this->handleRequest($request, $next, function () {});
$promise->shouldReturnAnInstanceOf('Http\Client\Tools\Promise\RejectedPromise');
$promise->shouldReturnAnInstanceOf('Http\Promise\RejectedPromise');
$promise->shouldThrow('Http\Client\Exception\HttpException')->duringWait();
}

Expand All @@ -227,7 +227,7 @@ function it_throw_multi_redirect_exception_on_300(RequestInterface $request, Res
$responseRedirect->getStatusCode()->willReturn('300');

$promise = $this->handleRequest($request, $next, function () {});
$promise->shouldReturnAnInstanceOf('Http\Client\Tools\Promise\RejectedPromise');
$promise->shouldReturnAnInstanceOf('Http\Promise\RejectedPromise');
$promise->shouldThrow('Http\Client\Plugin\Exception\MultipleRedirectionException')->duringWait();
}

Expand All @@ -243,7 +243,7 @@ function it_throw_multi_redirect_exception_on_300_if_no_location(RequestInterfac
$responseRedirect->hasHeader('Location')->willReturn(false);

$promise = $this->handleRequest($request, $next, function () {});
$promise->shouldReturnAnInstanceOf('Http\Client\Tools\Promise\RejectedPromise');
$promise->shouldReturnAnInstanceOf('Http\Promise\RejectedPromise');
$promise->shouldThrow('Http\Client\Plugin\Exception\MultipleRedirectionException')->duringWait();
}

Expand Down Expand Up @@ -370,7 +370,7 @@ function it_throws_circular_redirection_exception(UriInterface $uri, UriInterfac
};

$promise = $this->handleRequest($request, $next, $first);
$promise->shouldReturnAnInstanceOf('Http\Client\Tools\Promise\RejectedPromise');
$promise->shouldReturnAnInstanceOf('Http\Promise\RejectedPromise');
$promise->shouldThrow('Http\Client\Plugin\Exception\CircularRedirectionException')->duringWait();
}
}
Expand Down
14 changes: 7 additions & 7 deletions spec/RetryPluginSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
namespace spec\Http\Client\Plugin;

use Http\Client\Exception;
use Http\Client\Tools\Promise\FulfilledPromise;
use Http\Client\Tools\Promise\RejectedPromise;
use Http\Promise\FulfilledPromise;
use Http\Promise\RejectedPromise;
use Psr\Http\Message\RequestInterface;
use Psr\Http\Message\ResponseInterface;
use PhpSpec\ObjectBehavior;
Expand All @@ -30,7 +30,7 @@ function it_returns_response(RequestInterface $request, ResponseInterface $respo
}
};

$this->handleRequest($request, $next, function () {})->shouldReturnAnInstanceOf('Http\Client\Tools\Promise\FulfilledPromise');
$this->handleRequest($request, $next, function () {})->shouldReturnAnInstanceOf('Http\Promise\FulfilledPromise');
}

function it_throws_exception_on_multiple_exceptions(RequestInterface $request)
Expand All @@ -53,7 +53,7 @@ function it_throws_exception_on_multiple_exceptions(RequestInterface $request)
};

$promise = $this->handleRequest($request, $next, function () {});
$promise->shouldReturnAnInstanceOf('Http\Client\Tools\Promise\RejectedPromise');
$promise->shouldReturnAnInstanceOf('Http\Promise\RejectedPromise');
$promise->shouldThrow($exception2)->duringWait();
}

Expand All @@ -76,7 +76,7 @@ function it_returns_response_on_second_try(RequestInterface $request, ResponseIn
};

$promise = $this->handleRequest($request, $next, function () {});
$promise->shouldReturnAnInstanceOf('Http\Client\Tools\Promise\FulfilledPromise');
$promise->shouldReturnAnInstanceOf('Http\Promise\FulfilledPromise');
$promise->wait()->shouldReturn($response);
}

Expand All @@ -98,7 +98,7 @@ function it_does_not_keep_history_of_old_failure(RequestInterface $request, Resp
}
};

$this->handleRequest($request, $next, function () {})->shouldReturnAnInstanceOf('Http\Client\Tools\Promise\FulfilledPromise');
$this->handleRequest($request, $next, function () {})->shouldReturnAnInstanceOf('Http\Client\Tools\Promise\FulfilledPromise');
$this->handleRequest($request, $next, function () {})->shouldReturnAnInstanceOf('Http\Promise\FulfilledPromise');
$this->handleRequest($request, $next, function () {})->shouldReturnAnInstanceOf('Http\Promise\FulfilledPromise');
}
}
4 changes: 2 additions & 2 deletions spec/StopwatchPluginSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
namespace spec\Http\Client\Plugin;

use Http\Client\Exception\NetworkException;
use Http\Client\Tools\Promise\FulfilledPromise;
use Http\Client\Tools\Promise\RejectedPromise;
use Http\Promise\FulfilledPromise;
use Http\Promise\RejectedPromise;
use Psr\Http\Message\RequestInterface;
use Psr\Http\Message\ResponseInterface;
use Symfony\Component\Stopwatch\Stopwatch;
Expand Down
2 changes: 1 addition & 1 deletion src/CachePlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace Http\Client\Plugin;

use Http\Client\Tools\Promise\FulfilledPromise;
use Http\Message\StreamFactory;
use Http\Promise\FulfilledPromise;
use Psr\Cache\CacheItemPoolInterface;
use Psr\Http\Message\RequestInterface;
use Psr\Http\Message\ResponseInterface;
Expand Down
6 changes: 4 additions & 2 deletions src/EmulateAsyncClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@

use Http\Client\HttpAsyncClient;
use Http\Client\HttpClient;
use Http\Client\Tools\HttpAsyncClientEmulator;
use Http\Client\Tools\HttpClientDecorator;
use Http\Client\Common\HttpAsyncClientEmulator;
use Http\Client\Common\HttpClientDecorator;

/**
* Emulate an async client.
*
* This should be replaced by an anonymous class in PHP 7.
*/
class EmulateAsyncClient implements HttpClient, HttpAsyncClient
{
Expand Down