UnitTestCase('Flay test'); } // called before the test functions will be executed // this function is defined in PHPUnit_TestCase and overwritten // here function setUp() { $this->flay = new Flay (); } // called after the test functions are executed // this function is defined in PHPUnit_TestCase and overwritten // here function tearDown() { unset($this->flay); } function testToHtml() { $tests_to_html = array( array( 'text'=>"", 'html'=>"" ), array( 'text'=>"This is a text.", 'html'=>"
This is a text.
\n" ), array( 'text'=>"This is a line.\n\n\nThis is\n another one.\n\n", 'html'=>"This is a line.
\nThis is
\n another one.
This line has bold, italic, and a combo bold and italic texts.
\n" ), array( 'text'=>"This line has tags which areThis line has <b>tags</b> which are <br />not allowed.
\n", ), array( 'text'=>"[http://sputnik.pl] is a link, but so is [http://sputnik.pl/bla/ this one], and [this is not.", 'html'=>"http://sputnik.pl is a link, but so is this one, and [this is not.
\n" ), array( 'text'=>"Why don't we try to insert an image.\n\n[http://sputnik.pl/test.jpg]", 'html'=>"Why don't we try to insert an image.
\n\n" ), array( 'text'=>"Auto-link my.name+real@my-server.com and example@example.com, should work.", 'html'=>"Auto-link my.name+real@my-server.com and example@example.com, should work.
\n" ), array( 'text'=>"\"\"\"This is a blockquote\"\"\"", 'html'=>"\n\n" ), array( 'text'=>"How about a blockquote?\"\"\"This is a multiline blockquote.\n\nThis is the second line.\"\"\"\nAnd this is not.", 'html'=>"This is a blockquote
\n
How about a blockquote?
\n\n\nThis is a multiline blockquote.
\nThis is the second line.
\n
And this is not.
\n" ), array( 'text'=>"Now auto-link an url such as http://sputnik.pl or www.robocik-malowany.com/dupa[4] - or any other.", 'html'=>"Now auto-link an url such as http://sputnik.pl or www.robocik-malowany.com/dupa[4] – or any other.
\n" ), array( 'text'=>"===This be centered===", 'html'=>"This be centered
\nThis be centered.
\nAnd this be centered too,
\nalong with this.
This, alas, be not.
\n" ), array( 'text'=>"This tests (C)2004 Someone Else, \"Layer Your Apps(R)\" and Cake(TM).", 'html'=>"This tests ©2004 Someone Else, \"Layer Your Apps®\" and Cake™.
\n" ), ); foreach ($tests_to_html as $test) { $this->assertEqual($this->flay->toHtml($test['text']), $test['html']); } } } ?>