assertEquals($expected, Text::full_format($bbcode), $name);
}
public function dataTeX(): array {
return [
['text-tex-basic', '[tex]some formula[/tex]', '";
$url = 'https://www.example.com/';
$user = (new Gazelle\Manager\User)->find('@user');
return [
["text-align-l", "[align=left]o[/align]", "
ab
\ncd"],
["text-color-name", "[color=cornsilk]pink[/color]", "pink"],
["text-color-hash", "[color=#c0ffee]black[/color]", "black"],
["text-colour", "[colour=gold]pink[/colour]", "pink"],
["text-headline", "[headline]abc[/headline]", "=abc="],
["text-hr", "[hr]", "a"], ["text-quote-n", "[quote]a[/quote]", "
\nb
a"], ["text-quote-y", "[quote=phpunit]a[/quote]", "phpunit wrote:
a"], ["text-rule", "[rule]1[/rule]", "1"], ["text-s", "[s]sss[/s]", "sss"], ["text-size", "[size=4]big[/size]", "big"], ["text-s", "[s]sss[/s]", "sss"], ["text-u", "[u]uuu[/u]", "uuu"], ["text-url", $url, "https://www.example.com/"], ["text-hide", "[hide]secret[/hide]", "Hidden text: Show
secret" ], ["text-mature", "[mature]titties[/mature]", "Mature content has been blocked. You can choose to view mature content by editing your id()}\">settings." ], ["text-spoiler", "[spoiler]surprise[/spoiler]", "Hidden text: Show
surprise" ], ["text-user-1", "[user]user[/user]", "user"], ["text-user-2", "@user", "id()}\">@user"], ["text-user-3", "@user.", "id()}\">@user."], ["text-emoji", ":nod:", "
abc xyz defghi" ], ]; } public function testCollage(): void { $admin = (new Gazelle\Manager\User)->find('@admin'); $name = 'collage ' . randomString(6); $collage = (new Gazelle\Manager\Collage)->create($admin, 1, $name, 'phpunit collage', 'jazz,disco', new Gazelle\Log); $this->assertInstanceOf(Gazelle\Collage::class, $collage, 'text-create-collage'); $this->assertEquals( "id()}\">{$collage->name()}", Text::full_format("[collage]{$collage->id()}[/collage]"), 'text-collage-bb' ); $this->assertEquals( "id()}\">{$collage->name()}", Text::full_format($collage->publicUrl()), 'text-collage-url' ); $this->assertEquals(1, $collage->remove(), 'text-remove-collage'); } public function testForum(): void { Text::setViewer((new Gazelle\Manager\User)->find('@admin')); $name = 'forum ' . randomString(6); $forum = (new Gazelle\Manager\Forum)->create( sequence: 999, categoryId: 1, name: $name, description: 'phpunit forum test', minRead: 100, minWrite: 100, minCreate: 100, autoLock: false, autoLockWeeks: 52, ); $this->assertInstanceOf(Gazelle\Forum::class, $forum, 'text-create-forum'); $this->assertEquals( "id()}\">{$forum->name()}", Text::full_format("[forum]{$forum->id()}[/forum]"), 'text-forum' ); $this->assertEquals(1, $forum->remove(), 'text-remove-forum'); } public function testForumThread(): void { $postId = (int)Gazelle\DB::DB()->scalar(" SELECT min(fp.ID) FROM forums_posts fp INNER JOIN forums_topics ft ON (ft.ID = fp.TopicID) "); $post = (new Gazelle\Manager\ForumPost)->findById($postId); $threadId = $post->thread()->id(); $title = $post->thread()->title(); $this->assertMatchesRegularExpression( "@^\Q{$title}\E$@", Text::full_format("[thread]{$threadId}[/thread]"), 'text-forum-thread' ); $this->assertMatchesRegularExpression( "@^\Q{$title}\E \(Post #{$postId}\)$@", Text::full_format("[thread]{$threadId}:{$postId}[/thread]"), 'text-forum-post' ); } public function dataList(): array { return [ ['text-list-a', <<