File tree Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -67,6 +67,10 @@ private function validateRecipient(EmailComposer $composer)
6767
6868 $ recipients = (array ) $ composer ->getData ('recipient ' );
6969
70+ if (count ($ recipients ) == 0 ) {
71+ throw new InvalidArgumentException ('No recipient specified ' );
72+ }
73+
7074 foreach ($ recipients as $ recipient ) {
7175 if (! filter_var ($ recipient , FILTER_VALIDATE_EMAIL )) {
7276 throw new InvalidArgumentException ('E-mail address [ ' . $ recipient . '] is invalid ' );
Original file line number Diff line number Diff line change @@ -30,6 +30,18 @@ public function a_recipient_is_required()
3030 ->send ();
3131 }
3232
33+ /**
34+ * @test
35+ * @expectedException InvalidArgumentException
36+ * @expectedExceptionMessage No recipient specified
37+ */
38+ public function a_recipient_cannot_be_empty ()
39+ {
40+ Email::compose ()
41+ ->recipient ([])
42+ ->send ();
43+ }
44+
3345 /**
3446 * @test
3547 * @expectedException InvalidArgumentException
You can’t perform that action at this time.
0 commit comments