Files
postfixadmin/tests/RecipientDelimiterTest.php
Rodrigo Cortés Cano 8995ee7b55 Support multiple recipient delimiters (#1178)
- treat recipient_delimiter as a set of alternative characters, matching Postfix semantics
- centralize recipient-extension removal so alias status and mailbox classification cannot diverge
- restrict delimiter matching to the local part and document multi-character configuration
- add focused unit and alias-status regression coverage

See #1143
Thanks @TrapoSAMA
2026-10-15 19:26:09 +01:00

28 lines
1.3 KiB
PHP

<?php
class RecipientDelimiterTest extends \PHPUnit\Framework\TestCase
{
#[\PHPUnit\Framework\Attributes\DataProvider('addressProvider')]
public function testBaseAddress(string $address, string $delimiters, string $expected): void
{
self::assertSame($expected, recipient_delimiter_base_address($address, $delimiters));
}
public static function addressProvider(): array
{
return [
'disabled' => ['user+tag@example.com', '', 'user+tag@example.com'],
'single delimiter' => ['user+tag@example.com', '+', 'user@example.com'],
'multiple delimiters plus' => ['user+tag@example.com', '+.', 'user@example.com'],
'multiple delimiters dot' => ['user.tag@example.com', '+.', 'user@example.com'],
'first delimiter wins' => ['user+tag.more@example.com', '+.', 'user@example.com'],
'regex-special delimiter' => ['user]tag@example.com', ']-', 'user@example.com'],
'delimiter only in domain' => ['user@example.test', '.', 'user@example.test'],
'address without domain' => ['user+tag', '+', 'user+tag'],
'address without extension' => ['user@example.com', '+.', 'user@example.com'],
];
}
}
/* vim: set expandtab softtabstop=4 tabstop=4 shiftwidth=4: */