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)
67
67
68
68
$ recipients = (array ) $ composer ->getData ('recipient ' );
69
69
70
+ if (count ($ recipients ) == 0 ) {
71
+ throw new InvalidArgumentException ('No recipient specified ' );
72
+ }
73
+
70
74
foreach ($ recipients as $ recipient ) {
71
75
if (! filter_var ($ recipient , FILTER_VALIDATE_EMAIL )) {
72
76
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()
30
30
->send ();
31
31
}
32
32
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
+
33
45
/**
34
46
* @test
35
47
* @expectedException InvalidArgumentException
You can’t perform that action at this time.
0 commit comments