File tree Expand file tree Collapse file tree 3 files changed +14
-2
lines changed
Expand file tree Collapse file tree 3 files changed +14
-2
lines changed Original file line number Diff line number Diff line change 2727 },
2828 "require-dev" : {
2929 "codeigniter4/codeigniter4" : " dev-develop" ,
30- "tatter/imposter" : " ^1.0" ,
3130 "tatter/tools" : " ^1.15"
3231 },
3332 "autoload" : {
Original file line number Diff line number Diff line change 33namespace Tatter \Outbox \Entities ;
44
55use CodeIgniter \Entity \Entity ;
6+ use RuntimeException ;
67
78class Email extends Entity
89{
@@ -58,11 +59,13 @@ public function getRecipients(): array
5859 * Helper function to return attachments or recipients.
5960 *
6061 * @param string $target Object/table/model to request
62+ *
63+ * @throws RuntimeException
6164 */
6265 protected function getRelatedItems (string $ target ): array
6366 {
6467 if (empty ($ this ->id )) {
65- throw new \ RuntimeException ('Object must be created before getting relations. ' );
68+ throw new RuntimeException ('Object must be created before getting relations. ' );
6669 }
6770
6871 $ property = $ target . 's ' ;
Original file line number Diff line number Diff line change @@ -57,4 +57,14 @@ public function testGetRecipients()
5757 $ this ->assertInstanceOf (Recipient::class, $ result [0 ]);
5858 $ this ->
assertSame (
'[email protected] ' ,
$ result[
0 ]->
email );
5959 }
60+
61+ public function testGetRelatedUncreatedThrows ()
62+ {
63+ $ email = new Email ();
64+
65+ $ this ->expectException ('RuntimeException ' );
66+ $ this ->expectExceptionMessage ('Object must be created before getting relations. ' );
67+
68+ $ email ->getRecipients ();
69+ }
6070}
You can’t perform that action at this time.
0 commit comments