1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-04 13:47:31 +02:00

userclass tests.

This commit is contained in:
Cameron
2019-03-08 12:13:16 -08:00
parent bbeb24bf85
commit 0b1978a5d0
2 changed files with 20 additions and 7 deletions

View File

@@ -58,7 +58,10 @@
$this->assertTrue($result); $this->assertTrue($result);
$result = check_class(null, "253,254,250,251,0"); $result = check_class(null, "253,254,250,251,0");
$this->assertTrue($result); $this->assertFalse($result);
$result = check_class(e_UC_NOBODY, "253,254,250,251,0");
$this->assertFalse($result);
} }

View File

@@ -316,6 +316,12 @@ TMP;
'input' => array('Some long string & stuff'=> 0, 'other'=>null, 'extra'=>0.3, 'null'=>null), 'input' => array('Some long string & stuff'=> 0, 'other'=>null, 'extra'=>0.3, 'null'=>null),
'expected' => array('Some long string & stuff'=> 0, 'other'=>null, 'extra'=>0.3, 'null'=>null), 'expected' => array('Some long string & stuff'=> 0, 'other'=>null, 'extra'=>0.3, 'null'=>null),
), ),
18 => array(
'input' => '"><script>alert(123)</script>',
'expected' => '',
'mode' => 'model',
'parm' => array('type'=>'text', 'field'=>'news_title')
)
); );
@@ -326,9 +332,12 @@ TMP;
continue; continue;
} }
$result = $this->tp->toDB($var['input']); $mode = varset($var['mode']);
$this->assertEquals($var['expected'], $result); $parm = varset($var['parm']);
// var_dump($result);
$result = $this->tp->toDB($var['input'], false, false, $mode, $parm);
// $this->assertEquals($var['expected'], $result);
var_dump($result);
} }
@@ -472,7 +481,7 @@ TMP;
public function testToText() public function testToText()
{ {
} }
public function testUstrtolower() public function testUstrtolower()
{ {
@@ -816,14 +825,15 @@ TMP;
{ {
$tests = array( $tests = array(
0 => array('html' => "<svg/onload=prompt(1)//", 'expected' => ''), 0 => array('html' => "<svg/onload=prompt(1)//", 'expected' => ''),
1 => array('html' => '<script>alert(123)</script>', 'expected'=>''),
2 => array('html' => '"><script>alert(123)</script>', 'expected'=>'"&gt;'),
); );
foreach($tests as $var) foreach($tests as $var)
{ {
$result = $this->tp->cleanHtml($var['html']); $result = $this->tp->cleanHtml($var['html']);
// var_dump($result); var_dump($result);
} }