Passage en Namespace et tous les tests fonctionnels OK

This commit is contained in:
2021-05-10 11:48:15 +02:00
parent 536dd0d56b
commit eb30d8ef97
56 changed files with 1091 additions and 964 deletions

View File

@@ -7,21 +7,23 @@
namespace Domframework\Tests;
/** Test the outputjson.php file */
class markdownTest extends \PHPUnit_Framework_TestCase
use Domframework\Markdown;
/** Test the Markdown.php file */
class MarkdownTest extends \PHPUnit_Framework_TestCase
{
// TitleSeText
public function testTitleSeText1 ()
{
$this->expectOutputString("<h1>test</h1>");
$md = new markdown ();
$md = new Markdown ();
printf ($md->html ("test\n====\n"), TRUE);
}
public function testTitleSeText2 ()
{
$this->expectOutputString("<h2>test</h2>");
$md = new markdown ();
$md = new Markdown ();
printf ($md->html ("test\n----\n"), TRUE);
}
@@ -29,42 +31,42 @@ class markdownTest extends \PHPUnit_Framework_TestCase
public function testTitleSharp1 ()
{
$this->expectOutputString("<h1>test</h1>");
$md = new markdown ();
$md = new Markdown ();
printf ($md->html ("# test #"));
}
public function testTitleSharp2 ()
{
$this->expectOutputString("<h2>test</h2>");
$md = new markdown ();
$md = new Markdown ();
printf ($md->html ("## test ##"));
}
public function testTitleSharp3 ()
{
$this->expectOutputString("<h3>test</h3>");
$md = new markdown ();
$md = new Markdown ();
printf ($md->html ("### test ###"));
}
public function testTitleSharp4 ()
{
$this->expectOutputString("<h4>test</h4>");
$md = new markdown ();
$md = new Markdown ();
printf ($md->html ("#### test ####"));
}
public function testTitleSharp5 ()
{
$this->expectOutputString("<h5>test</h5>");
$md = new markdown ();
$md = new Markdown ();
printf ($md->html ("##### test #####"));
}
public function testTitleSharp6 ()
{
$this->expectOutputString("<h6>test</h6>");
$md = new markdown ();
$md = new Markdown ();
printf ($md->html ("###### test #######"));
}
@@ -72,42 +74,42 @@ class markdownTest extends \PHPUnit_Framework_TestCase
public function testSeparator1 ()
{
$this->expectOutputString("<hr/>");
$md = new markdown ();
$md = new Markdown ();
printf ($md->html ("---\n"), TRUE);
}
public function testSeparator2 ()
{
$this->expectOutputString("<hr/>");
$md = new markdown ();
$md = new Markdown ();
printf ($md->html ("___\n"), TRUE);
}
public function testSeparator3 ()
{
$this->expectOutputString("<hr/>");
$md = new markdown ();
$md = new Markdown ();
printf ($md->html ("***\n"), TRUE);
}
public function testSeparator4 ()
{
$this->expectOutputString("<hr/>");
$md = new markdown ();
$md = new Markdown ();
printf ($md->html ("- - -\n"), TRUE);
}
public function testSeparator5 ()
{
$this->expectOutputString("<hr/>");
$md = new markdown ();
$md = new Markdown ();
printf ($md->html ("_ _ _\n"), TRUE);
}
public function testSeparator6 ()
{
$this->expectOutputString("<hr/>");
$md = new markdown ();
$md = new Markdown ();
printf ($md->html ("* * *\n"), TRUE);
}
@@ -115,7 +117,7 @@ class markdownTest extends \PHPUnit_Framework_TestCase
public function testSimpleText ()
{
$this->expectOutputString("<p>text</p>");
$md = new markdown ();
$md = new Markdown ();
printf ($md->html ("text"), TRUE);
}
@@ -123,42 +125,42 @@ class markdownTest extends \PHPUnit_Framework_TestCase
public function testEmphasisStrong1 ()
{
$this->expectOutputString("<p><strong>text</strong></p>");
$md = new markdown ();
$md = new Markdown ();
printf ($md->html ("__text__"));
}
public function testEmphasisStrong2 ()
{
$this->expectOutputString("<p><strong>text</strong></p>");
$md = new markdown ();
$md = new Markdown ();
printf ($md->html ("**text**"));
}
public function testEmphasisEM1 ()
{
$this->expectOutputString("<p><em>text</em></p>");
$md = new markdown ();
$md = new Markdown ();
printf ($md->html ("_text_"));
}
public function testEmphasisEM2 ()
{
$this->expectOutputString("<p><em>file1.php</em> or <em>file2.php</em></p>");
$md = new markdown ();
$md = new Markdown ();
printf ($md->html ("_file1.php_ or _file2.php_"));
}
public function testEmphasisEM3 ()
{
$this->expectOutputString("<p><em>text</em></p>");
$md = new markdown ();
$md = new Markdown ();
printf ($md->html ("*text*"));
}
public function testEmphasisEM4 ()
{
$this->expectOutputString("<p><em>text</em> or <em>text2</em></p>");
$md = new markdown ();
$md = new Markdown ();
printf ($md->html ("*text* or *text2*"));
}
@@ -170,7 +172,7 @@ class markdownTest extends \PHPUnit_Framework_TestCase
<li>Case2</li>
<li>Case3</li>
</ul>");
$md = new markdown ();
$md = new Markdown ();
printf ($md->html ("* Case1\n* Case2\n* Case3"), TRUE);
}
@@ -181,7 +183,7 @@ class markdownTest extends \PHPUnit_Framework_TestCase
<li>Case2</li>
<li>Case3</li>
</ul>");
$md = new markdown ();
$md = new Markdown ();
printf ($md->html ("- Case1\n- Case2\n- Case3"), TRUE);
}
@@ -192,7 +194,7 @@ class markdownTest extends \PHPUnit_Framework_TestCase
<li>Case2</li>
<li>Case3</li>
</ul>");
$md = new markdown ();
$md = new Markdown ();
printf ($md->html ("+ Case1\n+ Case2\n+ Case3"), TRUE);
}
@@ -202,7 +204,7 @@ class markdownTest extends \PHPUnit_Framework_TestCase
<li>line1 end</li>
<li>line2 end</li>
</ul>");
$md = new markdown ();
$md = new Markdown ();
printf ($md->html ("* line1
end
* line2
@@ -221,7 +223,7 @@ end"));
</li>
<li>line3</li>
</ul>");
$md = new markdown ();
$md = new Markdown ();
printf ($md->html ("* line1
* line2
* NEW lineA
@@ -237,7 +239,7 @@ end"));
<li>Case2</li>
<li>Case3</li>
</ol>");
$md = new markdown ();
$md = new Markdown ();
printf ($md->html ("1. Case1\n2. Case2\n3. Case3"), TRUE);
}
@@ -247,7 +249,7 @@ end"));
$this->expectOutputString("<pre><code>test
indent
base</code></pre>");
$md = new markdown ();
$md = new Markdown ();
printf ($md->html (" test
indent
base"));
@@ -257,7 +259,7 @@ base</code></pre>");
public function testInlineCode1 ()
{
$this->expectOutputString("<p><code>code</code></p>");
$md = new markdown ();
$md = new Markdown ();
printf ($md->html ("`code`"));
}
@@ -266,7 +268,7 @@ base</code></pre>");
{
$this->expectOutputString(
"<p><a href='http://example.com'>http://example.com</a></p>");
$md = new markdown ();
$md = new Markdown ();
printf ($md->html ("<http://example.com>"));
}
@@ -274,7 +276,7 @@ base</code></pre>");
{
$this->expectOutputString(
"<p><a href='https://example.com'>https://example.com</a></p>");
$md = new markdown ();
$md = new Markdown ();
printf ($md->html ("<https://example.com>"));
}
@@ -282,7 +284,7 @@ base</code></pre>");
{
$this->expectOutputString(
"<p><a href='mailto:test@example.com'>test@example.com</a></p>");
$md = new markdown ();
$md = new Markdown ();
printf ($md->html ("<test@example.com>"));
}
@@ -290,7 +292,7 @@ base</code></pre>");
{
$this->expectOutputString(
"<p><a href='mailto:test_with_underscore@example.com'>test_with_underscore@example.com</a></p>");
$md = new markdown ();
$md = new Markdown ();
printf ($md->html ("<test_with_underscore@example.com>"));
}
@@ -298,7 +300,7 @@ base</code></pre>");
public function testChain1 ()
{
$this->expectOutputString("<h1>t1</h1><h2>t2</h2>");
$md = new markdown ();
$md = new Markdown ();
printf ($md->html ("# t1\n## t2"));
}
@@ -306,7 +308,7 @@ base</code></pre>");
{
$this->expectOutputString("<pre><code>
* OK</code></pre>");
$md = new markdown ();
$md = new Markdown ();
printf ($md->html (" \n * OK"));
}
@@ -314,7 +316,7 @@ base</code></pre>");
{
$this->expectOutputString("<pre><code>
* * * * * www-data OK</code></pre>");
$md = new markdown ();
$md = new Markdown ();
printf ($md->html (" \n * * * * * www-data OK"));
}
@@ -322,7 +324,7 @@ base</code></pre>");
{
$this->expectOutputString("<p>To write</p>
<pre><code>* * * * * www-data OK</code></pre>");
$md = new markdown ();
$md = new Markdown ();
printf ($md->html ("To write
* * * * * www-data OK"));
@@ -335,7 +337,7 @@ base</code></pre>");
<li>line1</li>
<li>line2 end</li>
</ul>");
$md = new markdown ();
$md = new Markdown ();
printf ($md->html ("Hi
* line1
* line2
@@ -345,21 +347,21 @@ end"));
public function testCarriageReturn1 ()
{
$this->expectOutputString("<p>line1 line2</p>");
$md = new markdown ();
$md = new Markdown ();
printf ($md->html ("line1\nline2\n"));
}
public function testCarriageReturn2 ()
{
$this->expectOutputString("<p>line1<br/>line2</p>");
$md = new markdown ();
$md = new Markdown ();
printf ($md->html ("line1 \nline2\n"));
}
public function testCarriageReturn3 ()
{
$this->expectOutputString("<p>line1 line2 line3.</p>");
$md = new markdown ();
$md = new Markdown ();
printf ($md->html ("line1
line2
line3."));
@@ -368,14 +370,14 @@ line3."));
public function testHTMLSpecialChars1 ()
{
$this->expectOutputString("<p>toto&amp;titi</p>");
$md = new markdown ();
$md = new Markdown ();
printf ($md->html ("toto&titi"));
}
public function testHTMLSpecialChars2 ()
{
$this->expectOutputString("<p>toto&eacute;titi</p>");
$md = new markdown ();
$md = new Markdown ();
printf ($md->html ("totoétiti"));
}
}