aboutsummaryrefslogtreecommitdiffstats
path: root/tests/unit/CleanupBBCodeTest.php
diff options
context:
space:
mode:
authorMario Vavti <mario@mariovavti.com>2024-10-30 09:50:17 +0100
committerMario Vavti <mario@mariovavti.com>2024-10-30 09:50:17 +0100
commit68135c28da286bb23978f6181c46edf56c37b06e (patch)
tree4264836ddfcacefba9b1840849144ab3cabf5f8b /tests/unit/CleanupBBCodeTest.php
parent4bb28a21c46b980d2d664ce01db9a852fc0a738c (diff)
parent274bfa9024e2886bb32c79f5939726687fb1ade4 (diff)
downloadvolse-hubzilla-68135c28da286bb23978f6181c46edf56c37b06e.tar.gz
volse-hubzilla-68135c28da286bb23978f6181c46edf56c37b06e.tar.bz2
volse-hubzilla-68135c28da286bb23978f6181c46edf56c37b06e.zip
Merge branch 'dev' into containers
Diffstat (limited to 'tests/unit/CleanupBBCodeTest.php')
-rw-r--r--tests/unit/CleanupBBCodeTest.php27
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/unit/CleanupBBCodeTest.php b/tests/unit/CleanupBBCodeTest.php
new file mode 100644
index 000000000..8e19b1d7e
--- /dev/null
+++ b/tests/unit/CleanupBBCodeTest.php
@@ -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",
+ ]
+ ];
+ }
+}