Skip to content

Commit 164c777

Browse files
authored
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
1 parent 6b4524d commit 164c777

4 files changed

+8
-4
lines changed

tests/Unit/Result/AddLayerVersionPermissionResponseTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
use AsyncAws\Core\Test\Http\SimpleMockedResponse;
77
use AsyncAws\Core\Test\TestCase;
88
use AsyncAws\Lambda\Result\AddLayerVersionPermissionResponse;
9+
use Psr\Log\NullLogger;
910
use Symfony\Component\HttpClient\MockHttpClient;
1011

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

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

2425
self::assertSame('fooBar', $result->getStatement());
2526
self::assertSame('123456', $result->getRevisionId());

tests/Unit/Result/InvocationResponseTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
use AsyncAws\Core\Test\Http\SimpleMockedResponse;
77
use AsyncAws\Lambda\Result\InvocationResponse;
88
use PHPUnit\Framework\TestCase;
9+
use Psr\Log\NullLogger;
910
use Symfony\Component\HttpClient\MockHttpClient;
1011

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

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

2223
self::assertEquals($json, $result->getPayload());
2324
self::assertEquals(200, $result->getStatusCode());

tests/Unit/Result/ListLayerVersionsResponseTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use AsyncAws\Core\Test\TestCase;
88
use AsyncAws\Lambda\Result\LayerVersionsListItem;
99
use AsyncAws\Lambda\Result\ListLayerVersionsResponse;
10+
use Psr\Log\NullLogger;
1011
use Symfony\Component\HttpClient\MockHttpClient;
1112

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

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

3839
self::assertEquals($nextMarker, $result->getNextMarker());
3940
/** @var LayerVersionsListItem $version */

tests/Unit/Result/PublishLayerVersionResponseTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
use AsyncAws\Core\Test\Http\SimpleMockedResponse;
77
use AsyncAws\Core\Test\TestCase;
88
use AsyncAws\Lambda\Result\PublishLayerVersionResponse;
9+
use Psr\Log\NullLogger;
910
use Symfony\Component\HttpClient\MockHttpClient;
1011

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

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

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

0 commit comments

Comments
 (0)