| Name | Size | Mode | Actions |
|---|---|---|---|
| CakeNumberTest.php | 23938 | 0644 | editdlrm |
| CakeTextTest.php | 32765 | 0644 | editdlrm |
| CakeTimeTest.php | 38921 | 0644 | editdlrm |
| ClassRegistryTest.php | 8553 | 0644 | editdlrm |
| DebuggerTest.php | 15459 | 0644 | editdlrm |
| FileTest.php | 15729 | 0644 | editdlrm |
| FolderTest.php | 36231 | 0644 | editdlrm |
| HashTest.php | 68138 | 0644 | editdlrm |
| InflectorTest.php | 27652 | 0644 | editdlrm |
| ObjectCollectionTest.php | 17426 | 0644 | editdlrm |
| SanitizeTest.php | 16232 | 0644 | editdlrm |
| SecurityTest.php | 11900 | 0644 | editdlrm |
| SetTest.php | 113838 | 0644 | editdlrm |
| ValidationTest.php | 110026 | 0644 | editdlrm |
| XmlTest.php | 30279 | 0644 | editdlrm |
/home/desid573/public_html/family/pdd/lib/Cake/Test/Case/Utility/SanitizeTest.php (16232B)
This is a test string & so is this
'; $expected = 'This is a test string & so is this'; $result = Sanitize::html($string, array('remove' => true)); $this->assertEquals($expected, $result); $string = 'The "lazy" dog \'jumped\' & flew over the moon. If (1+1) = 2 is true, (2-1) = 1 is also true'; $expected = 'The "lazy" dog 'jumped' & flew over the moon. If (1+1) = 2 <em>is</em> true, (2-1) = 1 is also true'; $result = Sanitize::html($string); $this->assertEquals($expected, $result); $string = 'The "lazy" dog \'jumped\''; $expected = 'The "lazy" dog \'jumped\''; $result = Sanitize::html($string, array('quotes' => ENT_COMPAT)); $this->assertEquals($expected, $result); $string = 'The "lazy" dog \'jumped\''; $result = Sanitize::html($string, array('quotes' => ENT_NOQUOTES)); $this->assertEquals($string, $result); $string = 'The "lazy" dog \'jumped\' & flew over the moon. If (1+1) = 2 is true, (2-1) = 1 is also true'; $expected = 'The "lazy" dog 'jumped' & flew over the moon. If (1+1) = 2 <em>is</em> true, (2-1) = 1 is also true'; $result = Sanitize::html($string); $this->assertEquals($expected, $result); $string = 'The "lazy" dog & his friend Apple® conquered the world'; $expected = 'The "lazy" dog & his friend Apple® conquered the world'; $result = Sanitize::html($string); $this->assertEquals($expected, $result); $string = 'The "lazy" dog & his friend Apple® conquered the world'; $expected = 'The "lazy" dog & his friend Apple® conquered the world'; $result = Sanitize::html($string, array('double' => false)); $this->assertEquals($expected, $result); } /** * testStripWhitespace method * * @return void */ public function testStripWhitespace() { $string = "This sentence \t\t\t has lots of \n\n white\nspace \rthat \r\n needs to be \t \n trimmed."; $expected = "This sentence has lots of whitespace that needs to be trimmed."; $result = Sanitize::stripWhitespace($string); $this->assertEquals($expected, $result); $text = 'I love ßá†ö√ letters.'; $result = Sanitize::stripWhitespace($text); $expected = 'I love ßá†ö√ letters.'; $this->assertEquals($expected, $result); } /** * testParanoid method * * @return void */ public function testParanoid() { $string = 'I would like to !%@#% & dance & sing ^$&*()-+'; $expected = 'Iwouldliketodancesing'; $result = Sanitize::paranoid($string); $this->assertEquals($expected, $result); $string = array('This |s th% s0ng that never ends it g*es', 'on and on my friends, b^ca#use it is the', 'so&g th===t never ends.'); $expected = array('This s th% s0ng that never ends it g*es', 'on and on my friends bcause it is the', 'sog tht never ends.'); $result = Sanitize::paranoid($string, array('%', '*', '.', ' ')); $this->assertEquals($expected, $result); $string = "anything' OR 1 = 1"; $expected = 'anythingOR11'; $result = Sanitize::paranoid($string); $this->assertEquals($expected, $result); $string = "x' AND email IS NULL; --"; $expected = 'xANDemailISNULL'; $result = Sanitize::paranoid($string); $this->assertEquals($expected, $result); $string = "x' AND 1=(SELECT COUNT(*) FROM users); --"; $expected = 'xAND1SELECTCOUNTFROMusers'; $result = Sanitize::paranoid($string); $this->assertEquals($expected, $result); $string = "x'; DROP TABLE members; --"; $expected = 'xDROPTABLEmembers'; $result = Sanitize::paranoid($string); $this->assertEquals($expected, $result); } /** * testStripImages method * * @return void */ public function testStripImages() { $string = '
';
$expected = 'my image
';
$expected = 'test image alt
';
$expected = '';
$result = Sanitize::stripImages($string);
$this->assertEquals($expected, $result);
}
/**
* testStripScripts method
*
* @return void
*/
public function testStripScripts() {
$string = '';
$expected = '';
$result = Sanitize::stripScripts($string);
$this->assertEquals($expected, $result);
$string = '' . "\n" .
'' . "\n" .
'' . "\n" .
'';
$expected = "\n" . '' . "\n" .
'' . "\n" .
'';
$result = Sanitize::stripScripts($string);
$this->assertEquals($expected, $result);
$string = '';
$expected = '';
$result = Sanitize::stripScripts($string);
$this->assertEquals($expected, $result);
$string = '';
$expected = '';
$result = Sanitize::stripScripts($string);
$this->assertEquals($expected, $result);
$string = '';
$expected = '';
$result = Sanitize::stripScripts($string);
$this->assertEquals($expected, $result);
$string = '';
$expected = '';
$result = Sanitize::stripScripts($string);
$this->assertEquals($expected, $result);
$string = <<
text
HTML;
$expected = "text\n\ntext";
$result = Sanitize::stripScripts($string);
$this->assertTextEquals($expected, $result);
$string = <<
text
HTML;
$expected = "text\n\ntext";
$result = Sanitize::stripScripts($string);
$this->assertTextEquals($expected, $result);
}
/**
* testStripAll method
*
* @return void
*/
public function testStripAll() {
$string = '
' . "\n" .
"This is ok \t\n text
\n" . '' . "\n" . ''; $expected = 'This is ok text
'; $result = Sanitize::stripAll($string); $this->assertEquals($expected, $result); } /** * testStripTags method * * @return void */ public function testStripTags() { $string = 'My Link could go to a bad site
'; $expected = 'HeadlineMy Link could go to a bad site
'; $result = Sanitize::stripTags($string, 'h2', 'a'); $this->assertEquals($expected, $result); $string = ''; $expected = ' '; $result = Sanitize::stripTags($string, 'script'); $this->assertEquals($expected, $result); $string = 'Additional information here
. Read even more here
Additional information here
. Read even more here
Additional information here
. Read even more here
Additional information here . Read even more here
'; $result = Sanitize::stripTags($string, 'h2', 'a', 'img'); $this->assertEquals($expected, $result); $string = 'Important message!Additional information here
. Read even more here
Additional information here . Read even more here
'; $result = Sanitize::stripTags($string, 'h2', 'a', 'img'); $this->assertEquals($expected, $result); } }