mirror of
https://framagit.org/framasoft/framadate/framadate
synced 2026-07-28 12:04:23 +00:00
new test for InputService -> filterMail
This commit is contained in:
parent
1d8244fd99
commit
599f3104f6
1 changed files with 41 additions and 0 deletions
41
app/tests/Framadate/Services/InputServiceUnitTest.php
Normal file
41
app/tests/Framadate/Services/InputServiceUnitTest.php
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
<?php
|
||||
namespace Framadate\Services;
|
||||
|
||||
use Framadate\FramaTestCase;
|
||||
|
||||
class InputServiceUnitTest extends FramaTestCase {
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @dataProvider liste_emails
|
||||
*/
|
||||
function test_filterMail($email, $expected)
|
||||
{
|
||||
|
||||
$inputService = new InputService();
|
||||
$filtered = $inputService->filterMail($email);
|
||||
|
||||
$this->assertSame($expected, $filtered);
|
||||
|
||||
}
|
||||
|
||||
|
||||
function liste_emails()
|
||||
{
|
||||
|
||||
return [
|
||||
// valids addresses
|
||||
"valid address" => ["example@example.com", "example@example.com"],
|
||||
"local address" => ["test@localhost", "test@localhost"],
|
||||
"IP address" => ["ip.email@127.0.0.1", "ip.email@127.0.0.1"],
|
||||
"with spaces arround" => [" with@spaces ", "with@spaces"],
|
||||
"unicode caracters" => ["unicode.éà@idn-œ.com", "unicode.éà@idn-œ.com"],
|
||||
// invalids addresses
|
||||
"without domain" => ["without-domain", FALSE],
|
||||
"space inside" => ["example @example.com", FALSE],
|
||||
"forbidden chars" => ["special_chars.)#@example.com", FALSE],
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue