|
19 | 19 | use OCP\IURLGenerator; |
20 | 20 | use OCP\L10N\IFactory; |
21 | 21 | use OCP\Mail\Events\BeforeMessageSent; |
| 22 | +use OCP\Mail\IEmailValidator; |
22 | 23 | use OCP\Server; |
23 | 24 | use PHPUnit\Framework\MockObject\MockObject; |
24 | 25 | use Psr\Log\LoggerInterface; |
@@ -61,7 +62,8 @@ protected function setUp(): void { |
61 | 62 | $this->urlGenerator, |
62 | 63 | $this->l10n, |
63 | 64 | $this->dispatcher, |
64 | | - $this->createMock(IFactory::class) |
| 65 | + $this->createMock(IFactory::class), |
| 66 | + $this->createMock(IEmailValidator::class), |
65 | 67 | ); |
66 | 68 | } |
67 | 69 |
|
@@ -181,7 +183,8 @@ public function testEvents(): void { |
181 | 183 | $this->urlGenerator, |
182 | 184 | $this->l10n, |
183 | 185 | $this->dispatcher, |
184 | | - $this->createMock(IFactory::class) |
| 186 | + $this->createMock(IFactory::class), |
| 187 | + $this->createMock(IEmailValidator::class), |
185 | 188 | ] |
186 | 189 | ) |
187 | 190 | ->getMock(); |
@@ -226,33 +229,6 @@ public function testSendInvalidMailException(): void { |
226 | 229 | $this->mailer->send($message); |
227 | 230 | } |
228 | 231 |
|
229 | | - /** |
230 | | - * @return array |
231 | | - */ |
232 | | - public static function mailAddressProvider(): array { |
233 | | - return [ |
234 | | - [ '[email protected]', true, false], |
235 | | - ['lukas@localhost', true, false], |
236 | | - [ '[email protected]', true, false], |
237 | | - ['lukas@éxämplè.com', true, false], |
238 | | - ['asdf', false, false], |
239 | | - ['', false, false], |
240 | | - [ '[email protected]@owncloud.com', false, false], |
241 | | - ['test@localhost', true, false], |
242 | | - ['test@localhost', false, true], |
243 | | - ]; |
244 | | - } |
245 | | - |
246 | | - #[\PHPUnit\Framework\Attributes\DataProvider('mailAddressProvider')] |
247 | | - public function testValidateMailAddress($email, $expected, $strict): void { |
248 | | - $this->config |
249 | | - ->expects($this->atMost(1)) |
250 | | - ->method('getAppValue') |
251 | | - ->with('core', 'enforce_strict_email_check') |
252 | | - ->willReturn($strict ? 'yes' : 'no'); |
253 | | - $this->assertSame($expected, $this->mailer->validateMailAddress($email)); |
254 | | - } |
255 | | - |
256 | 232 | public function testCreateEMailTemplate(): void { |
257 | 233 | $this->config->method('getSystemValueString') |
258 | 234 | ->with('mail_template_class', '') |
|
0 commit comments