mirror of
https://github.com/e107inc/e107.git
synced 2025-03-31 02:32:37 +02:00
Additional tests for toDB()
This commit is contained in:
parent
f4d67bc6b6
commit
d3b598c69f
@ -316,16 +316,31 @@ TMP;
|
||||
'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),
|
||||
),
|
||||
18 => array(
|
||||
/* 18 => array(
|
||||
'input' => '"><script>alert(123)</script>',
|
||||
'expected' => '',
|
||||
'mode' => 'model',
|
||||
'parm' => array('type'=>'text', 'field'=>'news_title')
|
||||
)
|
||||
),*/
|
||||
19 => array( // admin log simulation
|
||||
'input' => "Array[!br!]([!br!] [0] => zero[!br!] [1] => one[!br!] [2] => two[!br!])[!br!]",
|
||||
'expected' => "Array[!br!]([!br!] [0] => zero[!br!] [1] => one[!br!] [2] => two[!br!])[!br!]",
|
||||
'mode' => 'no_html',
|
||||
),
|
||||
20 => array(
|
||||
'input' => '\\',
|
||||
'expected' => '\',
|
||||
'mode' => 'no_html',
|
||||
),
|
||||
21 => array(
|
||||
'input' => '<a href="">Hello</a>',
|
||||
'expected' => '<a href="">Hello</a>',
|
||||
'mode' => 'no_html',
|
||||
),
|
||||
|
||||
);
|
||||
|
||||
foreach($tests as $var)
|
||||
foreach($tests as $k=>$var)
|
||||
{
|
||||
if(empty($var['input']))
|
||||
{
|
||||
@ -336,10 +351,9 @@ TMP;
|
||||
$parm = varset($var['parm']);
|
||||
|
||||
$result = $this->tp->toDB($var['input'], false, false, $mode, $parm);
|
||||
// $this->assertEquals($var['expected'], $result);
|
||||
// FIXME: This test doesn't do anything?
|
||||
}
|
||||
$this->assertEquals($var['expected'], $result, 'Test #'.$k." failed.");
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user