mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-07 20:08:53 +00:00
adding a bbcode test suite
git-svn-id: file:///svn/phpbb/trunk@8541 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
b1915b6f25
commit
771fd3696d
3 changed files with 60 additions and 0 deletions
|
@ -8,8 +8,11 @@ if (!defined('PHPUnit_MAIN_METHOD'))
|
|||
require_once 'PHPUnit/Framework.php';
|
||||
require_once 'PHPUnit/TextUI/TestRunner.php';
|
||||
|
||||
require_once 'bbcode/all_tests.php';
|
||||
require_once 'utf/all_tests.php';
|
||||
|
||||
PHPUnit_Util_Filter::addDirectoryToFilter('./');
|
||||
|
||||
class phpbb_all_tests
|
||||
{
|
||||
public static function main()
|
||||
|
@ -21,6 +24,7 @@ class phpbb_all_tests
|
|||
{
|
||||
$suite = new PHPUnit_Framework_TestSuite('phpBB');
|
||||
|
||||
$suite->addTest(phpbb_bbcode_all_tests::suite());
|
||||
$suite->addTest(phpbb_utf_all_tests::suite());
|
||||
|
||||
return $suite;
|
||||
|
|
34
tests/bbcode/all_tests.php
Normal file
34
tests/bbcode/all_tests.php
Normal file
|
@ -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();
|
||||
}
|
||||
?>
|
22
tests/bbcode/parser_test.php
Normal file
22
tests/bbcode/parser_test.php
Normal file
|
@ -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');
|
||||
}
|
||||
}
|
||||
?>
|
Loading…
Add table
Reference in a new issue