Skip to content

Commit

Permalink
test: add tests for Ds\Collection normalization
Browse files Browse the repository at this point in the history
  • Loading branch information
simPod authored and romm committed Jun 6, 2024
1 parent 436e3c2 commit c481b07
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/mutation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-latest
env:
php-version: '8.1'
php-extensions: yaml
php-extensions: ds,yaml
steps:
- name: Checkout
uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- "8.3"

env:
php-extensions: yaml
php-extensions: ds,yaml
steps:
- name: Checkout
uses: actions/checkout@v3
Expand Down
18 changes: 18 additions & 0 deletions tests/Integration/Normalizer/NormalizerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,24 @@ public static function normalize_basic_values_yields_expected_output_data_provid
'expected json' => '{"foo":"foo","bar":"bar"}',
];

yield 'Ds Map' => [
'input' => new \Ds\Map(['foo' => 'foo', 'bar' => 'bar']),
'expected array' => [
'foo' => 'foo',
'bar' => 'bar',
],
'expected json' => '{"foo":"foo","bar":"bar"}',
];

yield 'Ds Set' => [
'input' => new \Ds\Set(['foo', 'bar']),
'expected array' => [
0 => 'foo',
1 => 'bar',
],
'expected json' => '["foo","bar"]',
];

yield 'class inheriting ArrayObject' => [
'input' => new class (['foo' => 'foo', 'bar' => 'bar']) extends ArrayObject {},
'expected array' => [
Expand Down

1 comment on commit c481b07

@simPod
Copy link
Contributor Author

@simPod simPod commented on c481b07 Jul 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, since Ds Map can have objects as keys, I'll have to adapt it a bit.

Please sign in to comment.