tests: Tests for BBCode cleanup fix

Somehow I forgot to include this in the patch that fixed the issue.
This commit is contained in:
Harald Eilertsen
2024-10-23 14:31:21 +02:00
parent e530476e6c
commit 73006ccdf5

View File

@@ -0,0 +1,27 @@
<?php
/*
* SPDX-FileCopyrightText: 2024 Hubzilla Community
* SPDX-FileContributor: Harald Eilertsen
*
* SPDX-License-Identifier: MIT
*/
namespace Zotlabs\Tests\Unit;
use PHPUnit\Framework\Attributes\DataProvider;
class CleanupBBCodeTest extends UnitTestCase {
#[DataProvider("cleanup_bbcode_provider")]
public function test_cleanup_bbcode(string $expected, string $input): void {
$this->assertEquals($expected, cleanup_bbcode($input));
}
public static function cleanup_bbcode_provider(): array {
return [
'url followed by newline' => [
"#^[url=https://example.com]https://example.com[/url]\na test link",
"https://example.com\na test link",
]
];
}
}