mirror of
https://github.com/roundcube/roundcubemail.git
synced 2026-03-10 01:56:48 +01:00
* fix "class_attributes_separation" * fix "ternary_to_null_coalescing" * fix "no_extra_blank_lines" * fix "php_unit_data_provider_name" - use snake_case * fix remaining "function data_" manually * move "php_unit_test_case_static_method_calls" to a better place in cnf * fix 3.47.1 CS
40 lines
1.0 KiB
PHP
40 lines
1.0 KiB
PHP
<?php
|
||
|
||
/**
|
||
* Test class to test rcube_spoofchecker class
|
||
*/
|
||
class Framework_Spoofchecker extends PHPUnit\Framework\TestCase
|
||
{
|
||
/**
|
||
* Test data for test_check()
|
||
*/
|
||
public 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));
|
||
}
|
||
}
|