Skip to content

Commit

Permalink
Updating tests to reflect API deprecations.
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed Sep 1, 2009
1 parent b5605b6 commit 4ee70c0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 40 deletions.
9 changes: 2 additions & 7 deletions cake/libs/controller/components/session.php
@@ -1,6 +1,4 @@
<?php
/* SVN FILE: $Id$ */

/**
* Short description for file.
*
Expand All @@ -9,20 +7,17 @@
* PHP versions 4 and 5
*
* CakePHP(tm) : Rapid Development Framework (http://www.cakephp.org)
* Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
* Copyright 2005-2009, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @filesource
* @copyright Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
* @copyright Copyright 2005-2009, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
* @link http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project
* @package cake
* @subpackage cake.cake.libs.controller.components
* @since CakePHP(tm) v 0.10.0.1232
* @version $Revision$
* @modifiedby $LastChangedBy$
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
if (!class_exists('cakesession')) {
Expand Down
40 changes: 7 additions & 33 deletions cake/tests/cases/libs/controller/components/session.test.php
@@ -1,6 +1,4 @@
<?php
/* SVN FILE: $Id$ */

/**
* SessionComponentTest file
*
Expand All @@ -9,20 +7,17 @@
* 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)
* Copyright 2005-2009, 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)
* @copyright Copyright 2005-2009, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
* @package cake
* @subpackage cake.tests.cases.libs.controller.components
* @since CakePHP(tm) v 1.2.0.5436
* @version $Revision$
* @modifiedby $LastChangedBy$
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
*/
App::import('Controller', 'Controller', false);
Expand Down Expand Up @@ -247,24 +242,24 @@ function testSessionReadWrite() {
$this->assertTrue($Session->write('Test', 'some value'));
$this->assertEqual($Session->read('Test'), 'some value');
$this->assertFalse($Session->write('Test.key', 'some value'));
$Session->del('Test');
$Session->delete('Test');

$this->assertTrue($Session->write('Test.key.path', 'some value'));
$this->assertEqual($Session->read('Test.key.path'), 'some value');
$this->assertEqual($Session->read('Test.key'), array('path' => 'some value'));
$this->assertTrue($Session->write('Test.key.path2', 'another value'));
$this->assertEqual($Session->read('Test.key'), array('path' => 'some value', 'path2' => 'another value'));
$Session->del('Test');
$Session->delete('Test');

$array = array('key1' => 'val1', 'key2' => 'val2', 'key3' => 'val3');
$this->assertTrue($Session->write('Test', $array));
$this->assertEqual($Session->read('Test'), $array);
$Session->del('Test');
$Session->delete('Test');

$this->assertFalse($Session->write(array('Test'), 'some value'));
$this->assertTrue($Session->write(array('Test' => 'some value')));
$this->assertEqual($Session->read('Test'), 'some value');
$Session->del('Test');
$Session->delete('Test');

Configure::write('Session.start', false);
$Session =& new SessionComponent();
Expand All @@ -274,27 +269,6 @@ function testSessionReadWrite() {
Configure::write('Session.start', true);
}

/**
* testSessionDel method
*
* @access public
* @return void
*/
function testSessionDel() {
$Session =& new SessionComponent();

$this->assertFalse($Session->del('Test'));

$Session->write('Test', 'some value');
$this->assertTrue($Session->del('Test'));

Configure::write('Session.start', false);
$Session =& new SessionComponent();
$Session->write('Test', 'some value');
$this->assertFalse($Session->del('Test'));
Configure::write('Session.start', true);
}

/**
* testSessionDelete method
*
Expand Down Expand Up @@ -361,7 +335,7 @@ function testSessionFlash() {
$Session->setFlash('This is a test message', 'non_existing_layout');
$this->assertEqual($Session->read('Message.myFlash'), array('message' => 'This is a test message', 'layout' => 'default', 'params' => array()));

$Session->del('Message');
$Session->delete('Message');
}

/**
Expand Down

0 comments on commit 4ee70c0

Please sign in to comment.