X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=tests%2Fsrc%2FContent%2FText%2FBBCodeTest.php;h=74d34f5a5e836064cc001ac6a892a6eace2b48d7;hb=7e6ba0b4d271735bbf7474fb75a7cf43b787b678;hp=4c1292344c1c5fee714affd5b142953c12b1b076;hpb=cef063e4fd07e673138186c1726887c3c18806ef;p=friendica.git diff --git a/tests/src/Content/Text/BBCodeTest.php b/tests/src/Content/Text/BBCodeTest.php index 4c1292344c..74d34f5a5e 100644 --- a/tests/src/Content/Text/BBCodeTest.php +++ b/tests/src/Content/Text/BBCodeTest.php @@ -158,21 +158,21 @@ class BBCodeTest extends FixtureTest { return [ 'bug-7271-condensed-space' => [ - 'expectedHtml' => '', + 'expectedHtml' => '
  1. http://example.com/
', 'text' => '[ol][*] http://example.com/[/ol]', ], 'bug-7271-condensed-nospace' => [ - 'expectedHtml' => '', + 'expectedHtml' => '
  1. http://example.com/
', 'text' => '[ol][*]http://example.com/[/ol]', ], 'bug-7271-indented-space' => [ - 'expectedHtml' => '', + 'expectedHtml' => '', 'text' => '[ul] [*] http://example.com/ [/ul]', ], 'bug-7271-indented-nospace' => [ - 'expectedHtml' => '', + 'expectedHtml' => '', 'text' => '[ul] [*]http://example.com/ [/ul]', @@ -257,7 +257,27 @@ Karl Marx - Die ursprüngliche Akkumulation 'task-10886-deprecate-class' => [ 'expectedHTML' => ':heart_nb:', 'text' => '[emoji=https://fedi.underscore.world/emoji/custom/custom/heart_nb.png]:heart_nb:[/emoji]', - ] + ], + 'task-12900-multiple-paragraphs' => [ + 'expectedHTML' => '

Header

This is a paragraph
with a line feed.

Second Chapter

', + 'text' => "[h1]Header[/h1][ul][*]One[*]Two[/ul]\n\nThis is a paragraph\nwith a line feed.\n\nSecond Chapter", + ], + 'task-12900-header-with-paragraphs' => [ + 'expectedHTML' => '

Header

Some Chapter

', + 'text' => '[h1]Header[/h1]Some Chapter', + ], + 'bug-12842-ul-newlines' => [ + 'expectedHTML' => '

This is:

', + 'text' => "This is:\r\n[ul]\r\n[*]some\r\n[*]amazing\r\n[*]list\r\n[/ul]", + ], + 'bug-12842-ol-newlines' => [ + 'expectedHTML' => '

This is:

  1. some
  2. amazing
  3. list
', + 'text' => "This is:\r\n[ol]\r\n[*]some\r\n[*]amazing\r\n[*]list\r\n[/ol]", + ], + 'task-12917-tabs-between-linebreaks' => [ + 'expectedHTML' => '

Paragraph

New Paragraph

', + 'text' => "Paragraph\n\t\nNew Paragraph", + ], ]; } @@ -274,8 +294,9 @@ Karl Marx - Die ursprüngliche Akkumulation * * @throws InternalServerErrorException */ - public function testConvert(string $expectedHtml, string $text, $try_oembed = false, int $simpleHtml = 0, bool $forPlaintext = false) + public function testConvert(string $expectedHtml, string $text, bool $try_oembed = true, int $simpleHtml = BBCode::INTERNAL, bool $forPlaintext = false) { + // This assumes system.remove_multiplicated_lines = false $actual = BBCode::convert($text, $try_oembed, $simpleHtml, $forPlaintext); self::assertEquals($expectedHtml, $actual); @@ -296,6 +317,14 @@ Karl Marx - Die ursprüngliche Akkumulation 'expected' => '&`&`', 'text' => '&[code]&[/code]', ], + 'bug-12701-quotes' => [ + 'expected' => '[![abc"fgh](https://domain.tld/photo/86912721086415cdc8e0a03226831581-1.png)](https://domain.tld/photos/user/image/86912721086415cdc8e0a03226831581)', + 'text' => '[url=https://domain.tld/photos/user/image/86912721086415cdc8e0a03226831581][img=https://domain.tld/photo/86912721086415cdc8e0a03226831581-1.png]abc"fgh[/img][/url]' + ], + 'bug-12701-no-quotes' => [ + 'expected' => '[![abcfgh](https://domain.tld/photo/86912721086415cdc8e0a03226831581-1.png "abcfgh")](https://domain.tld/photos/user/image/86912721086415cdc8e0a03226831581)', + 'text' => '[url=https://domain.tld/photos/user/image/86912721086415cdc8e0a03226831581][img=https://domain.tld/photo/86912721086415cdc8e0a03226831581-1.png]abcfgh[/img][/url]' + ], ]; } @@ -310,7 +339,7 @@ Karl Marx - Die ursprüngliche Akkumulation * * @throws InternalServerErrorException */ - public function testToMarkdown(string $expected, string $text, $for_diaspora = false) + public function testToMarkdown(string $expected, string $text, $for_diaspora = true) { $actual = BBCode::toMarkdown($text, $for_diaspora);