| 1 |  |  | <?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  | namespace Egulias\Tests\EmailValidator\Validation; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 5 |  |  | use Egulias\EmailValidator\EmailLexer; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 6 |  |  | use Egulias\EmailValidator\Validation\RFCValidation; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 7 |  |  | use Egulias\EmailValidator\Exception\AtextAfterCFWS; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 8 |  |  | use Egulias\EmailValidator\Exception\ConsecutiveAt; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 9 |  |  | use Egulias\EmailValidator\Exception\ConsecutiveDot; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 10 |  |  | use Egulias\EmailValidator\Exception\CRNoLF; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 11 |  |  | use Egulias\EmailValidator\Exception\DomainHyphened; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 12 |  |  | use Egulias\EmailValidator\Exception\DotAtEnd; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 13 |  |  | use Egulias\EmailValidator\Exception\DotAtStart; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 14 |  |  | use Egulias\EmailValidator\Exception\ExpectingATEXT; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 15 |  |  | use Egulias\EmailValidator\Exception\ExpectingDTEXT; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 16 |  |  | use Egulias\EmailValidator\Exception\NoDomainPart; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 17 |  |  | use Egulias\EmailValidator\Exception\NoLocalPart; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 18 |  |  | use Egulias\EmailValidator\Exception\UnclosedComment; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 19 |  |  | use Egulias\EmailValidator\Exception\UnclosedQuotedString; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 20 |  |  | use Egulias\EmailValidator\Exception\UnopenedComment; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 21 |  |  | use Egulias\EmailValidator\Warning\AddressLiteral; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 22 |  |  | use Egulias\EmailValidator\Warning\CFWSNearAt; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 23 |  |  | use Egulias\EmailValidator\Warning\CFWSWithFWS; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 24 |  |  | use Egulias\EmailValidator\Warning\Comment; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 25 |  |  | use Egulias\EmailValidator\Warning\DomainLiteral; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 26 |  |  | use Egulias\EmailValidator\Warning\DomainTooLong; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 27 |  |  | use Egulias\EmailValidator\Warning\IPV6BadChar; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 28 |  |  | use Egulias\EmailValidator\Warning\IPV6ColonEnd; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 29 |  |  | use Egulias\EmailValidator\Warning\IPV6ColonStart; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 30 |  |  | use Egulias\EmailValidator\Warning\IPV6Deprecated; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 31 |  |  | use Egulias\EmailValidator\Warning\IPV6DoubleColon; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 32 |  |  | use Egulias\EmailValidator\Warning\IPV6GroupCount; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 33 |  |  | use Egulias\EmailValidator\Warning\IPV6MaxGroups; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 34 |  |  | use Egulias\EmailValidator\Warning\LabelTooLong; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 35 |  |  | use Egulias\EmailValidator\Warning\LocalTooLong; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 36 |  |  | use Egulias\EmailValidator\Warning\ObsoleteDTEXT; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 37 |  |  | use Egulias\EmailValidator\Warning\QuotedString; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 38 |  |  | use PHPUnit\Framework\TestCase; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 39 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 40 |  |  | class RFCValidationTest extends TestCase | 
            
                                                                                                            
                            
            
                                    
            
            
                | 41 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 42 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 43 |  |  |      * @var RFCValidation | 
            
                                                                                                            
                            
            
                                    
            
            
                | 44 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 45 |  |  |     protected $validator; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 46 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 47 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 48 |  |  |      * @var EmailLexer | 
            
                                                                                                            
                            
            
                                    
            
            
                | 49 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 50 |  |  |     protected $lexer; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 51 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 52 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 53 |  |  |      * @before | 
            
                                                                                                            
                            
            
                                    
            
            
                | 54 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 55 |  |  |     public function before() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 56 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 57 |  |  |         $this->validator = new RFCValidation(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 58 |  |  |         $this->lexer = new EmailLexer(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 59 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 60 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 61 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 62 |  |  |      * @after | 
            
                                                                                                            
                            
            
                                    
            
            
                | 63 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 64 |  |  |     public function after() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 65 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 66 |  |  |         $this->validator = null; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 67 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 68 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 69 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 70 |  |  |      * @dataProvider getValidEmails | 
            
                                                                                                            
                            
            
                                    
            
            
                | 71 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 72 |  |  |     public function testValidEmails($email) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 73 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 74 |  |  |         $this->assertTrue($this->validator->isValid($email, $this->lexer)); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 75 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 76 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 77 |  |  |     public function getValidEmails() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 78 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 79 |  |  |         return array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 80 |  |  |             ['â@iana.org'], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 81 |  |  |             ['[email protected]'], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 82 |  |  |             ['[email protected]'], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 83 |  |  |             ['[email protected]'], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 84 |  |  |             ['example@localhost'], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 85 |  |  |             ['fab\'[email protected]'], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 86 |  |  |             ['fab\ [email protected]'], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 87 |  |  |             ['example((example))@fakedfake.co.uk'], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 88 |  |  |             ['example@faked(fake).co.uk'], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 89 |  |  |             ['[email protected]'], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 90 |  |  |             ['инфо@письмо.рф'], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 91 |  |  |             ['"username"@example.com'], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 92 |  |  |             ['"user,name"@example.com'], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 93 |  |  |             ['"user name"@example.com'], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 94 |  |  |             ['"user@name"@example.com'], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 95 |  |  |             ['"user\"name"@example.com'], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 96 |  |  |             ['"\a"@iana.org'], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 97 |  |  |             ['"test\ test"@iana.org'], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 98 |  |  |             ['""@iana.org'], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 99 |  |  |             ['"\""@iana.org'], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 100 |  |  |             ['müller@möller.de'], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 101 |  |  |             ['test@email*'], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 102 |  |  |             ['test@email!'], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 103 |  |  |             ['test@email&'], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 104 |  |  |             ['test@email^'], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 105 |  |  |             ['test@email%'], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 106 |  |  |             ['test@email$'], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 107 |  |  |             ["1500111@профи-инвест.рф"], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 108 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 109 |  |  |     } | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 110 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 111 |  |  |     public function testInvalidUTF8Email() | 
            
                                                                        
                            
            
                                    
            
            
                | 112 |  |  |     { | 
            
                                                                        
                            
            
                                    
            
            
                | 113 |  |  |         $email     = "\x80\x81\x82@\x83\x84\x85.\x86\x87\x88"; | 
            
                                                                        
                            
            
                                    
            
            
                | 114 |  |  |         $this->assertFalse($this->validator->isValid($email, $this->lexer)); | 
            
                                                                        
                            
            
                                    
            
            
                | 115 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 116 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 117 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 118 |  |  |      * @dataProvider getInvalidEmails | 
            
                                                                                                            
                            
            
                                    
            
            
                | 119 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 120 |  |  |     public function testInvalidEmails($email) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 121 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 122 |  |  |         $this->assertFalse($this->validator->isValid($email, $this->lexer)); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 123 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 124 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 125 |  |  |     public function getInvalidEmails() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 126 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 127 |  |  |         return [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 128 |  |  |             ['[email protected] test'], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 129 |  |  |             ['user  [email protected]'], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 130 |  |  |             ['user   [email protected]'], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 131 |  |  |             ['[email protected]'], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 132 |  |  |             ['example@[email protected]'], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 133 |  |  |             ['([email protected]]'], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 134 |  |  |             ['example(example][email protected]'], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 135 |  |  |             ['.example@localhost'], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 136 |  |  |             ['ex\ample@localhost'], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 137 |  |  |             ['example@local\host'], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 138 |  |  |             ['example@localhost\\'], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 139 |  |  |             ['example@localhost.'], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 140 |  |  |             ['user [email protected]'], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 141 |  |  |             ['username@ example . com'], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 142 |  |  |             ['example@(fake].com'], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 143 |  |  |             ['example@(fake.com'], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 144 |  |  |             ['username@example,com'], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 145 |  |  |             ['usern,[email protected]'], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 146 |  |  |             ['user[na][email protected]'], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 147 |  |  |             ['"""@iana.org'], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 148 |  |  |             ['"\"@iana.org'], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 149 |  |  |             ['"test"[email protected]'], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 150 |  |  |             ['"test""test"@iana.org'], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 151 |  |  |             ['"test"."test"@iana.org'], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 152 |  |  |             ['"test"[email protected]'], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 153 |  |  |             ['"test"' . chr(0) . '@iana.org'], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 154 |  |  |             ['"test\"@iana.org'], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 155 |  |  |             [chr(226) . '@iana.org'], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 156 |  |  |             ['test@' . chr(226) . '.org'], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 157 |  |  |             ['\r\[email protected]'], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 158 |  |  |             ['\r\n [email protected]'], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 159 |  |  |             ['\r\n \r\[email protected]'], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 160 |  |  |             ['\r\n \r\[email protected]'], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 161 |  |  |             ['\r\n \r\n [email protected]'], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 162 |  |  |             ['[email protected] \r\n'], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 163 |  |  |             ['[email protected] \r\n '], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 164 |  |  |             ['[email protected] \r\n \r\n'], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 165 |  |  |             ['[email protected] \r\n\r\n'], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 166 |  |  |             ['[email protected]  \r\n\r\n '], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 167 |  |  |             ['test@iana/icann.org'], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 168 |  |  |             ['test@foo;bar.com'], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 169 |  |  |             ['test;[email protected]'], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 170 |  |  |             ['[email protected]'], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 171 |  |  |             ['email.email@email."'], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 172 |  |  |             ['test@email>'], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 173 |  |  |             ['test@email<'], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 174 |  |  |             ['test@email{'], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 175 |  |  |             ['test@ '], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 176 |  |  |         ]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 177 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 178 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 179 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 180 |  |  |      * @dataProvider getInvalidEmailsWithErrors | 
            
                                                                                                            
                            
            
                                    
            
            
                | 181 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 182 |  |  |     public function testInvalidEmailsWithErrorsCheck($error, $email) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 183 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 184 |  |  |         $this->assertFalse($this->validator->isValid($email, $this->lexer)); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 185 |  |  |         $this->assertEquals($error, $this->validator->getError()); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 186 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 187 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 188 |  |  |     public function getInvalidEmailsWithErrors() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 189 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 190 |  |  |         return [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 191 |  |  |             [new NoLocalPart(), '@example.co.uk'], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 192 |  |  |             [new NoDomainPart(), 'example@'], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 193 |  |  |             [new DomainHyphened(), '[email protected]'], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 194 |  |  |             [new DomainHyphened(), 'example@example-'], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 195 |  |  |             [new ConsecutiveAt(), 'example@@example.co.uk'], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 196 |  |  |             [new ConsecutiveDot(), '[email protected]'], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 197 |  |  |             [new ConsecutiveDot(), '[email protected]'], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 198 |  |  |             [new ExpectingATEXT(), '<example_example>@example.fr'], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 199 |  |  |             [new DotAtStart(), '.example@localhost'], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 200 |  |  |             [new DotAtStart(), '[email protected]'], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 201 |  |  |             [new DotAtEnd(), 'example@localhost.'], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 202 |  |  |             [new DotAtEnd(), '[email protected]'], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 203 |  |  |             [new UnclosedComment(), '(example@localhost'], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 204 |  |  |             [new UnclosedQuotedString(), '"example@localhost'], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 205 |  |  |             [new ExpectingATEXT(), 'exa"mple@localhost'], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 206 |  |  |             [new UnclosedComment(), '(example@localhost'], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 207 |  |  |             [new UnopenedComment(), 'comment)example@localhost'], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 208 |  |  |             [new UnopenedComment(), 'example(comment))@localhost'], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 209 |  |  |             [new UnopenedComment(), 'example@comment)localhost'], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 210 |  |  |             [new UnopenedComment(), 'example@localhost(comment))'], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 211 |  |  |             [new UnopenedComment(), 'example@(comment))example.com'], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 212 |  |  |             //This was the original. But atext is not allowed after \n | 
            
                                                                                                            
                            
            
                                    
            
            
                | 213 |  |  |             //array(EmailValidator::ERR_EXPECTING_ATEXT, "exampl\[email protected]"), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 214 |  |  |             [new AtextAfterCFWS(), "exampl\[email protected]"], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 215 |  |  |             [new ExpectingDTEXT(), "example@[[]"], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 216 |  |  |             [new AtextAfterCFWS(), "exampl\[email protected]"], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 217 |  |  |             [new CRNoLF(), "example@exa\rmple.co.uk"], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 218 |  |  |             [new CRNoLF(), "example@[\r]"], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 219 |  |  |             [new CRNoLF(), "exam\[email protected]"], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 220 |  |  |         ]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 221 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 222 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 223 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 224 |  |  |      * @dataProvider getInvalidEmailsWithWarnings | 
            
                                                                                                            
                            
            
                                    
            
            
                | 225 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 226 |  |  |     public function testInvalidEmailsWithWarningsCheck($expectedWarnings, $email) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 227 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 228 |  |  |         $this->assertTrue($this->validator->isValid($email, $this->lexer)); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 229 |  |  |         $warnings = $this->validator->getWarnings(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 230 |  |  |         $this->assertCount( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 231 |  |  |             count($warnings), $expectedWarnings, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 232 |  |  |             "Expected: " . implode(",", $expectedWarnings) . " and got " . implode(",", $warnings) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 233 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 234 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 235 |  |  |         foreach ($warnings as $warning) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 236 |  |  |             $this->assertArrayHasKey($warning->code(), $expectedWarnings); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 237 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 238 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 239 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 240 |  |  |     public function getInvalidEmailsWithWarnings() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 241 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 242 |  |  |         return [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 243 |  |  |             [[CFWSNearAt::CODE], 'example @invalid.example.com'], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 244 |  |  |             [[CFWSNearAt::CODE], 'example@ invalid.example.com'], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 245 |  |  |             [[Comment::CODE], '[email protected](examplecomment).com'], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 246 |  |  |             [[Comment::CODE,CFWSNearAt::CODE], 'example(examplecomment)@invalid.example.com'], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 247 |  |  |             [[QuotedString::CODE, CFWSWithFWS::CODE,], "\"\t\"@invalid.example.com"], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 248 |  |  |             [[QuotedString::CODE, CFWSWithFWS::CODE,], "\"\r\"@invalid.example.com"], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 249 |  |  |             [[AddressLiteral::CODE,], 'example@[127.0.0.1]'], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 250 |  |  |             [[AddressLiteral::CODE,], 'example@[IPv6:2001:0db8:85a3:0000:0000:8a2e:0370:7334]'], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 251 |  |  |             [[AddressLiteral::CODE, IPV6Deprecated::CODE], 'example@[IPv6:2001:0db8:85a3:0000:0000:8a2e:0370::]'], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 252 |  |  |             [[AddressLiteral::CODE, IPV6MaxGroups::CODE,], 'example@[IPv6:2001:0db8:85a3:0000:0000:8a2e:0370:7334::]'], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 253 |  |  |             [[AddressLiteral::CODE, IPV6DoubleColon::CODE,], 'example@[IPv6:1::1::1]'], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 254 |  |  |             [[ObsoleteDTEXT::CODE, DomainLiteral::CODE,], "example@[\n]"], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 255 |  |  |             [[DomainLiteral::CODE,], 'example@[::1]'], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 256 |  |  |             [[DomainLiteral::CODE,], 'example@[::123.45.67.178]'], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 257 |  |  |             [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 258 |  |  |                 [IPV6ColonStart::CODE, AddressLiteral::CODE, IPV6GroupCount::CODE,], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 259 |  |  |                 'example@[IPv6::2001:0db8:85a3:0000:0000:8a2e:0370:7334]' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 260 |  |  |             ], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 261 |  |  |             [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 262 |  |  |                 [AddressLiteral::CODE, IPV6BadChar::CODE,], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 263 |  |  |                 'example@[IPv6:z001:0db8:85a3:0000:0000:8a2e:0370:7334]' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 264 |  |  |             ], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 265 |  |  |             [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 266 |  |  |                 [AddressLiteral::CODE, IPV6ColonEnd::CODE,], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 267 |  |  |                 'example@[IPv6:2001:0db8:85a3:0000:0000:8a2e:0370:]' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 268 |  |  |             ], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 269 |  |  |             [[QuotedString::CODE,], '"example"@invalid.example.com'], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 270 |  |  |             [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 271 |  |  |                 [LocalTooLong::CODE,], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 272 |  |  |                 'too_long_localpart_too_long_localpart_too_long_localpart_too_long_localpart@invalid.example.com' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 273 |  |  |             ], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 274 |  |  |             [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 275 |  |  |                 [LabelTooLong::CODE,], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 276 |  |  |                 'example@toolonglocalparttoolonglocalparttoolonglocalparttoolonglocalpart.co.uk' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 277 |  |  |             ], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 278 |  |  |             [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 279 |  |  |                 [DomainTooLong::CODE, LabelTooLong::CODE,], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 280 |  |  |                 'example2@toolonglocalparttoolonglocalparttoolonglocalparttoolonglocalparttoolonglocalparttoolonglocal'. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 281 |  |  |                 'parttoolonglocalparttoolonglocalparttoolonglocalparttoolonglocalparttoolonglocalparttoolonglocalpart'. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 282 |  |  |                 'toolonglocalparttoolonglocalparttoolonglocalparttoolonglocalpart' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 283 |  |  |             ], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 284 |  |  |             [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 285 |  |  |                 [DomainTooLong::CODE, LabelTooLong::CODE,], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 286 |  |  |                 'example@toolonglocalparttoolonglocalparttoolonglocalparttoolonglocalparttoolonglocalparttoolonglocal'. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 287 |  |  |                 'parttoolonglocalparttoolonglocalparttoolonglocalparttoolonglocalparttoolonglocalparttoolonglocalpart'. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 288 |  |  |                 'toolonglocalparttoolonglocalparttoolonglocalparttoolonglocalpar' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 289 |  |  |             ], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 290 |  |  |         ]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 291 |  |  |     } | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 292 |  |  | } | 
            
                                                        
            
                                    
            
            
                | 293 |  |  |  |