mirror of
https://github.com/e107inc/e107.git
synced 2025-08-04 13:47:31 +02:00
isBbcode and isHtml() tests
This commit is contained in:
@@ -932,12 +932,14 @@
|
||||
*/
|
||||
public function testIsInstalled()
|
||||
{
|
||||
$result = $this->e107::isInstalled('user');
|
||||
$obj = $this->e107;
|
||||
|
||||
$result = $obj::isInstalled('user');
|
||||
|
||||
// var_dump($result);
|
||||
$this->assertTrue($result);
|
||||
|
||||
$result = $this->e107::isInstalled('news');
|
||||
$result = $obj::isInstalled('news');
|
||||
|
||||
// var_dump($result);
|
||||
$this->assertTrue($result);
|
||||
|
@@ -514,17 +514,56 @@ TMP;
|
||||
{
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
public function testIsBBcode()
|
||||
{
|
||||
$tests = array(
|
||||
0 => array("My Simple Text", false), // input , expected result
|
||||
1 => array("<hr />", false),
|
||||
2 => array("[b]Bbcode[/b]", true),
|
||||
3 => array("<div class='something'>[code]something[/code]</div>", false),
|
||||
4 => array("[code]<b>someting</b>[/code]", true),
|
||||
5 => array("[html]something[/html]", false),
|
||||
6 => array("http://something.com/index.php?what=ever", false)
|
||||
);
|
||||
|
||||
|
||||
foreach($tests as $val)
|
||||
{
|
||||
list($input, $expected) = $val;
|
||||
$actual = $this->tp->isBbcode($input);
|
||||
|
||||
$this->assertEquals($expected, $actual, $input);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function testIsHtml()
|
||||
{
|
||||
$tests = array(
|
||||
0 => array("My Simple Text", false), // input , expected result
|
||||
1 => array("<hr />", true),
|
||||
2 => array("[b]Bbcode[/b]", false),
|
||||
3 => array("<div class='something'>[code]something[/code]</div>", true),
|
||||
4 => array("[code]<b>someting</b>[/code]", false),
|
||||
5 => array("[html]something[/html]", true),
|
||||
6 => array("http://something.com/index.php?what=ever", false)
|
||||
);
|
||||
|
||||
|
||||
foreach($tests as $val)
|
||||
{
|
||||
list($input, $expected) = $val;
|
||||
$actual = $this->tp->isHtml($input);
|
||||
|
||||
$this->assertEquals($expected, $actual, $input);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
/*
|
||||
public function testIsJSON()
|
||||
{
|
||||
|
||||
@@ -560,7 +599,7 @@ TMP;
|
||||
|
||||
$result = $tp->makeClickable($email, 'email', array('sub' => '[email]'));
|
||||
|
||||
$this->assertContains('[email]</a>', $result);
|
||||
$this->assertContains('[email]</>', $result);
|
||||
|
||||
// -----
|
||||
|
||||
|
Reference in New Issue
Block a user