RoundCube Webmail
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
1.0 KiB

  1. <?php
  2. /**
  3. * Test class to test rcube_spoofchecker class
  4. *
  5. * @package Tests
  6. */
  7. class Framework_Spoofchecker extends PHPUnit\Framework\TestCase
  8. {
  9. /**
  10. * Test data for test_check()
  11. */
  12. function data_check()
  13. {
  14. return [
  15. // Valid:
  16. ['test@paypal.com', false],
  17. ['postbаnk@gmail.com', false], // ignore spoofed local part
  18. ['мон.мон', false],
  19. // Suspicious:
  20. ['test@Рaypal.com', true],
  21. ['test@postbаnk.com', true],
  22. ['aaa.мон', true],
  23. // TODO: Non-working as expected:
  24. // ['test@paypa1.com', true],
  25. // ['test@paypal' . "\xe2\x80\xa8" . '.com', true],
  26. // ['test@paypal' . "\xe2\x80\x8b" . '.com', true],
  27. // ['adoḅe.com', true], // ???????
  28. ];
  29. }
  30. /**
  31. * @dataProvider data_check
  32. */
  33. function test_check($email, $expected)
  34. {
  35. $this->assertSame($expected, rcube_spoofchecker::check($email));
  36. }
  37. }