From 0b1978a5d0ae71531f41c1dfebf7e56643c73bf3 Mon Sep 17 00:00:00 2001 From: Cameron Date: Fri, 8 Mar 2019 12:13:16 -0800 Subject: [PATCH] userclass tests. --- tests/unit/class2Test.php | 5 ++++- tests/unit/e_parseTest.php | 22 ++++++++++++++++------ 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/tests/unit/class2Test.php b/tests/unit/class2Test.php index e344fab7a..efab25029 100644 --- a/tests/unit/class2Test.php +++ b/tests/unit/class2Test.php @@ -58,7 +58,10 @@ $this->assertTrue($result); $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); } diff --git a/tests/unit/e_parseTest.php b/tests/unit/e_parseTest.php index 123341b62..2f8f802b7 100644 --- a/tests/unit/e_parseTest.php +++ b/tests/unit/e_parseTest.php @@ -316,6 +316,12 @@ 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( + 'input' => '">', + 'expected' => '', + 'mode' => 'model', + 'parm' => array('type'=>'text', 'field'=>'news_title') + ) ); @@ -326,9 +332,12 @@ TMP; continue; } - $result = $this->tp->toDB($var['input']); - $this->assertEquals($var['expected'], $result); - // var_dump($result); + $mode = varset($var['mode']); + $parm = varset($var['parm']); + + $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 testUstrtolower() { @@ -816,14 +825,15 @@ TMP; { $tests = array( 0 => array('html' => " ''), - + 1 => array('html' => '', 'expected'=>''), + 2 => array('html' => '">', 'expected'=>'">'), ); foreach($tests as $var) { $result = $this->tp->cleanHtml($var['html']); - // var_dump($result); + var_dump($result); }