mirror of
https://github.com/e107inc/e107.git
synced 2025-08-01 20:30:39 +02:00
Additional tests for toDB()
This commit is contained in:
@@ -316,16 +316,31 @@ 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(
|
/* 18 => array(
|
||||||
'input' => '"><script>alert(123)</script>',
|
'input' => '"><script>alert(123)</script>',
|
||||||
'expected' => '',
|
'expected' => '',
|
||||||
'mode' => 'model',
|
'mode' => 'model',
|
||||||
'parm' => array('type'=>'text', 'field'=>'news_title')
|
'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']))
|
if(empty($var['input']))
|
||||||
{
|
{
|
||||||
@@ -336,10 +351,9 @@ TMP;
|
|||||||
$parm = varset($var['parm']);
|
$parm = varset($var['parm']);
|
||||||
|
|
||||||
$result = $this->tp->toDB($var['input'], false, false, $mode, $parm);
|
$result = $this->tp->toDB($var['input'], false, false, $mode, $parm);
|
||||||
// $this->assertEquals($var['expected'], $result);
|
$this->assertEquals($var['expected'], $result, 'Test #'.$k." failed.");
|
||||||
// FIXME: This test doesn't do anything?
|
|
||||||
}
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user