Created
December 6, 2012 21:39
-
-
Save brunoais/4228724 to your computer and use it in GitHub Desktop.
phpbb tests gist
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* | |
* @package testing | |
* @version $Id$ | |
* @copyright (c) 2008 phpBB Group | |
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 | |
* | |
*/ | |
$phpbb_root_path = __DIR__ . '/../../phpBB/'; | |
$phpEx = 'php'; | |
require_once $phpbb_root_path . 'includes/message_parser.' . $phpEx; | |
class phpbb_bbcode_parser_test extends phpbb_database_test_case | |
{ | |
private $db; | |
private $config; | |
public function getDataSet() | |
{ | |
return $this->createXMLDataSet(dirname(__FILE__).'/fixtures/config.xml'); | |
} | |
public function setUp() | |
{ | |
global $db, $config; | |
echo "aa"; | |
$db = $this->db = $this->new_dbal(); | |
$config = $this->config = new phpbb_config(array('rand_seed' => '', 'rand_seed_last_update' => '0')); | |
set_config(null, null, null, $this->config); | |
} | |
public function test_both_passes() | |
{ | |
// $this->markTestIncomplete('New bbcode parser has not been backported from feature/ascraeus-experiment yet.'); | |
echo "aaa"; | |
$parser_part1 = new parse_message('[i]Italic [u]underlined text[/u][/i]'); | |
// Test only the BBCode parsing | |
$parser_part1->parse(true, false, false); | |
$parser_part2 = new bbcode($parser_part1->bbcode_bitfield); | |
$parser_part2->bbcode_second_pass($parser_part1->message, $parser_part1->bbcode_uid); | |
$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'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment