assertSame( "", translateHtml(null), "Null line" ); $this->assertSame( "", translateHtml(""), "Empty line" ); $this->assertSame( "
$rline1
\n", translateHtml($line1), "Only one line" ); $this->assertSame( "$rline1
\n", translateHtml($line1."\n"), "Only one line with a line feed" ); $this->assertSame( "$rline1
\n$rline2
\n", translateHtml($line1."\n".$line2), "Two lines, one line feed in between" ); $this->assertSame( "$rline1
\n$rline2
\n", translateHtml("$line1\n$line2\n"), "Two lines, one line feed after each" ); } public function test_decoration(): void { $this->assertSame( ":
\n", translateHtml(":**"), "** Empty strong: the strongness goes until the end" ); $this->assertSame( ":**
\n", translateHtml(":****"), "** Two stars" ); $this->assertSame( ":ok
\n", translateHtml(":**ok**"), "** normal case with a word" ); $this->assertSame( ":nice
\n", translateHtml(":**nice"), "** a word with no end stars" ); $this->assertSame( ":nice
\n", translateHtml(":**nice"), "** a word with no end stars" ); $this->assertSame( ":**one two three
\n", translateHtml(":****one two three"), "** a word with no end stars" ); } #TODO: don't stop when problems are found, list all the faulty files public function test_translate_html_files_with_html(): void { foreach(getGmiFiles(dirname(__FILE__)."/files_with_html") as $filePathname) { $fileContentGmi = file_get_contents($filePathname); $fileContentHtml = file_get_contents($filePathname.".html"); $this->assertSame( $fileContentHtml, translateHtml($fileContentGmi), "Translation to HTML: $filePathname" ); } } }