Files
roundcubemail/tests/Framework/Spoofchecker.php
Michael Voříšek 332c165d28 Fix some basic JS CS (#9328)
* fix "nonblock-statement-body-position" (fixed already)

* fix "comma-dangle"

* fix "no-regex-spaces"

* fix "new-parens"

* fix "object-curly-newline"

* fix "object-property-newline"

* fix "spaced-comment" semimanually

* fix "no-constant-condition" manually

* fix "unicorn/no-hex-escape"

* fix "unicorn/escape-case"

* fix "quote-props"

* fix "no-whitespace-before-property" - fix bug/typo

* fix "unicorn/empty-brace-spaces"

* fix "keyword-spacing"

* fix "dot-notation"

* fix "no-return-assign" manually

* fix "padding-line-between-statements"

* fix "key-spacing"

* fix "no-else-return" semimanually

* fix some "no-undef"

* fix case cs

* Revert "fix "padding-line-between-statements""

* improve switch/case format I.

* improve switch/case format II.

regex: (^ *(break|return).*)\n *(\n)

* fix safe "eqeqeq"

* fix "radix"

* fix v3.49.0 CS (static providers)

* fix "string_implicit_backslashes" in php files

* fix comments align

* fix test static providers

* fix stan

* disable "final_internal_class" rule
2024-02-06 08:28:19 +01:00

42 lines
1.0 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
use PHPUnit\Framework\TestCase;
/**
* Test class to test rcube_spoofchecker class
*/
class Framework_Spoofchecker extends TestCase
{
/**
* Test data for test_check()
*/
public static function provide_check_cases(): iterable
{
return [
// Valid:
['test@paypal.com', false],
['postbаnk@gmail.com', false], // ignore spoofed local part
['мон.мон', false],
// Suspicious:
['test@Рaypal.com', true],
['test@postbаnk.com', true],
['aaa.мон', true],
// TODO: Non-working as expected:
// ['test@paypa1.com', true],
// ['test@paypal' . "\xe2\x80\xa8" . '.com', true],
// ['test@paypal' . "\xe2\x80\x8b" . '.com', true],
// ['adoḅe.com', true], // ???????
];
}
/**
* @dataProvider provide_check_cases
*/
public function test_check($email, $expected)
{
$this->assertSame($expected, rcube_spoofchecker::check($email));
}
}