*/ public static function normalizeHandleProvider(): array { return [ 'null stays null' => [null, null], 'already normalized' => ['alice.pds.test', 'alice.pds.test'], 'trim and lowercase' => [' Alice.PDS.Test ', 'alice.pds.test'], 'tabs and newlines are trimmed' => ["\tBob.PDS.Test\n", 'bob.pds.test'], 'whitespace only becomes empty' => [' ', ''], ]; } /** * @dataProvider normalizeHandleProvider */ #[DataProvider('normalizeHandleProvider')] public function testNormalizeHandle(?string $input, ?string $expected): void { $this->assertSame($expected, StringNormalizer::normalizeHandle($input)); } /** * @return array */ public static function normalizeEmailProvider(): array { return [ 'already normalized' => ['alice@example.com', 'alice@example.com'], 'trim and lowercase' => [' Alice+Tag@Example.COM ', 'alice+tag@example.com'], 'tabs and newlines are trimmed' => ["\tbob@Example.COM\n", 'bob@example.com'], 'whitespace only becomes empty' => [' ', ''], ]; } /** * @dataProvider normalizeEmailProvider */ #[DataProvider('normalizeEmailProvider')] public function testNormalizeEmail(string $input, string $expected): void { $this->assertSame($expected, StringNormalizer::normalizeEmail($input)); } }