@@ -231,6 +231,17 @@ public function from_array_throws_exception_when_to_is_not_array_or_string(): vo
231231 ]);
232232 }
233233
234+ #[Test]
235+ public function from_array_throws_exception_when_rich_content_is_not_array (): void
236+ {
237+ $ this ->expectException (TypeError::class);
238+
239+ PushMessage::fromArray ([
240+ 'to ' => 'ExponentPushToken[xxxxxxxxxxxxxxxxxxxxxx] ' ,
241+ 'richContent ' => 'not-an-array ' ,
242+ ]);
243+ }
244+
234245 #[Test]
235246 public function from_array_converts_priority_to_enum (): void
236247 {
@@ -242,6 +253,17 @@ public function from_array_converts_priority_to_enum(): void
242253 $ this ->assertSame (Priority::High, $ message ->priority );
243254 }
244255
256+ #[Test]
257+ public function from_array_throws_exception_when_priority_is_not_valid (): void
258+ {
259+ $ this ->expectException (TypeError::class);
260+
261+ PushMessage::fromArray ([
262+ 'to ' => 'ExponentPushToken[xxxxxxxxxxxxxxxxxxxxxx] ' ,
263+ 'priority ' => [],
264+ ]);
265+ }
266+
245267 #[Test]
246268 public function from_array_converts_interruption_level_to_enum (): void
247269 {
@@ -253,6 +275,17 @@ public function from_array_converts_interruption_level_to_enum(): void
253275 $ this ->assertSame (InterruptionLevel::Critical, $ message ->interruptionLevel );
254276 }
255277
278+ #[Test]
279+ public function from_array_throws_exception_when_interruption_level_is_not_valid (): void
280+ {
281+ $ this ->expectException (TypeError::class);
282+
283+ PushMessage::fromArray ([
284+ 'to ' => 'ExponentPushToken[xxxxxxxxxxxxxxxxxxxxxx] ' ,
285+ 'interruptionLevel ' => [],
286+ ]);
287+ }
288+
256289 #[Test]
257290 public function from_json_returns_instance (): void
258291 {
0 commit comments