@@ -19,6 +19,7 @@ final class EntityTest extends TestCase
19
19
'birthdate ' => Birthdate::class,
20
20
'phone_number ' => PhoneNumber::class,
21
21
'phone_numbers ' => PhoneNumbers::class,
22
+ 'notifications ' => Notifications::class,
22
23
];
23
24
24
25
public function testUserWithNoValues (): void
@@ -42,6 +43,7 @@ public function testUserWithNoValues(): void
42
43
self ::assertNull ($ row ['birthdate ' ]);
43
44
self ::assertNull ($ row ['contactPhoneNumber ' ]);
44
45
self ::assertNull ($ row ['phoneNumbers ' ]);
46
+ self ::assertNull ($ row ['notifications ' ]);
45
47
46
48
// fetch entity from database
47
49
/** @var User $user */
@@ -52,6 +54,7 @@ public function testUserWithNoValues(): void
52
54
self ::assertNull ($ user ->birthdate );
53
55
self ::assertNull ($ user ->contactPhoneNumber );
54
56
self ::assertNull ($ user ->phoneNumbers );
57
+ self ::assertNull ($ user ->notifications );
55
58
}
56
59
57
60
public function testUserWithAllValues (): void
@@ -66,6 +69,7 @@ public function testUserWithAllValues(): void
66
69
$ user ->phoneNumbers = new PhoneNumbers (
67
70
[new PhoneNumber ('+33455667788 ' ), new PhoneNumber ('+33233445566 ' )]
68
71
);
72
+ $ user ->notifications = new Notifications (true , false );
69
73
// save changes
70
74
$ entityManager ->persist ($ user );
71
75
$ entityManager ->flush ();
@@ -82,6 +86,7 @@ public function testUserWithAllValues(): void
82
86
self ::assertSame ('1986-11-17 00:00:00 ' , $ row ['birthdate ' ]);
83
87
self ::assertSame ('+33677889900 ' , $ row ['contactPhoneNumber ' ]);
84
88
self ::assertSame ('["+33455667788","+33233445566"] ' , $ row ['phoneNumbers ' ]);
89
+ self ::assertSame ('{"email":true,"sms":false} ' , $ row ['notifications ' ]);
85
90
86
91
// fetch entity from database
87
92
/** @var User $user */
@@ -95,6 +100,8 @@ public function testUserWithAllValues(): void
95
100
['+33455667788 ' , '+33233445566 ' ],
96
101
\array_map (fn (PhoneNumber $ number ) => $ number ->getNumber (), $ user ->phoneNumbers ->getNumbers ())
97
102
);
103
+ self ::assertTrue ($ user ->notifications ->isEmail ());
104
+ self ::assertFalse ($ user ->notifications ->isSms ());
98
105
}
99
106
100
107
private function manager (): EntityManager
0 commit comments