Skip to content

Commit

Permalink
Added logging on HTTP exception (#507)
Browse files Browse the repository at this point in the history
* Added logging on HTTP exception

* Fixed tests

* Test fix

* Added name to please "composer normalize"

* Dont log in constructor

* Mniir

* PHPStan fix
  • Loading branch information
Nyholm authored Apr 28, 2020
1 parent 6b4524d commit 164c777
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
3 changes: 2 additions & 1 deletion tests/Unit/Result/AddLayerVersionPermissionResponseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use AsyncAws\Core\Test\Http\SimpleMockedResponse;
use AsyncAws\Core\Test\TestCase;
use AsyncAws\Lambda\Result\AddLayerVersionPermissionResponse;
use Psr\Log\NullLogger;
use Symfony\Component\HttpClient\MockHttpClient;

class AddLayerVersionPermissionResponseTest extends TestCase
Expand All @@ -19,7 +20,7 @@ public function testAddLayerVersionPermissionResponse(): void
}');

$client = new MockHttpClient($response);
$result = new AddLayerVersionPermissionResponse(new Response($client->request('POST', 'http://localhost'), $client));
$result = new AddLayerVersionPermissionResponse(new Response($client->request('POST', 'http://localhost'), $client, new NullLogger()));

self::assertSame('fooBar', $result->getStatement());
self::assertSame('123456', $result->getRevisionId());
Expand Down
3 changes: 2 additions & 1 deletion tests/Unit/Result/InvocationResponseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use AsyncAws\Core\Test\Http\SimpleMockedResponse;
use AsyncAws\Lambda\Result\InvocationResponse;
use PHPUnit\Framework\TestCase;
use Psr\Log\NullLogger;
use Symfony\Component\HttpClient\MockHttpClient;

class InvocationResponseTest extends TestCase
Expand All @@ -17,7 +18,7 @@ public function testInvocationResponse(): void
$response = new SimpleMockedResponse($json, ['content-type' => 'application/json'], 200);

$client = new MockHttpClient($response);
$result = new InvocationResponse(new Response($client->request('POST', 'http://localhost'), $client));
$result = new InvocationResponse(new Response($client->request('POST', 'http://localhost'), $client, new NullLogger()));

self::assertEquals($json, $result->getPayload());
self::assertEquals(200, $result->getStatusCode());
Expand Down
3 changes: 2 additions & 1 deletion tests/Unit/Result/ListLayerVersionsResponseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use AsyncAws\Core\Test\TestCase;
use AsyncAws\Lambda\Result\LayerVersionsListItem;
use AsyncAws\Lambda\Result\ListLayerVersionsResponse;
use Psr\Log\NullLogger;
use Symfony\Component\HttpClient\MockHttpClient;

class ListLayerVersionsResponseTest extends TestCase
Expand All @@ -33,7 +34,7 @@ public function testListLayerVersionsResponse(): void
$response = new SimpleMockedResponse(json_encode($data));

$client = new MockHttpClient($response);
$result = new ListLayerVersionsResponse(new Response($client->request('POST', 'http://localhost'), $client));
$result = new ListLayerVersionsResponse(new Response($client->request('POST', 'http://localhost'), $client, new NullLogger()));

self::assertEquals($nextMarker, $result->getNextMarker());
/** @var LayerVersionsListItem $version */
Expand Down
3 changes: 2 additions & 1 deletion tests/Unit/Result/PublishLayerVersionResponseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use AsyncAws\Core\Test\Http\SimpleMockedResponse;
use AsyncAws\Core\Test\TestCase;
use AsyncAws\Lambda\Result\PublishLayerVersionResponse;
use Psr\Log\NullLogger;
use Symfony\Component\HttpClient\MockHttpClient;

class PublishLayerVersionResponseTest extends TestCase
Expand All @@ -30,7 +31,7 @@ public function testPublishLayerVersionResponse(): void
');

$client = new MockHttpClient($response);
$result = new PublishLayerVersionResponse(new Response($client->request('POST', 'http://localhost'), $client));
$result = new PublishLayerVersionResponse(new Response($client->request('POST', 'http://localhost'), $client, new NullLogger()));

// self::assertTODO(expected, $result->getContent());
self::assertSame('arn:::fn:arn', $result->getLayerArn());
Expand Down

0 comments on commit 164c777

Please sign in to comment.