mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
86 lines
No EOL
2.4 KiB
PHP
86 lines
No EOL
2.4 KiB
PHP
<?php
|
|
/* SVN FILE: $Id$ */
|
|
/**
|
|
* JsHelper Test Case
|
|
*
|
|
* TestCase for the JsHelper
|
|
*
|
|
* PHP versions 4 and 5
|
|
*
|
|
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
|
|
* Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
|
|
*
|
|
* Licensed under The Open Group Test Suite License
|
|
* Redistributions of files must retain the above copyright notice.
|
|
*
|
|
* @filesource
|
|
* @copyright Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
|
|
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
|
|
* @package cake.tests
|
|
* @subpackage cake.tests.cases.libs.view.helpers
|
|
* @since CakePHP(tm) v 1.2.0.4206
|
|
* @version $Revision$
|
|
* @modifiedby $LastChangedBy$
|
|
* @lastmodified $Date$
|
|
* @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
|
|
*/
|
|
App::import('Helper', 'Js');
|
|
|
|
/**
|
|
* JsHelper TestCase.
|
|
*
|
|
* @package cake.tests
|
|
* @subpackage cake.tests.cases.libs.view.helpers
|
|
*/
|
|
class JsHelperTestCase extends CakeTestCase {
|
|
/**
|
|
* setUp method
|
|
*
|
|
* @access public
|
|
* @return void
|
|
*/
|
|
function startTest() {
|
|
$this->Js = new JsHelper();
|
|
}
|
|
/**
|
|
* tearDown method
|
|
*
|
|
* @access public
|
|
* @return void
|
|
*/
|
|
function endTest() {
|
|
unset($this->Js);
|
|
}
|
|
/**
|
|
* test escape string skills
|
|
*
|
|
* @return void
|
|
**/
|
|
function testEscaping() {
|
|
$result = $this->Js->escape('');
|
|
$expected = '';
|
|
$this->assertEqual($result, $expected);
|
|
|
|
$result = $this->Js->escape('CakePHP' . "\n" . 'Rapid Development Framework');
|
|
$expected = 'CakePHP\\nRapid Development Framework';
|
|
$this->assertEqual($result, $expected);
|
|
|
|
$result = $this->Js->escape('CakePHP' . "\r\n" . 'Rapid Development Framework' . "\r" . 'For PHP');
|
|
$expected = 'CakePHP\\nRapid Development Framework\\nFor PHP';
|
|
$this->assertEqual($result, $expected);
|
|
|
|
$result = $this->Js->escape('CakePHP: "Rapid Development Framework"');
|
|
$expected = 'CakePHP: \\"Rapid Development Framework\\"';
|
|
$this->assertEqual($result, $expected);
|
|
|
|
$result = $this->Js->escape('CakePHP: \'Rapid Development Framework\'');
|
|
$expected = 'CakePHP: \\\'Rapid Development Framework\\\'';
|
|
$this->assertEqual($result, $expected);
|
|
|
|
$result = $this->Js->escape('my \\"string\\"');
|
|
$expected = 'my \\\"string\\\"';
|
|
$this->assertEqual($result, $expected);
|
|
}
|
|
}
|
|
|
|
?>
|