3030use Sabre \VObject \Component \VEvent ;
3131use Sabre \VObject \ITip \Message ;
3232use Test \TestCase ;
33+ use Test \Traits \EmailValidatorTrait ;
3334use function array_merge ;
3435
3536interface IMailServiceMock extends IMailService, IMailMessageSend {
@@ -38,6 +39,8 @@ interface IMailServiceMock extends IMailService, IMailMessageSend {
3839}
3940
4041class IMipPluginTest extends TestCase {
42+ use EmailValidatorTrait;
43+
4144 private IMessage &MockObject $ mailMessage ;
4245 private IMailer &MockObject $ mailer ;
4346 private IEMailTemplate &MockObject $ emailTemplate ;
@@ -107,6 +110,7 @@ protected function setUp(): void {
107110 $ this ->service ,
108111 $ this ->eventComparisonService ,
109112 $ this ->mailManager ,
113+ $ this ->getEmailValidatorWithStrictEmailCheck (),
110114 );
111115 }
112116
@@ -173,10 +177,6 @@ public function testParsingSingle(): void {
173177 $ this ->service ->expects (self ::once ())
174178 ->method ('getLastOccurrence ' )
175179 ->willReturn (1496912700 );
176- $ this ->mailer ->expects (self ::once ())
177- ->method ('validateMailAddress ' )
178- 179- ->willReturn (true );
180180 $ this ->eventComparisonService ->expects (self ::once ())
181181 ->method ('findModified ' )
182182 ->willReturn (['new ' => [$ newVevent ], 'old ' => [$ oldVEvent ]]);
@@ -280,10 +280,6 @@ public function testAttendeeIsResource(): void {
280280 $ this ->service ->expects (self ::once ())
281281 ->method ('getLastOccurrence ' )
282282 ->willReturn (1496912700 );
283- $ this ->mailer ->expects (self ::once ())
284- ->method ('validateMailAddress ' )
285- 286- ->willReturn (true );
287283 $ this ->eventComparisonService ->expects (self ::once ())
288284 ->method ('findModified ' )
289285 ->willReturn (['new ' => [$ newVevent ], 'old ' => [$ oldVEvent ]]);
@@ -358,10 +354,6 @@ public function testAttendeeIsCircle(): void {
358354 $ this ->service ->expects (self ::once ())
359355 ->method ('getLastOccurrence ' )
360356 ->willReturn (1496912700 );
361- $ this ->mailer ->expects (self ::once ())
362- ->method ('validateMailAddress ' )
363- 364- ->willReturn (true );
365357 $ this ->eventComparisonService ->expects (self ::once ())
366358 ->method ('findModified ' )
367359 ->willReturn (['new ' => [$ newVevent ], 'old ' => null ]);
@@ -463,10 +455,6 @@ public function testParsingRecurrence(): void {
463455 $ this ->service ->expects (self ::once ())
464456 ->method ('getLastOccurrence ' )
465457 ->willReturn (1496912700 );
466- $ this ->mailer ->expects (self ::once ())
467- ->method ('validateMailAddress ' )
468- 469- ->willReturn (true );
470458 $ this ->eventComparisonService ->expects (self ::once ())
471459 ->method ('findModified ' )
472460 ->willReturn (['old ' => [] ,'new ' => [$ newVevent ]]);
@@ -541,15 +529,11 @@ public function testEmailValidationFailed(): void {
541529 $ message->
message ->
VEVENT ->
add (
'ATTENDEE ' ,
'mailto: ' .
'[email protected] ' , [
'RSVP ' =>
'TRUE ' ]);
542530 $ message->
sender =
'mailto:[email protected] ' ;
543531 $ message ->senderName = 'Mr. Wizard ' ;
544- $ message->
recipient =
'mailto: ' .
'[email protected] ' ;
532+ $ message ->recipient = 'mailto: ' . 'frodo@@ hobb.it ' ;
545533
546534 $ this ->service ->expects (self ::once ())
547535 ->method ('getLastOccurrence ' )
548536 ->willReturn (1496912700 );
549- $ this ->mailer ->expects (self ::once ())
550- ->method ('validateMailAddress ' )
551- 552- ->willReturn (false );
553537
554538 $ this ->plugin ->schedule ($ message );
555539 $ this ->assertEquals ('5.0 ' , $ message ->getScheduleStatus ());
@@ -598,10 +582,6 @@ public function testFailedDelivery(): void {
598582 $ this ->service ->expects (self ::once ())
599583 ->method ('getLastOccurrence ' )
600584 ->willReturn (1496912700 );
601- $ this ->mailer ->expects (self ::once ())
602- ->method ('validateMailAddress ' )
603- 604- ->willReturn (true );
605585 $ this ->eventComparisonService ->expects (self ::once ())
606586 ->method ('findModified ' )
607587 ->willReturn (['old ' => [] ,'new ' => [$ newVevent ]]);
@@ -755,11 +735,6 @@ public function testMailProviderSend(): void {
755735 $ this ->eventComparisonService ->expects (self ::once ())
756736 ->method ('findModified ' )
757737 ->willReturn (['old ' => [] ,'new ' => [$ event ]]);
758- // construct mail mock returns
759- $ this ->mailer ->expects (self ::once ())
760- ->method ('validateMailAddress ' )
761- 762- ->willReturn (true );
763738 // construct mail provider mock returns
764739 $ this ->mailService
765740 ->method ('initiateMessage ' )
@@ -819,10 +794,6 @@ public function testMailProviderDisabled(): void {
819794 $ this ->service ->expects (self ::once ())
820795 ->method ('getLastOccurrence ' )
821796 ->willReturn (1496912700 );
822- $ this ->mailer ->expects (self ::once ())
823- ->method ('validateMailAddress ' )
824- 825- ->willReturn (true );
826797 $ this ->eventComparisonService ->expects (self ::once ())
827798 ->method ('findModified ' )
828799 ->willReturn (['new ' => [$ newVevent ], 'old ' => [$ oldVEvent ]]);
@@ -917,10 +888,6 @@ public function testNoOldEvent(): void {
917888 $ this ->service ->expects (self ::once ())
918889 ->method ('getLastOccurrence ' )
919890 ->willReturn (1496912700 );
920- $ this ->mailer ->expects (self ::once ())
921- ->method ('validateMailAddress ' )
922- 923- ->willReturn (true );
924891 $ this ->eventComparisonService ->expects (self ::once ())
925892 ->method ('findModified ' )
926893 ->with ($ newVCalendar , null )
@@ -1014,10 +981,6 @@ public function testNoButtons(): void {
1014981 $ this ->service ->expects (self ::once ())
1015982 ->method ('getLastOccurrence ' )
1016983 ->willReturn (1496912700 );
1017- $ this ->mailer ->expects (self ::once ())
1018- ->method ('validateMailAddress ' )
1019- 1020- ->willReturn (true );
1021984 $ this ->eventComparisonService ->expects (self ::once ())
1022985 ->method ('findModified ' )
1023986 ->with ($ newVCalendar , null )
0 commit comments