Skip to content

Commit

Permalink
Merge 8cec810 into 9e15e63
Browse files Browse the repository at this point in the history
  • Loading branch information
iKsSs committed Feb 6, 2024
2 parents 9e15e63 + 8cec810 commit 65e0f29
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
7 changes: 7 additions & 0 deletions tests/Fixtures/ObjectWithEnums.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,15 @@ class ObjectWithEnums
* @Serializer\Type("enum<'JMS\Serializer\Tests\Fixtures\Enum\Suit', 'name'>")
*/
public Suit $ordinary;

/**
* @Serializer\Type("enum<'JMS\Serializer\Tests\Fixtures\Enum\BackedSuit', 'value'>")
*/
public BackedSuit $backedValue;

/**
* @Serializer\Type("enum<'JMS\Serializer\Tests\Fixtures\Enum\BackedSuit'>")
*/
public BackedSuit $backed;

/**
Expand Down Expand Up @@ -46,6 +52,7 @@ public function __construct()
{
$this->ordinary = Suit::Clubs;

$this->backedValue = BackedSuit::Clubs;
$this->backed = BackedSuit::Clubs;

$this->backedArray = [BackedSuit::Clubs, BackedSuit::Hearts];
Expand Down
2 changes: 1 addition & 1 deletion tests/Serializer/JsonSerializationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ protected static function getContent($key)
$outputs['custom_datetimeinterface'] = '{"custom":"2021-09-07"}';
$outputs['data_integer'] = '{"data":10000}';
$outputs['uid'] = '"66b3177c-e03b-4a22-9dee-ddd7d37a04d5"';
$outputs['object_with_enums'] = '{"ordinary":"Clubs","backed":"C","ordinary_array":["Clubs","Spades"],"backed_array":["C","H"],"ordinary_auto_detect":"Clubs","backed_auto_detect":"C","backed_int_auto_detect":3,"backed_int":3,"backed_name":"C","backed_int_forced_str":3}';
$outputs['object_with_enums'] = '{"ordinary":"Clubs","backedValue":"C","backed":"C","ordinary_array":["Clubs","Spades"],"backed_array":["C","H"],"ordinary_auto_detect":"Clubs","backed_auto_detect":"C","backed_int_auto_detect":3,"backed_int":3,"backed_name":"C","backed_int_forced_str":3}';
$outputs['object_with_autodetect_enums'] = '{"ordinary_array_auto_detect":["Clubs","Spades"],"backed_array_auto_detect":["C","H"],"mixed_array_auto_detect":["Clubs","H"]}';
$outputs['object_with_enums_disabled'] = '{"ordinary_array_auto_detect":[{"name":"Clubs"},{"name":"Spades"}],"backed_array_auto_detect":[{"name":"Clubs","value":"C"},{"name":"Hearts","value":"H"}],"mixed_array_auto_detect":[{"name":"Clubs"},{"name":"Hearts","value":"H"}]}';
}
Expand Down
1 change: 1 addition & 0 deletions tests/Serializer/xml/object_with_enums.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<result>
<ordinary><![CDATA[Clubs]]></ordinary>
<backedValue><![CDATA[C]]></backedValue>
<backed><![CDATA[C]]></backed>
<ordinary_array>
<entry><![CDATA[Clubs]]></entry>
Expand Down

0 comments on commit 65e0f29

Please sign in to comment.