aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2024-10-30 08:27:44 +0000
committerMario <mario@mariovavti.com>2024-10-30 08:27:44 +0000
commit274bfa9024e2886bb32c79f5939726687fb1ade4 (patch)
tree714cdb1b13927f50ec060babe96d572e7bd35e23
parent0e50b1d10ca5b68ca0d91e844ce32ce092773eb3 (diff)
parent73006ccdf57c36945ddaa2a15a0a40c005f07569 (diff)
downloadvolse-hubzilla-274bfa9024e2886bb32c79f5939726687fb1ade4.tar.gz
volse-hubzilla-274bfa9024e2886bb32c79f5939726687fb1ade4.tar.bz2
volse-hubzilla-274bfa9024e2886bb32c79f5939726687fb1ade4.zip
Merge branch 'add-missing-test-for-bbcode-cleanup-fix' into 'dev'
tests: Tests for BBCode cleanup fix See merge request hubzilla/core!2152
-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",
+ ]
+ ];
+ }
+}