diff options
author | rxu <rxu@mail.ru> | 2011-06-05 21:55:28 +0800 |
---|---|---|
committer | rxu <rxu@mail.ru> | 2011-06-06 00:53:53 +0800 |
commit | 6585d938d2c441900d8af6d25da2433d3beec856 (patch) | |
tree | 25e61be2c303c0ad97b08a936a48128a7fc4b848 /tests/bbcode | |
parent | 16ab0d8c264d88db5e3e961e66e6820b365f45ac (diff) | |
download | forums-6585d938d2c441900d8af6d25da2433d3beec856.tar forums-6585d938d2c441900d8af6d25da2433d3beec856.tar.gz forums-6585d938d2c441900d8af6d25da2433d3beec856.tar.bz2 forums-6585d938d2c441900d8af6d25da2433d3beec856.tar.xz forums-6585d938d2c441900d8af6d25da2433d3beec856.zip |
[ticket/217] Adjust patch, add tests
PHPBB3-217
Diffstat (limited to 'tests/bbcode')
-rw-r--r-- | tests/bbcode/url_bbcode_test.php | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/tests/bbcode/url_bbcode_test.php b/tests/bbcode/url_bbcode_test.php new file mode 100644 index 0000000000..6d9e51664d --- /dev/null +++ b/tests/bbcode/url_bbcode_test.php @@ -0,0 +1,41 @@ +<?php +/** +* +* @package testing +* @copyright (c) 2010 phpBB Group +* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* +*/ + +require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; +require_once dirname(__FILE__) . '/../../phpBB/includes/functions_content.php'; +require_once dirname(__FILE__) . '/../../phpBB/includes/bbcode.php'; +require_once dirname(__FILE__) . '/../../phpBB/includes/message_parser.php'; + +class phpbb_url_bbcode_test extends phpbb_test_case +{ + public function url_bbcode_test_data() + { + return array( + array('[url]http://www.phpbb.com/community/[/url]'), + array('[url=http://www.phpbb.com/community/]One line URL text[/url]'), + array("[url=http://www.phpbb.com/community/]Multiline\x0AURL\x0Atext[/url]"), + array("test [url] test \x0A test [url=http://www.phpbb.com/]test[/url] test"), + array("test [url=http://www.phpbb.com/]test \x0A [url]http://phpbb.com[/url] test"), + ); + } + + /** + * @dataProvider url_bbcode_test_data + */ + public function test_url($message) + { + $bbcode = new bbcode_firstpass(); + $bbcode->message = $message; + $bbcode->bbcode_init(true); + $bbcode->parse_bbcode(); + $this->assertNotEquals($bbcode->message, '[url][/url]'); + $this->assertNotEquals($bbcode->message, $message); + $this->assertNotEquals($bbcode->message, NULL); + } +} |