From 164c7773d662a92db8f66916093751cea4d4b16e Mon Sep 17 00:00:00 2001 From: Tobias Nyholm Date: Tue, 28 Apr 2020 08:27:45 +0200 Subject: [PATCH] Added logging on HTTP exception (#507) * Added logging on HTTP exception * Fixed tests * Test fix * Added name to please "composer normalize" * Dont log in constructor * Mniir * PHPStan fix --- tests/Unit/Result/AddLayerVersionPermissionResponseTest.php | 3 ++- tests/Unit/Result/InvocationResponseTest.php | 3 ++- tests/Unit/Result/ListLayerVersionsResponseTest.php | 3 ++- tests/Unit/Result/PublishLayerVersionResponseTest.php | 3 ++- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/tests/Unit/Result/AddLayerVersionPermissionResponseTest.php b/tests/Unit/Result/AddLayerVersionPermissionResponseTest.php index 32c59f6..9ce84bb 100644 --- a/tests/Unit/Result/AddLayerVersionPermissionResponseTest.php +++ b/tests/Unit/Result/AddLayerVersionPermissionResponseTest.php @@ -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 @@ -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()); diff --git a/tests/Unit/Result/InvocationResponseTest.php b/tests/Unit/Result/InvocationResponseTest.php index f0b8865..078c9cd 100644 --- a/tests/Unit/Result/InvocationResponseTest.php +++ b/tests/Unit/Result/InvocationResponseTest.php @@ -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 @@ -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()); diff --git a/tests/Unit/Result/ListLayerVersionsResponseTest.php b/tests/Unit/Result/ListLayerVersionsResponseTest.php index b57c04b..f3173dd 100644 --- a/tests/Unit/Result/ListLayerVersionsResponseTest.php +++ b/tests/Unit/Result/ListLayerVersionsResponseTest.php @@ -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 @@ -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 */ diff --git a/tests/Unit/Result/PublishLayerVersionResponseTest.php b/tests/Unit/Result/PublishLayerVersionResponseTest.php index 8d13ca1..ecf42e0 100644 --- a/tests/Unit/Result/PublishLayerVersionResponseTest.php +++ b/tests/Unit/Result/PublishLayerVersionResponseTest.php @@ -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 @@ -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());