diff options
author | Nils Adermann <naderman@naderman.de> | 2008-05-04 12:54:47 +0000 |
---|---|---|
committer | Nils Adermann <naderman@naderman.de> | 2008-05-04 12:54:47 +0000 |
commit | 771fd3696d2f729476399d5acf92a68dd154d78d (patch) | |
tree | c99d5ae72a817c9192b0e740d70c90518430884b /tests/bbcode | |
parent | b1915b6f256b64c45d325e86f9464009909099d5 (diff) | |
download | forums-771fd3696d2f729476399d5acf92a68dd154d78d.tar forums-771fd3696d2f729476399d5acf92a68dd154d78d.tar.gz forums-771fd3696d2f729476399d5acf92a68dd154d78d.tar.bz2 forums-771fd3696d2f729476399d5acf92a68dd154d78d.tar.xz forums-771fd3696d2f729476399d5acf92a68dd154d78d.zip |
adding a bbcode test suite
git-svn-id: file:///svn/phpbb/trunk@8541 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'tests/bbcode')
-rw-r--r-- | tests/bbcode/all_tests.php | 34 | ||||
-rw-r--r-- | tests/bbcode/parser_test.php | 22 |
2 files changed, 56 insertions, 0 deletions
diff --git a/tests/bbcode/all_tests.php b/tests/bbcode/all_tests.php new file mode 100644 index 0000000000..e5412eed0e --- /dev/null +++ b/tests/bbcode/all_tests.php @@ -0,0 +1,34 @@ +<?php +define('IN_PHPBB', true); +if (!defined('PHPUnit_MAIN_METHOD')) +{ + define('PHPUnit_MAIN_METHOD', 'phpbb_bbcode_all_tests::main'); +} + +require_once 'PHPUnit/Framework.php'; +require_once 'PHPUnit/TextUI/TestRunner.php'; + +require_once 'bbcode/parser_test.php'; + +class phpbb_bbcode_all_tests +{ + public static function main() + { + PHPUnit_TextUI_TestRunner::run(self::suite()); + } + + public static function suite() + { + $suite = new PHPUnit_Framework_TestSuite('phpBB Formatted Text / BBCode'); + + $suite->addTestSuite('phpbb_bbcode_parser_test'); + + return $suite; + } +} + +if (PHPUnit_MAIN_METHOD == 'phpbb_bbcode_all_tests::main') +{ + phpbb_bbcode_all_tests::main(); +} +?>
\ No newline at end of file diff --git a/tests/bbcode/parser_test.php b/tests/bbcode/parser_test.php new file mode 100644 index 0000000000..0cb223d799 --- /dev/null +++ b/tests/bbcode/parser_test.php @@ -0,0 +1,22 @@ +<?php +define('IN_PHPBB', true); + +require_once 'PHPUnit/Framework.php'; +require_once '../phpBB/includes/bbcode/bbcode_parser_base.php'; +require_once '../phpBB/includes/bbcode/bbcode_parser.php'; + +class phpbb_bbcode_parser_test extends PHPUnit_Framework_TestCase +{ + public function test_both_passes() + { + $parser = new phpbb_bbcode_parser(); + + $result = $parser->first_pass('[i]Italic [u]underlined text[/u][/i]'); + $result = $parser->second_pass($result); + + $expected = '<span style="font-style: italic">Italic <span style="text-decoration: underline">underlined text</span></span>'; + + $this->assertEquals($expected, $result, 'Simple nested BBCode first+second pass'); + } +} +?>
\ No newline at end of file |