cakephp2-php8/lib/Cake/Test/Case/Controller/Component/CookieComponentTest.php

603 lines
17 KiB
PHP
Raw Normal View History

<?php
/**
2009-03-19 21:10:13 +00:00
* CookieComponentTest file
*
* PHP 5
*
2010-05-19 01:15:13 +00:00
* CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
2012-03-13 02:46:07 +00:00
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice
*
2012-03-13 02:46:07 +00:00
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
2010-05-19 01:15:13 +00:00
* @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
* @package Cake.Test.Case.Controller.Component
* @since CakePHP(tm) v 1.2.0.5435
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
2010-12-09 05:55:24 +00:00
App::uses('Component', 'Controller');
App::uses('Controller', 'Controller');
App::uses('CookieComponent', 'Controller/Component');
2009-07-26 09:59:51 +00:00
2009-03-19 21:10:13 +00:00
/**
* CookieComponentTestController class
*
* @package Cake.Test.Case.Controller.Component
2009-03-19 21:10:13 +00:00
*/
class CookieComponentTestController extends Controller {
2009-03-19 21:10:13 +00:00
/**
* components property
*
* @var array
*/
public $components = array('Cookie');
2009-03-19 21:10:13 +00:00
/**
* beforeFilter method
*
* @return void
*/
public function beforeFilter() {
$this->Cookie->name = 'CakeTestCookie';
$this->Cookie->time = 10;
$this->Cookie->path = '/';
$this->Cookie->domain = '';
$this->Cookie->secure = false;
$this->Cookie->key = 'somerandomhaskey';
}
}
/**
2009-03-19 21:10:13 +00:00
* CookieComponentTest class
*
* @package Cake.Test.Case.Controller.Component
*/
class CookieComponentTest extends CakeTestCase {
2009-03-19 21:10:13 +00:00
/**
* Controller property
*
* @var CookieComponentTestController
*/
public $Controller;
/**
* start
*
* @return void
*/
public function setUp() {
$_COOKIE = array();
$this->Controller = new CookieComponentTestController(new CakeRequest(), new CakeResponse());
$this->Controller->constructClasses();
$this->Cookie = $this->Controller->Cookie;
$this->Cookie->name = 'CakeTestCookie';
$this->Cookie->time = 10;
$this->Cookie->path = '/';
$this->Cookie->domain = '';
$this->Cookie->secure = false;
$this->Cookie->key = 'somerandomhaskey';
$this->Cookie->startup($this->Controller);
}
2009-03-19 21:10:13 +00:00
/**
* end
*
* @return void
*/
public function tearDown() {
$this->Cookie->destroy();
2009-03-19 21:10:13 +00:00
}
/**
* sets up some default cookie data.
*
* @return void
*/
protected function _setCookieData() {
2011-12-01 07:21:31 +00:00
$this->Cookie->write(array('Encrytped_array' => array('name' => 'CakePHP', 'version' => '1.2.0.x', 'tag' => 'CakePHP Rocks!')));
$this->Cookie->write(array('Encrytped_multi_cookies.name' => 'CakePHP'));
$this->Cookie->write(array('Encrytped_multi_cookies.version' => '1.2.0.x'));
$this->Cookie->write(array('Encrytped_multi_cookies.tag' => 'CakePHP Rocks!'));
2011-12-01 07:21:31 +00:00
$this->Cookie->write(array('Plain_array' => array('name' => 'CakePHP', 'version' => '1.2.0.x', 'tag' => 'CakePHP Rocks!')), null, false);
$this->Cookie->write(array('Plain_multi_cookies.name' => 'CakePHP'), null, false);
$this->Cookie->write(array('Plain_multi_cookies.version' => '1.2.0.x'), null, false);
$this->Cookie->write(array('Plain_multi_cookies.tag' => 'CakePHP Rocks!'), null, false);
}
/**
* test that initialize sets settings from components array
*
* @return void
*/
public function testSettings() {
$settings = array(
'time' => '5 days',
'path' => '/'
);
$Cookie = new CookieComponent(new ComponentCollection(), $settings);
$this->assertEquals($Cookie->time, $settings['time']);
$this->assertEquals($Cookie->path, $settings['path']);
}
/**
* testCookieName
*
* @return void
*/
public function testCookieName() {
$this->assertEquals($this->Cookie->name, 'CakeTestCookie');
}
/**
* testReadEncryptedCookieData
*
* @return void
*/
public function testReadEncryptedCookieData() {
$this->_setCookieData();
$data = $this->Cookie->read('Encrytped_array');
2011-12-01 07:21:31 +00:00
$expected = array('name' => 'CakePHP', 'version' => '1.2.0.x', 'tag' => 'CakePHP Rocks!');
$this->assertEquals($data, $expected);
$data = $this->Cookie->read('Encrytped_multi_cookies');
2011-12-01 07:21:31 +00:00
$expected = array('name' => 'CakePHP', 'version' => '1.2.0.x', 'tag' => 'CakePHP Rocks!');
$this->assertEquals($data, $expected);
}
/**
* testReadPlainCookieData
*
* @return void
*/
public function testReadPlainCookieData() {
$this->_setCookieData();
$data = $this->Cookie->read('Plain_array');
2011-12-01 07:21:31 +00:00
$expected = array('name' => 'CakePHP', 'version' => '1.2.0.x', 'tag' => 'CakePHP Rocks!');
$this->assertEquals($data, $expected);
$data = $this->Cookie->read('Plain_multi_cookies');
2011-12-01 07:21:31 +00:00
$expected = array('name' => 'CakePHP', 'version' => '1.2.0.x', 'tag' => 'CakePHP Rocks!');
$this->assertEquals($data, $expected);
}
/**
* test read() after switching the cookie name.
*
* @return void
*/
public function testReadWithNameSwitch() {
$_COOKIE = array(
'CakeTestCookie' => array(
'key' => 'value'
),
'OtherTestCookie' => array(
'key' => 'other value'
)
);
$this->assertEquals('value', $this->Cookie->read('key'));
$this->Cookie->name = 'OtherTestCookie';
$this->assertEquals('other value', $this->Cookie->read('key'));
}
/**
* test a simple write()
*
* @return void
*/
public function testWriteSimple() {
$this->Cookie->write('Testing', 'value');
$result = $this->Cookie->read('Testing');
$this->assertEquals('value', $result);
}
/**
* test write with httpOnly cookies
*
* @return void
*/
public function testWriteHttpOnly() {
$this->Cookie->httpOnly = true;
$this->Cookie->secure = false;
$this->Cookie->write('Testing', 'value', false);
$expected = array(
'name' => $this->Cookie->name . '[Testing]',
'value' => 'value',
'expire' => time() + 10,
'path' => '/',
'domain' => '',
'secure' => false,
'httpOnly' => true);
$result = $this->Controller->response->cookie($this->Cookie->name . '[Testing]');
$this->assertEquals($result, $expected);
}
/**
* test delete with httpOnly
*
* @return void
*/
public function testDeleteHttpOnly() {
$this->Cookie->httpOnly = true;
$this->Cookie->secure = false;
$this->Cookie->delete('Testing', false);
$expected = array(
'name' => $this->Cookie->name . '[Testing]',
'value' => '',
'expire' => time() - 42000,
'path' => '/',
'domain' => '',
'secure' => false,
'httpOnly' => true);
$result = $this->Controller->response->cookie($this->Cookie->name . '[Testing]');
$this->assertEquals($result, $expected);
}
/**
* testWritePlainCookieArray
*
* @return void
*/
public function testWritePlainCookieArray() {
$this->Cookie->write(array('name' => 'CakePHP', 'version' => '1.2.0.x', 'tag' => 'CakePHP Rocks!'), null, false);
$this->assertEquals($this->Cookie->read('name'), 'CakePHP');
$this->assertEquals($this->Cookie->read('version'), '1.2.0.x');
$this->assertEquals($this->Cookie->read('tag'), 'CakePHP Rocks!');
$this->Cookie->delete('name');
$this->Cookie->delete('version');
$this->Cookie->delete('tag');
}
/**
* test writing values that are not scalars
*
* @return void
*/
public function testWriteArrayValues() {
$this->Cookie->secure = false;
$this->Cookie->write('Testing', array(1, 2, 3), false);
$expected = array(
'name' => $this->Cookie->name . '[Testing]',
'value' => '[1,2,3]',
'expire' => time() + 10,
'path' => '/',
'domain' => '',
'secure' => false,
'httpOnly' => false);
$result = $this->Controller->response->cookie($this->Cookie->name . '[Testing]');
$this->assertEquals($result, $expected);
}
/**
* testReadingCookieValue
*
* @return void
*/
public function testReadingCookieValue() {
$this->_setCookieData();
$data = $this->Cookie->read();
$expected = array(
'Encrytped_array' => array(
'name' => 'CakePHP',
'version' => '1.2.0.x',
'tag' => 'CakePHP Rocks!'),
'Encrytped_multi_cookies' => array(
'name' => 'CakePHP',
'version' => '1.2.0.x',
'tag' => 'CakePHP Rocks!'),
'Plain_array' => array(
'name' => 'CakePHP',
'version' => '1.2.0.x',
'tag' => 'CakePHP Rocks!'),
'Plain_multi_cookies' => array(
'name' => 'CakePHP',
'version' => '1.2.0.x',
'tag' => 'CakePHP Rocks!'));
$this->assertEquals($data, $expected);
}
/**
* testDeleteCookieValue
*
* @return void
*/
public function testDeleteCookieValue() {
$this->_setCookieData();
$this->Cookie->delete('Encrytped_multi_cookies.name');
$data = $this->Cookie->read('Encrytped_multi_cookies');
2011-12-01 07:21:31 +00:00
$expected = array('version' => '1.2.0.x', 'tag' => 'CakePHP Rocks!');
$this->assertEquals($data, $expected);
$this->Cookie->delete('Encrytped_array');
$data = $this->Cookie->read('Encrytped_array');
$this->assertNull($data);
$this->Cookie->delete('Plain_multi_cookies.name');
$data = $this->Cookie->read('Plain_multi_cookies');
2011-12-01 07:21:31 +00:00
$expected = array('version' => '1.2.0.x', 'tag' => 'CakePHP Rocks!');
$this->assertEquals($data, $expected);
$this->Cookie->delete('Plain_array');
$data = $this->Cookie->read('Plain_array');
$this->assertNull($data);
}
/**
* testReadingCookieArray
*
* @return void
*/
public function testReadingCookieArray() {
$this->_setCookieData();
$data = $this->Cookie->read('Encrytped_array.name');
$expected = 'CakePHP';
$this->assertEquals($data, $expected);
$data = $this->Cookie->read('Encrytped_array.version');
$expected = '1.2.0.x';
$this->assertEquals($data, $expected);
$data = $this->Cookie->read('Encrytped_array.tag');
$expected = 'CakePHP Rocks!';
$this->assertEquals($data, $expected);
$data = $this->Cookie->read('Encrytped_multi_cookies.name');
$expected = 'CakePHP';
$this->assertEquals($data, $expected);
$data = $this->Cookie->read('Encrytped_multi_cookies.version');
$expected = '1.2.0.x';
$this->assertEquals($data, $expected);
$data = $this->Cookie->read('Encrytped_multi_cookies.tag');
$expected = 'CakePHP Rocks!';
$this->assertEquals($data, $expected);
$data = $this->Cookie->read('Plain_array.name');
$expected = 'CakePHP';
$this->assertEquals($data, $expected);
$data = $this->Cookie->read('Plain_array.version');
$expected = '1.2.0.x';
$this->assertEquals($data, $expected);
$data = $this->Cookie->read('Plain_array.tag');
$expected = 'CakePHP Rocks!';
$this->assertEquals($data, $expected);
$data = $this->Cookie->read('Plain_multi_cookies.name');
$expected = 'CakePHP';
$this->assertEquals($data, $expected);
$data = $this->Cookie->read('Plain_multi_cookies.version');
$expected = '1.2.0.x';
$this->assertEquals($data, $expected);
$data = $this->Cookie->read('Plain_multi_cookies.tag');
$expected = 'CakePHP Rocks!';
$this->assertEquals($data, $expected);
}
/**
* testReadingCookieDataOnStartup
*
* @return void
*/
public function testReadingCookieDataOnStartup() {
$data = $this->Cookie->read('Encrytped_array');
$this->assertNull($data);
$data = $this->Cookie->read('Encrytped_multi_cookies');
$this->assertNull($data);
$data = $this->Cookie->read('Plain_array');
$this->assertNull($data);
$data = $this->Cookie->read('Plain_multi_cookies');
$this->assertNull($data);
$_COOKIE['CakeTestCookie'] = array(
2011-12-01 07:21:31 +00:00
'Encrytped_array' => $this->__encrypt(array('name' => 'CakePHP', 'version' => '1.2.0.x', 'tag' => 'CakePHP Rocks!')),
'Encrytped_multi_cookies' => array(
'name' => $this->__encrypt('CakePHP'),
'version' => $this->__encrypt('1.2.0.x'),
'tag' => $this->__encrypt('CakePHP Rocks!')),
'Plain_array' => '{"name":"CakePHP","version":"1.2.0.x","tag":"CakePHP Rocks!"}',
'Plain_multi_cookies' => array(
'name' => 'CakePHP',
'version' => '1.2.0.x',
'tag' => 'CakePHP Rocks!'));
2012-02-23 14:23:59 +00:00
$this->Cookie->startup(new CookieComponentTestController());
$data = $this->Cookie->read('Encrytped_array');
2011-12-01 07:21:31 +00:00
$expected = array('name' => 'CakePHP', 'version' => '1.2.0.x', 'tag' => 'CakePHP Rocks!');
$this->assertEquals($expected, $data);
$data = $this->Cookie->read('Encrytped_multi_cookies');
2011-12-01 07:21:31 +00:00
$expected = array('name' => 'CakePHP', 'version' => '1.2.0.x', 'tag' => 'CakePHP Rocks!');
$this->assertEquals($expected, $data);
$data = $this->Cookie->read('Plain_array');
2011-12-01 07:21:31 +00:00
$expected = array('name' => 'CakePHP', 'version' => '1.2.0.x', 'tag' => 'CakePHP Rocks!');
$this->assertEquals($expected, $data);
$data = $this->Cookie->read('Plain_multi_cookies');
2011-12-01 07:21:31 +00:00
$expected = array('name' => 'CakePHP', 'version' => '1.2.0.x', 'tag' => 'CakePHP Rocks!');
$this->assertEquals($expected, $data);
$this->Cookie->destroy();
unset($_COOKIE['CakeTestCookie']);
}
/**
* testReadingCookieDataWithoutStartup
*
* @return void
*/
public function testReadingCookieDataWithoutStartup() {
$data = $this->Cookie->read('Encrytped_array');
$expected = null;
$this->assertEquals($expected, $data);
$data = $this->Cookie->read('Encrytped_multi_cookies');
$expected = null;
$this->assertEquals($expected, $data);
$data = $this->Cookie->read('Plain_array');
$expected = null;
$this->assertEquals($expected, $data);
$data = $this->Cookie->read('Plain_multi_cookies');
$expected = null;
$this->assertEquals($expected, $data);
$_COOKIE['CakeTestCookie'] = array(
2011-12-01 07:21:31 +00:00
'Encrytped_array' => $this->__encrypt(array('name' => 'CakePHP', 'version' => '1.2.0.x', 'tag' => 'CakePHP Rocks!')),
'Encrytped_multi_cookies' => array(
'name' => $this->__encrypt('CakePHP'),
'version' => $this->__encrypt('1.2.0.x'),
'tag' => $this->__encrypt('CakePHP Rocks!')),
'Plain_array' => '{"name":"CakePHP","version":"1.2.0.x","tag":"CakePHP Rocks!"}',
'Plain_multi_cookies' => array(
'name' => 'CakePHP',
'version' => '1.2.0.x',
'tag' => 'CakePHP Rocks!'));
$data = $this->Cookie->read('Encrytped_array');
2011-12-01 07:21:31 +00:00
$expected = array('name' => 'CakePHP', 'version' => '1.2.0.x', 'tag' => 'CakePHP Rocks!');
$this->assertEquals($expected, $data);
$data = $this->Cookie->read('Encrytped_multi_cookies');
2011-12-01 07:21:31 +00:00
$expected = array('name' => 'CakePHP', 'version' => '1.2.0.x', 'tag' => 'CakePHP Rocks!');
$this->assertEquals($expected, $data);
$data = $this->Cookie->read('Plain_array');
2011-12-01 07:21:31 +00:00
$expected = array('name' => 'CakePHP', 'version' => '1.2.0.x', 'tag' => 'CakePHP Rocks!');
$this->assertEquals($expected, $data);
$data = $this->Cookie->read('Plain_multi_cookies');
2011-12-01 07:21:31 +00:00
$expected = array('name' => 'CakePHP', 'version' => '1.2.0.x', 'tag' => 'CakePHP Rocks!');
$this->assertEquals($expected, $data);
$this->Cookie->destroy();
unset($_COOKIE['CakeTestCookie']);
}
/**
* Test Reading legacy cookie values.
*
* @return void
*/
public function testReadLegacyCookieValue() {
$_COOKIE['CakeTestCookie'] = array(
'Legacy' => array('value' => $this->_oldImplode(array(1, 2, 3)))
);
$result = $this->Cookie->read('Legacy.value');
$expected = array(1, 2, 3);
$this->assertEquals($expected, $result);
}
/**
* Test reading empty values.
*/
public function testReadEmpty() {
$_COOKIE['CakeTestCookie'] = array(
'JSON' => '{"name":"value"}',
'Empty' => '',
'String' => '{"somewhat:"broken"}'
);
$this->assertEqual(array('name' => 'value'), $this->Cookie->read('JSON'));
$this->assertEqual('value', $this->Cookie->read('JSON.name'));
$this->assertEqual('', $this->Cookie->read('Empty'));
$this->assertEqual('{"somewhat:"broken"}', $this->Cookie->read('String'));
}
/**
* test that no error is issued for non array data.
*
* @return void
*/
public function testNoErrorOnNonArrayData() {
$this->Cookie->destroy();
$_COOKIE['CakeTestCookie'] = 'kaboom';
$this->assertNull($this->Cookie->read('value'));
}
/**
* test that deleting a top level keys kills the child elements too.
*
* @return void
*/
public function testDeleteRemovesChildren() {
$_COOKIE['CakeTestCookie'] = array(
'User' => array('email' => 'example@example.com', 'name' => 'mark'),
'other' => 'value'
);
$this->assertEquals('mark', $this->Cookie->read('User.name'));
$this->Cookie->delete('User');
$this->assertNull($this->Cookie->read('User.email'));
$this->Cookie->destroy();
}
2011-12-06 20:52:48 +00:00
Merge branch '1.3' into merger Conflicts: app/Config/acl.ini.php app/config/database.php.default app/webroot/css.php app/webroot/css/cake.generic.css cake/basics.php cake/bootstrap.php cake/config/paths.php cake/console/cake.php cake/console/error.php cake/console/libs/acl.php cake/console/libs/bake.php cake/console/libs/i18n.php cake/console/libs/shell.php cake/console/libs/tasks/extract.php cake/console/libs/tasks/plugin.php cake/console/libs/tasks/project.php cake/console/libs/testsuite.php cake/console/templates/default/classes/test.ctp cake/console/templates/default/views/home.ctp cake/console/templates/default/views/view.ctp cake/console/templates/skel/config/database.php.default cake/console/templates/skel/views/elements/email/text/default.ctp cake/console/templates/skel/webroot/css.php cake/dispatcher.php cake/libs/cache.php cake/libs/cake_session.php cake/libs/configure.php cake/libs/controller/component.php cake/libs/controller/components/auth.php cake/libs/controller/components/email.php cake/libs/controller/components/request_handler.php cake/libs/controller/components/security.php cake/libs/controller/controller.php cake/libs/controller/scaffold.php cake/libs/error.php cake/libs/magic_db.php cake/libs/model/behaviors/acl.php cake/libs/model/connection_manager.php cake/libs/model/datasources/dbo/dbo_mysqli.php cake/libs/model/model_behavior.php cake/libs/overloadable.php cake/libs/overloadable_php4.php cake/libs/overloadable_php5.php cake/libs/router.php cake/libs/view/errors/missing_action.ctp cake/libs/view/errors/missing_behavior_class.ctp cake/libs/view/errors/missing_behavior_file.ctp cake/libs/view/errors/missing_component_class.ctp cake/libs/view/errors/missing_component_file.ctp cake/libs/view/errors/missing_connection.ctp cake/libs/view/errors/missing_controller.ctp cake/libs/view/errors/missing_helper_class.ctp cake/libs/view/errors/missing_helper_file.ctp cake/libs/view/errors/missing_layout.ctp cake/libs/view/errors/missing_model.ctp cake/libs/view/errors/missing_scaffolddb.ctp cake/libs/view/errors/missing_table.ctp cake/libs/view/errors/missing_view.ctp cake/libs/view/errors/private_action.ctp cake/libs/view/errors/scaffold_error.ctp cake/libs/view/helpers/ajax.php cake/libs/view/helpers/javascript.php cake/libs/view/helpers/js.php cake/libs/view/helpers/session.php cake/libs/view/helpers/xml.php cake/libs/view/media.php cake/libs/view/pages/home.ctp cake/libs/view/scaffolds/edit.ctp cake/libs/view/scaffolds/index.ctp cake/libs/view/scaffolds/view.ctp cake/libs/view/view.php cake/libs/xml.php cake/tests/cases/console/cake.test.php cake/tests/cases/console/libs/acl.test.php cake/tests/cases/console/libs/api.test.php cake/tests/cases/console/libs/bake.test.php cake/tests/cases/console/libs/shell.test.php cake/tests/cases/console/libs/tasks/controller.test.php cake/tests/cases/console/libs/tasks/db_config.test.php cake/tests/cases/console/libs/tasks/fixture.test.php cake/tests/cases/console/libs/tasks/model.test.php cake/tests/cases/console/libs/tasks/plugin.test.php cake/tests/cases/console/libs/tasks/project.test.php cake/tests/cases/console/libs/tasks/test.test.php cake/tests/cases/console/libs/tasks/view.test.php cake/tests/cases/dispatcher.test.php cake/tests/cases/libs/cache/apc.test.php cake/tests/cases/libs/cake_session.test.php cake/tests/cases/libs/cake_test_case.test.php cake/tests/cases/libs/code_coverage_manager.test.php cake/tests/cases/libs/configure.test.php cake/tests/cases/libs/controller/component.test.php cake/tests/cases/libs/controller/components/auth.test.php cake/tests/cases/libs/controller/components/cookie.test.php cake/tests/cases/libs/controller/components/request_handler.test.php cake/tests/cases/libs/controller/components/session.test.php cake/tests/cases/libs/controller/controller.test.php cake/tests/cases/libs/controller/pages_controller.test.php cake/tests/cases/libs/error.test.php cake/tests/cases/libs/http_socket.test.php cake/tests/cases/libs/magic_db.test.php cake/tests/cases/libs/model/datasources/dbo/dbo_mssql.test.php cake/tests/cases/libs/model/datasources/dbo/dbo_mysql.test.php cake/tests/cases/libs/model/datasources/dbo/dbo_mysqli.test.php cake/tests/cases/libs/model/datasources/dbo_source.test.php cake/tests/cases/libs/model/models.php cake/tests/cases/libs/overloadable.test.php cake/tests/cases/libs/test_manager.test.php cake/tests/cases/libs/view/helpers/ajax.test.php cake/tests/cases/libs/view/helpers/javascript.test.php cake/tests/cases/libs/view/helpers/session.test.php cake/tests/cases/libs/view/helpers/xml.test.php cake/tests/cases/libs/view/media.test.php cake/tests/cases/libs/view/theme.test.php cake/tests/cases/libs/xml.test.php cake/tests/fixtures/aco_fixture.php cake/tests/fixtures/translate_fixture.php cake/tests/groups/acl.group.php cake/tests/groups/bake.group.php cake/tests/groups/behaviors.group.php cake/tests/groups/cache.group.php cake/tests/groups/components.group.php cake/tests/groups/configure.group.php cake/tests/groups/console.group.php cake/tests/groups/controller.group.php cake/tests/groups/database.group.php cake/tests/groups/helpers.group.php cake/tests/groups/i18n.group.php cake/tests/groups/javascript.group.php cake/tests/groups/lib.group.php cake/tests/groups/model.group.php cake/tests/groups/no_cross_contamination.group.php cake/tests/groups/routing_system.group.php cake/tests/groups/socket.group.php cake/tests/groups/test_suite.group.php cake/tests/groups/view.group.php cake/tests/groups/xml.group.php cake/tests/lib/cake_test_case.php cake/tests/lib/cake_test_model.php cake/tests/lib/cake_test_suite_dispatcher.php cake/tests/lib/cake_web_test_case.php cake/tests/lib/code_coverage_manager.php cake/tests/lib/reporter/cake_base_reporter.php cake/tests/lib/reporter/cake_cli_reporter.php cake/tests/lib/reporter/cake_text_reporter.php cake/tests/lib/templates/menu.php cake/tests/lib/templates/simpletest.php cake/tests/lib/test_manager.php cake/tests/test_app/controllers/tests_apps_controller.php cake/tests/test_app/libs/cache/test_app_cache.php cake/tests/test_app/libs/library.php cake/tests/test_app/libs/log/test_app_log.php cake/tests/test_app/plugins/test_plugin/config/load.php cake/tests/test_app/plugins/test_plugin/config/more.load.php cake/tests/test_app/plugins/test_plugin/controllers/components/other_component.php cake/tests/test_app/plugins/test_plugin/controllers/components/plugins_component.php cake/tests/test_app/plugins/test_plugin/controllers/components/test_plugin_component.php cake/tests/test_app/plugins/test_plugin/controllers/components/test_plugin_other_component.php cake/tests/test_app/plugins/test_plugin/controllers/test_plugin_controller.php cake/tests/test_app/plugins/test_plugin/controllers/tests_controller.php cake/tests/test_app/plugins/test_plugin/libs/cache/test_plugin_cache.php cake/tests/test_app/plugins/test_plugin/libs/log/test_plugin_log.php cake/tests/test_app/plugins/test_plugin/libs/test_plugin_library.php cake/tests/test_app/plugins/test_plugin/test_plugin_app_controller.php cake/tests/test_app/plugins/test_plugin/test_plugin_app_model.php cake/tests/test_app/plugins/test_plugin/vendors/sample/sample_plugin.php cake/tests/test_app/plugins/test_plugin/vendors/welcome.php cake/tests/test_app/plugins/test_plugin/views/helpers/other_helper.php cake/tests/test_app/plugins/test_plugin/views/helpers/plugged_helper.php cake/tests/test_app/vendors/Test/MyTest.php cake/tests/test_app/vendors/Test/hello.php cake/tests/test_app/vendors/sample/configure_test_vendor_sample.php cake/tests/test_app/vendors/shells/sample.php cake/tests/test_app/vendors/somename/some.name.php cake/tests/test_app/vendors/welcome.php cake/tests/test_app/views/elements/email/text/default.ctp cake/tests/test_app/views/layouts/default.ctp cake/tests/test_app/views/posts/test_nocache_tags.ctp lib/Cake/Cache/Engine/MemcacheEngine.php lib/Cake/Config/config.php lib/Cake/Console/Command/Task/ModelTask.php lib/Cake/Console/Templates/skel/webroot/css/cake.generic.css lib/Cake/Console/Templates/skel/webroot/test.php lib/Cake/Console/cake.bat lib/Cake/Controller/Component/CookieComponent.php lib/Cake/Log/CakeLog.php lib/Cake/Model/CakeSchema.php lib/Cake/Test/Case/Log/Engine/FileLog.php lib/Cake/Test/Case/View/Helper/FormHelperTest.php lib/Cake/Test/test_app/View/Emails/html/custom.ctp lib/Cake/Test/test_app/View/Emails/text/custom.ctp lib/Cake/TestSuite/templates/header.php lib/Cake/Utility/Sanitize.php lib/Cake/Utility/Validation.php lib/Cake/VERSION.txt lib/Cake/View/Helper/FormHelper.php
2011-06-23 19:48:06 +00:00
/**
* Test deleting recursively with keys that don't exist.
*
* @return void
*/
2012-02-17 07:13:12 +00:00
public function testDeleteChildrenNotExist() {
2011-06-23 20:22:08 +00:00
$this->assertNull($this->Cookie->delete('NotFound'));
$this->assertNull($this->Cookie->delete('Not.Found'));
Merge branch '1.3' into merger Conflicts: app/Config/acl.ini.php app/config/database.php.default app/webroot/css.php app/webroot/css/cake.generic.css cake/basics.php cake/bootstrap.php cake/config/paths.php cake/console/cake.php cake/console/error.php cake/console/libs/acl.php cake/console/libs/bake.php cake/console/libs/i18n.php cake/console/libs/shell.php cake/console/libs/tasks/extract.php cake/console/libs/tasks/plugin.php cake/console/libs/tasks/project.php cake/console/libs/testsuite.php cake/console/templates/default/classes/test.ctp cake/console/templates/default/views/home.ctp cake/console/templates/default/views/view.ctp cake/console/templates/skel/config/database.php.default cake/console/templates/skel/views/elements/email/text/default.ctp cake/console/templates/skel/webroot/css.php cake/dispatcher.php cake/libs/cache.php cake/libs/cake_session.php cake/libs/configure.php cake/libs/controller/component.php cake/libs/controller/components/auth.php cake/libs/controller/components/email.php cake/libs/controller/components/request_handler.php cake/libs/controller/components/security.php cake/libs/controller/controller.php cake/libs/controller/scaffold.php cake/libs/error.php cake/libs/magic_db.php cake/libs/model/behaviors/acl.php cake/libs/model/connection_manager.php cake/libs/model/datasources/dbo/dbo_mysqli.php cake/libs/model/model_behavior.php cake/libs/overloadable.php cake/libs/overloadable_php4.php cake/libs/overloadable_php5.php cake/libs/router.php cake/libs/view/errors/missing_action.ctp cake/libs/view/errors/missing_behavior_class.ctp cake/libs/view/errors/missing_behavior_file.ctp cake/libs/view/errors/missing_component_class.ctp cake/libs/view/errors/missing_component_file.ctp cake/libs/view/errors/missing_connection.ctp cake/libs/view/errors/missing_controller.ctp cake/libs/view/errors/missing_helper_class.ctp cake/libs/view/errors/missing_helper_file.ctp cake/libs/view/errors/missing_layout.ctp cake/libs/view/errors/missing_model.ctp cake/libs/view/errors/missing_scaffolddb.ctp cake/libs/view/errors/missing_table.ctp cake/libs/view/errors/missing_view.ctp cake/libs/view/errors/private_action.ctp cake/libs/view/errors/scaffold_error.ctp cake/libs/view/helpers/ajax.php cake/libs/view/helpers/javascript.php cake/libs/view/helpers/js.php cake/libs/view/helpers/session.php cake/libs/view/helpers/xml.php cake/libs/view/media.php cake/libs/view/pages/home.ctp cake/libs/view/scaffolds/edit.ctp cake/libs/view/scaffolds/index.ctp cake/libs/view/scaffolds/view.ctp cake/libs/view/view.php cake/libs/xml.php cake/tests/cases/console/cake.test.php cake/tests/cases/console/libs/acl.test.php cake/tests/cases/console/libs/api.test.php cake/tests/cases/console/libs/bake.test.php cake/tests/cases/console/libs/shell.test.php cake/tests/cases/console/libs/tasks/controller.test.php cake/tests/cases/console/libs/tasks/db_config.test.php cake/tests/cases/console/libs/tasks/fixture.test.php cake/tests/cases/console/libs/tasks/model.test.php cake/tests/cases/console/libs/tasks/plugin.test.php cake/tests/cases/console/libs/tasks/project.test.php cake/tests/cases/console/libs/tasks/test.test.php cake/tests/cases/console/libs/tasks/view.test.php cake/tests/cases/dispatcher.test.php cake/tests/cases/libs/cache/apc.test.php cake/tests/cases/libs/cake_session.test.php cake/tests/cases/libs/cake_test_case.test.php cake/tests/cases/libs/code_coverage_manager.test.php cake/tests/cases/libs/configure.test.php cake/tests/cases/libs/controller/component.test.php cake/tests/cases/libs/controller/components/auth.test.php cake/tests/cases/libs/controller/components/cookie.test.php cake/tests/cases/libs/controller/components/request_handler.test.php cake/tests/cases/libs/controller/components/session.test.php cake/tests/cases/libs/controller/controller.test.php cake/tests/cases/libs/controller/pages_controller.test.php cake/tests/cases/libs/error.test.php cake/tests/cases/libs/http_socket.test.php cake/tests/cases/libs/magic_db.test.php cake/tests/cases/libs/model/datasources/dbo/dbo_mssql.test.php cake/tests/cases/libs/model/datasources/dbo/dbo_mysql.test.php cake/tests/cases/libs/model/datasources/dbo/dbo_mysqli.test.php cake/tests/cases/libs/model/datasources/dbo_source.test.php cake/tests/cases/libs/model/models.php cake/tests/cases/libs/overloadable.test.php cake/tests/cases/libs/test_manager.test.php cake/tests/cases/libs/view/helpers/ajax.test.php cake/tests/cases/libs/view/helpers/javascript.test.php cake/tests/cases/libs/view/helpers/session.test.php cake/tests/cases/libs/view/helpers/xml.test.php cake/tests/cases/libs/view/media.test.php cake/tests/cases/libs/view/theme.test.php cake/tests/cases/libs/xml.test.php cake/tests/fixtures/aco_fixture.php cake/tests/fixtures/translate_fixture.php cake/tests/groups/acl.group.php cake/tests/groups/bake.group.php cake/tests/groups/behaviors.group.php cake/tests/groups/cache.group.php cake/tests/groups/components.group.php cake/tests/groups/configure.group.php cake/tests/groups/console.group.php cake/tests/groups/controller.group.php cake/tests/groups/database.group.php cake/tests/groups/helpers.group.php cake/tests/groups/i18n.group.php cake/tests/groups/javascript.group.php cake/tests/groups/lib.group.php cake/tests/groups/model.group.php cake/tests/groups/no_cross_contamination.group.php cake/tests/groups/routing_system.group.php cake/tests/groups/socket.group.php cake/tests/groups/test_suite.group.php cake/tests/groups/view.group.php cake/tests/groups/xml.group.php cake/tests/lib/cake_test_case.php cake/tests/lib/cake_test_model.php cake/tests/lib/cake_test_suite_dispatcher.php cake/tests/lib/cake_web_test_case.php cake/tests/lib/code_coverage_manager.php cake/tests/lib/reporter/cake_base_reporter.php cake/tests/lib/reporter/cake_cli_reporter.php cake/tests/lib/reporter/cake_text_reporter.php cake/tests/lib/templates/menu.php cake/tests/lib/templates/simpletest.php cake/tests/lib/test_manager.php cake/tests/test_app/controllers/tests_apps_controller.php cake/tests/test_app/libs/cache/test_app_cache.php cake/tests/test_app/libs/library.php cake/tests/test_app/libs/log/test_app_log.php cake/tests/test_app/plugins/test_plugin/config/load.php cake/tests/test_app/plugins/test_plugin/config/more.load.php cake/tests/test_app/plugins/test_plugin/controllers/components/other_component.php cake/tests/test_app/plugins/test_plugin/controllers/components/plugins_component.php cake/tests/test_app/plugins/test_plugin/controllers/components/test_plugin_component.php cake/tests/test_app/plugins/test_plugin/controllers/components/test_plugin_other_component.php cake/tests/test_app/plugins/test_plugin/controllers/test_plugin_controller.php cake/tests/test_app/plugins/test_plugin/controllers/tests_controller.php cake/tests/test_app/plugins/test_plugin/libs/cache/test_plugin_cache.php cake/tests/test_app/plugins/test_plugin/libs/log/test_plugin_log.php cake/tests/test_app/plugins/test_plugin/libs/test_plugin_library.php cake/tests/test_app/plugins/test_plugin/test_plugin_app_controller.php cake/tests/test_app/plugins/test_plugin/test_plugin_app_model.php cake/tests/test_app/plugins/test_plugin/vendors/sample/sample_plugin.php cake/tests/test_app/plugins/test_plugin/vendors/welcome.php cake/tests/test_app/plugins/test_plugin/views/helpers/other_helper.php cake/tests/test_app/plugins/test_plugin/views/helpers/plugged_helper.php cake/tests/test_app/vendors/Test/MyTest.php cake/tests/test_app/vendors/Test/hello.php cake/tests/test_app/vendors/sample/configure_test_vendor_sample.php cake/tests/test_app/vendors/shells/sample.php cake/tests/test_app/vendors/somename/some.name.php cake/tests/test_app/vendors/welcome.php cake/tests/test_app/views/elements/email/text/default.ctp cake/tests/test_app/views/layouts/default.ctp cake/tests/test_app/views/posts/test_nocache_tags.ctp lib/Cake/Cache/Engine/MemcacheEngine.php lib/Cake/Config/config.php lib/Cake/Console/Command/Task/ModelTask.php lib/Cake/Console/Templates/skel/webroot/css/cake.generic.css lib/Cake/Console/Templates/skel/webroot/test.php lib/Cake/Console/cake.bat lib/Cake/Controller/Component/CookieComponent.php lib/Cake/Log/CakeLog.php lib/Cake/Model/CakeSchema.php lib/Cake/Test/Case/Log/Engine/FileLog.php lib/Cake/Test/Case/View/Helper/FormHelperTest.php lib/Cake/Test/test_app/View/Emails/html/custom.ctp lib/Cake/Test/test_app/View/Emails/text/custom.ctp lib/Cake/TestSuite/templates/header.php lib/Cake/Utility/Sanitize.php lib/Cake/Utility/Validation.php lib/Cake/VERSION.txt lib/Cake/View/Helper/FormHelper.php
2011-06-23 19:48:06 +00:00
}
/**
* Helper method for generating old style encoded cookie values.
*
* @return string.
*/
protected function _oldImplode(array $array) {
$string = '';
foreach ($array as $key => $value) {
$string .= ',' . $key . '|' . $value;
}
return substr($string, 1);
}
/**
* Implode method to keep keys are multidimensional arrays
*
* @param array $array Map of key and values
* @return string String in the form key1|value1,key2|value2
*/
protected function _implode(array $array) {
return json_encode($array);
}
/**
2009-03-19 21:10:13 +00:00
* encrypt method
*
2009-03-19 21:10:13 +00:00
* @param mixed $value
* @return string
*/
2012-02-17 07:13:12 +00:00
protected function __encrypt($value) {
2009-03-19 21:10:13 +00:00
if (is_array($value)) {
$value = $this->_implode($value);
2009-03-19 21:10:13 +00:00
}
return "Q2FrZQ==." . base64_encode(Security::cipher($value, $this->Cookie->key));
2009-03-19 21:10:13 +00:00
}
}