Skip to content

Commit

Permalink
Improve test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
keithbrink committed Nov 14, 2024
1 parent a104c38 commit ff9824a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 0 additions & 2 deletions src/Data/Base/TypedCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,6 @@ public function toArrayObject(
): \ArrayObject {
return new \ArrayObject($this->map(function ($item) use ($case) {
return match (true) {
$item instanceof TypedCollection => $item->toArrayObject(case: $case),
$item instanceof Collection => $item->toArrayObject(),
$item instanceof Data => $item->toArrayObject(case: $case),
$item instanceof BackedEnum => $item->value,
default => $item,
Expand Down
7 changes: 7 additions & 0 deletions tests/Unit/Data/Base/TypedCollectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
namespace Jasara\AmznSPA\Tests\Unit\Data\Base;

use Jasara\AmznSPA\Data\Base\TypedCollection;
use Jasara\AmznSPA\Data\Schemas\FulfillmentInbound\v20240320\PrepType;
use Jasara\AmznSPA\Data\Schemas\FulfillmentInbound\v20240320\PrepTypeList;
use Jasara\AmznSPA\Data\Schemas\Tokens\RestrictedResourceSchema;
use Jasara\AmznSPA\Data\Schemas\Tokens\RestrictedResourcesListSchema;
use Jasara\AmznSPA\Tests\Unit\UnitTestCase;
Expand Down Expand Up @@ -110,5 +112,10 @@ public function testToArrayObject(): void

$this->assertEquals('GET', $array_object[0]['method']);
$this->assertEquals('/path', $array_object[0]['path']);

$enum = PrepType::Sharp;
$collection = new PrepTypeList([$enum]);
$array_object = $collection->toArrayObject();
$this->assertEquals($enum->value, $array_object[0]);
}
}

0 comments on commit ff9824a

Please sign in to comment.