From b6a97c9ad72157072a9e595c94c0aee1baa3c682 Mon Sep 17 00:00:00 2001 From: Cees-Jan Kiewiet Date: Sat, 18 Mar 2017 10:14:10 +0100 Subject: [PATCH] Iterage pages changes --- src/Service/IteratePagesService.php | 14 +++++++++++--- .../CommandBus/Command/IteratePagesCommandTest.php | 4 ++-- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/Service/IteratePagesService.php b/src/Service/IteratePagesService.php index c61e34dbbb..5d4380e8c6 100644 --- a/src/Service/IteratePagesService.php +++ b/src/Service/IteratePagesService.php @@ -38,9 +38,14 @@ public function handle(string $path = null): CancellablePromiseInterface ) use ($path) { $promise = $this->requestService-> handle(new Request('GET', $path))-> - done(function ($response) use ($observer) { - return $this->handleResponse($response, $observer); - }) + then( + function ($response) use ($observer) { + return $this->handleResponse($response, $observer); + }, + function ($error) use ($observer) { + $observer->onError($error); + } + ) ; return new CallbackDisposable(function () use ($promise) { @@ -93,6 +98,9 @@ private function handleResponseContentsComplete( return $this->handleResponseContents($response, $observer)->then(function () use ($observer) { $observer->onCompleted(); return new FulfilledPromise(); + }, function ($error) use ($observer) { + $observer->onError($error); + return new FulfilledPromise(); }); } diff --git a/tests/CommandBus/Command/IteratePagesCommandTest.php b/tests/CommandBus/Command/IteratePagesCommandTest.php index 57960f008c..4e84c6f375 100644 --- a/tests/CommandBus/Command/IteratePagesCommandTest.php +++ b/tests/CommandBus/Command/IteratePagesCommandTest.php @@ -5,12 +5,12 @@ use ApiClients\Client\Github\CommandBus\Command\IteratePagesCommand; use ApiClients\Tools\TestUtilities\TestCase; -class IteratePagesCommandTest extends TestCase +final class IteratePagesCommandTest extends TestCase { public function testCommand() { $path = '/foo.bar'; $command = new IteratePagesCommand($path); - $this->assertSame($path, $command->getPath()); + self::assertSame($path, $command->getPath()); } }