Skip to content

Commit

Permalink
Fix tests using error_list
Browse files Browse the repository at this point in the history
  • Loading branch information
keithbrink committed Sep 30, 2021
1 parent 8eda174 commit 3911cdf
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/DataTransferObjects/Schemas/ErrorSchema.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ class ErrorSchema extends DataTransferObject

public string $message;

public string $details;
public ?string $details;
}
6 changes: 3 additions & 3 deletions tests/Unit/AmznSPAHttpTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand All @@ -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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function testSetupClass()
$destination_id = Str::random();

$dto = new GetSubscriptionResponse(
error_list: [
errors: [
[
'code' => $error_code,
'message' => $error_message,
Expand All @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public function testErrorPassingBadData()
$this->expectException(TypeError::class);

new GetSubscriptionResponse(
error_list: [
errors: [
['test' => 'test'],
],
);
Expand Down

0 comments on commit 3911cdf

Please sign in to comment.