mirror of
https://github.com/FOSSBilling/FOSSBilling.git
synced 2026-11-03 10:36:49 +09:00
* Include domain name in invoice lines and order titles (#4286) * Reject multi-label and overlong ACE SLDs in isSldValid * Build longest-valid-label fixture dynamically for spellcheck * Reject overlong own-domain values in getDomainFromConfig * Resolve owndomain tuple from flat config with nested fallback
73 lines
1.9 KiB
PHP
73 lines
1.9 KiB
PHP
<?php
|
|
|
|
/**
|
|
* Copyright 2022-2026 FOSSBilling
|
|
* SPDX-License-Identifier: Apache-2.0.
|
|
*
|
|
* @copyright FOSSBilling (https://www.fossbilling.org)
|
|
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache-2.0
|
|
*/
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Tests\Datasets;
|
|
|
|
/**
|
|
* Email validation test data.
|
|
*
|
|
* @return array<int, array{0: string, 1: bool}>
|
|
*/
|
|
function emailProvider(): array
|
|
{
|
|
return [
|
|
// Valid emails
|
|
['test@example.com', true],
|
|
['test.user@example.com', true],
|
|
['test+tag@example.com', true],
|
|
['test@subdomain.example.com', true],
|
|
['test@example.co.uk', true],
|
|
['user@domain.org', true],
|
|
['user123@domain.com', true],
|
|
['first.last@domain.io', true],
|
|
// Invalid emails
|
|
['invalid', false],
|
|
['test@', false],
|
|
['@example.com', false],
|
|
['test example.com', false],
|
|
['test@@example.com', false],
|
|
['test@.com', false],
|
|
['', false],
|
|
];
|
|
}
|
|
|
|
/**
|
|
* Second-level domain validation test data.
|
|
*
|
|
* @return array<int, array{0: string, 1: bool}>
|
|
*/
|
|
function domainProvider(): array
|
|
{
|
|
return [
|
|
// Valid SLDs
|
|
['google', true],
|
|
['example-domain', true],
|
|
['a1', true],
|
|
['123', true],
|
|
['xn--bcher-kva', true], // Internationalized domain
|
|
['xn--td' . str_repeat('a', 57), true], // 63 chars, the longest valid label
|
|
['subdomain', true],
|
|
['my-domain', true],
|
|
// Invalid SLDs
|
|
['qqq45%%%', false],
|
|
['()1google', false],
|
|
['//asdasd()()', false],
|
|
['--asdasd()()', false],
|
|
['', false],
|
|
['sub.domain.example', false], // SLD cannot contain dots
|
|
['xn--foo.bar', false], // ACE SLD cannot contain dots either
|
|
['xn--' . str_repeat('a', 60), false], // 64 chars, exceeds the longest valid label
|
|
['-invalid', false],
|
|
['invalid-', false],
|
|
];
|
|
}
|