mirror of
https://github.com/yiisoft/yii.git
synced 2026-03-03 23:04:04 +01:00
* CCacheHttpSession::destroySession now always returns true * added CCacheHttpSessionTest
48 lines
1.0 KiB
PHP
48 lines
1.0 KiB
PHP
<?php
|
|
|
|
|
|
class CCacheHttpSessionTest extends CTestCase
|
|
{
|
|
/**
|
|
* @covers CCacheHttpSession::writeSession
|
|
* @covers CCacheHttpSession::readSession
|
|
* @covers CCacheHttpSession::destroySession
|
|
*/
|
|
public function testCustomSessionHandler()
|
|
{
|
|
$config=array(
|
|
'components'=>array(
|
|
'cache'=>array(
|
|
'class'=>'CFileCache',
|
|
),
|
|
),
|
|
);
|
|
new TestApplication($config);
|
|
|
|
$session=new CCacheHttpSession();
|
|
$session->init();
|
|
|
|
$this->assertTrue($session->destroySession('test'));
|
|
$this->assertEquals('',$session->readSession('test'));
|
|
|
|
$this->assertTrue($session->writeSession('test','any value'));
|
|
$this->assertEquals('any value',$session->readSession('test'));
|
|
|
|
$this->assertTrue($session->destroySession('test'));
|
|
$this->assertEquals('',$session->readSession('test'));
|
|
}
|
|
|
|
/**
|
|
* @covers CCacheHttpSession::init
|
|
*/
|
|
public function testInvalidCache()
|
|
{
|
|
$session=new CCacheHttpSession();
|
|
$session->cacheID='invalidCacheID';
|
|
|
|
$this->setExpectedException('CException');
|
|
|
|
$session->init();
|
|
}
|
|
}
|