diff --git a/src/DataTransferObjects/Schemas/ErrorSchema.php b/src/DataTransferObjects/Schemas/ErrorSchema.php index 7ad201be..6f340150 100644 --- a/src/DataTransferObjects/Schemas/ErrorSchema.php +++ b/src/DataTransferObjects/Schemas/ErrorSchema.php @@ -10,5 +10,5 @@ class ErrorSchema extends DataTransferObject public string $message; - public string $details; + public ?string $details; } diff --git a/tests/Unit/AmznSPAHttpTest.php b/tests/Unit/AmznSPAHttpTest.php index 982b12ce..3c05820a 100644 --- a/tests/Unit/AmznSPAHttpTest.php +++ b/tests/Unit/AmznSPAHttpTest.php @@ -189,8 +189,6 @@ public function testInvalidInputResponseReturned() */ public function testSetupHttp() { - $this->expectException(RequestException::class); - $config = new AmznSPAConfig( marketplace_id: MarketplacesList::allIdentifiers()[rand(0, 15)], application_id: Str::random(), @@ -204,6 +202,8 @@ public function testSetupHttp() ); $amzn = new AmznSPA($config); - $amzn->notifications->getSubscription('ANY_OFFER_CHANGED'); + $response = $amzn->notifications->getSubscription('ANY_OFFER_CHANGED'); + + $this->assertEquals('InvalidInput', $response->errors->first()->code); } } diff --git a/tests/Unit/DataTransferObjects/Responses/Notifications/GetSubscriptionResponseTest.php b/tests/Unit/DataTransferObjects/Responses/Notifications/GetSubscriptionResponseTest.php index c5511c3d..e1b765cc 100644 --- a/tests/Unit/DataTransferObjects/Responses/Notifications/GetSubscriptionResponseTest.php +++ b/tests/Unit/DataTransferObjects/Responses/Notifications/GetSubscriptionResponseTest.php @@ -27,7 +27,7 @@ public function testSetupClass() $destination_id = Str::random(); $dto = new GetSubscriptionResponse( - error_list: [ + errors: [ [ 'code' => $error_code, 'message' => $error_message, @@ -41,8 +41,8 @@ public function testSetupClass() ]) ); - $this->assertInstanceOf(ErrorListSchema::class, $dto->error_list); - $error_schema = $dto->error_list->first(); + $this->assertInstanceOf(ErrorListSchema::class, $dto->errors); + $error_schema = $dto->errors->first(); $this->assertInstanceOf(ErrorSchema::class, $error_schema); /** @var ErrorSchema $error_schema */ $this->assertEquals($error_code, $error_schema->code); diff --git a/tests/Unit/DataTransferObjects/Schemas/ErrorListSchemaTest.php b/tests/Unit/DataTransferObjects/Schemas/ErrorListSchemaTest.php index a496b373..a40c3e36 100644 --- a/tests/Unit/DataTransferObjects/Schemas/ErrorListSchemaTest.php +++ b/tests/Unit/DataTransferObjects/Schemas/ErrorListSchemaTest.php @@ -13,7 +13,7 @@ public function testErrorPassingBadData() $this->expectException(TypeError::class); new GetSubscriptionResponse( - error_list: [ + errors: [ ['test' => 'test'], ], );