Skip to content

Commit 06c5b89

Browse files
committed
add tests withGroups
1 parent 97ea735 commit 06c5b89

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

tests/Serialize/From/GroupFromSerializeTest.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,3 +90,25 @@ class OtherObject
9090
;
9191

9292
});
93+
94+
it('test with groups Serialize class', function () {
95+
$instance = TestGroupSerialize::from(
96+
not_construct_string:'not_construct_string',
97+
not_construct_int:'001',
98+
type_string:'111',
99+
type_int:99999,
100+
type_object:new OtherObject(),
101+
type_null:123,
102+
type_float:998,
103+
abc: 110
104+
);
105+
106+
$res = $instance->withGroups(['test_1'])->toArray();
107+
expect($res['not_construct_string'])->toBeString('not_construct_string')
108+
->and($res['type_string'])->toBeString('001')
109+
->and($res['type_string_ignore'])->toBeString('')
110+
->and(isset($res['not_construct_int']))->toBeFalse()
111+
->and(isset($res['type_int']))->toBeFalse()
112+
->and(isset($res['type_object']))->toBeFalse()
113+
->and(isset($res['type_float']))->toBeFalse();
114+
});

0 commit comments

Comments
 (0)