assertEquals('d29yZA', Text::base64UrlEncode('word'), 'text-b64-enc-1'); $this->assertEquals('d29yZHM', Text::base64UrlEncode('words'), 'text-b64-enc-2'); $this->assertEquals('wordy', Text::base64UrlDecode('d29yZHm'), 'text-b64-dec'); $this->assertEquals( 'match', Text::base64UrlDecode(Text::base64UrlEncode('match')), 'text-b64-round-trip' ); } public static function dataParse(): array { return [ ['text-parse-code', 'abc', '[code]abc[/code]'], ['text-parse-important', 'def', '[important]def[/important]'], ['text-parse-pad', 'abc', '[pad=10px]abc[/pad]'], ['text-parse-pre', '
abc
', '[pre]abc[/pre]'], ['text-parse-strong', 'abc', '[b]abc[/b]'], [ 'text-parse-align', '
abc
', '[align=center]abc[/align]' ], [ 'text-parse-artist', 'abc', '[artist]abc[/artist]'], [ 'text-parse-color', 'abc', '[color=#feabac]abc[/color]' ], [ 'text-parse-img', '', '[img]http://to.be/some.jpg[/img]', ], [ 'text-parse-italic', 'def', '[i]def[/i]' ], [ 'text-parse-ol', '
  1. abc
  2. def
', "[#]abc\n[#]def\n", ], [ 'text-parse-para', '

abc

def

', "abc\ndef\n", ], [ 'text-parse-quote', "abc wrote:
many words
", "[quote=abc]many words[/quote]", ], [ 'text-parse-size', 'abc', '[size=7]abc[/size]', ], [ 'text-parse-spoiler', 'abc: Show', '[spoiler=abc]def[/spoiler]', ], [ 'text-parse-ul', '', "[*]abc\n[*]def\n", ], [ 'text-parse-underline', 'abc', '[u]abc[/u]' ], [ 'text-parse-url', 'text', '[url=http://to.be/some.html]text[/url]' ], [ 'text-parse-user', 'abc', '[user]abc[/user]' ], ]; } #[DataProvider('dataParse')] public function testParseHtml(string $name, string $html, string $expected): void { $this->assertEquals($expected, Text::parseHtml($html), $name); } }