File tree Expand file tree Collapse file tree 3 files changed +40
-1
lines changed Expand file tree Collapse file tree 3 files changed +40
-1
lines changed Original file line number Diff line number Diff line change @@ -87,7 +87,7 @@ private static function convertFromNative(iterable $data): iterable
8787
8888 break ;
8989 case 'firstName ' : // camelCase
90- case 'first_name ' : // snakeCase
90+ case 'first_name ' : // snake_case
9191 yield 'firstName ' => FirstName::fromNative ($ value );
9292
9393 break ;
Original file line number Diff line number Diff line change @@ -205,4 +205,30 @@ public function it_can_init_not_set_properties(): void
205205
206206 $ this ->assertSame (true , $ account ->active ->v );
207207 }
208+
209+ /**
210+ * @test
211+ */
212+ public function it_can_be_compared (): void
213+ {
214+ $ account = Account::fromNative ([
215+ 'firstName ' => FirstName::fromNative ('Jane ' ),
216+ 'lastName ' => 'Doe ' ,
217+ 'address ' => [
218+ 'street ' => 'Awesome Avenue ' ,
219+ ],
220+ 'active ' => false ,
221+ ]);
222+ $ account2 = Account::fromNative ([
223+ 'firstName ' => FirstName::fromNative ('Jane ' ),
224+ 'lastName ' => 'Doe ' ,
225+ 'address ' => [
226+ 'street ' => 'Awesome Avenue ' ,
227+ ],
228+ 'active ' => false ,
229+ ]);
230+
231+ $ this ->assertTrue ($ account ->equals ($ account2 ));
232+ $ this ->assertFalse ($ account ->equals ($ account2 ->with (['active ' => true ])));
233+ }
208234}
Original file line number Diff line number Diff line change @@ -37,4 +37,17 @@ public function it_can_be_created_from_native($value): void
3737 $ this ->assertSame ('2022-08-20T14:37:30+00:00 ' , $ cut ->toNative ());
3838 $ this ->assertInstanceOf (\DateTimeImmutable::class, $ cut ->v );
3939 }
40+
41+ /**
42+ * @test
43+ */
44+ public function it_can_be_compared (): void
45+ {
46+ $ cut = LastLogin::fromNative ('2022-08-20T14:37:30+00:00 ' );
47+ $ cut2 = LastLogin::fromNative ('2022-08-20T14:37:30+00:00 ' );
48+ $ cut3 = LastLogin::fromNative ('2022-10-20T14:37:30+00:00 ' );
49+
50+ $ this ->assertTrue ($ cut ->equals ($ cut2 ));
51+ $ this ->assertFalse ($ cut ->equals ($ cut3 ));
52+ }
4053}
You can’t perform that action at this time.
0 commit comments