You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
812 B
37 lines
812 B
11 years ago
|
<?php
|
||
|
|
||
|
namespace yiiunit\framework\web;
|
||
|
|
||
|
use Yii;
|
||
|
use yii\caching\FileCache;
|
||
|
use yii\web\CacheSession;
|
||
|
|
||
|
/**
|
||
|
* @group web
|
||
|
*/
|
||
|
class CacheSessionTest extends \yiiunit\TestCase
|
||
|
{
|
||
11 years ago
|
protected function setUp()
|
||
|
{
|
||
|
parent::setUp();
|
||
|
$this->mockApplication();
|
||
11 years ago
|
Yii::$app->set('cache', new FileCache());
|
||
11 years ago
|
}
|
||
11 years ago
|
|
||
11 years ago
|
public function testCacheSession()
|
||
|
{
|
||
|
$session = new CacheSession();
|
||
11 years ago
|
|
||
11 years ago
|
$session->writeSession('test', 'sessionData');
|
||
|
$this->assertEquals('sessionData', $session->readSession('test'));
|
||
|
$session->destroySession('test');
|
||
|
$this->assertEquals('', $session->readSession('test'));
|
||
|
}
|
||
11 years ago
|
|
||
11 years ago
|
public function testInvalidCache()
|
||
|
{
|
||
11 years ago
|
$this->setExpectedException('\Exception');
|
||
11 years ago
|
new CacheSession(['cache' => 'invalid']);
|
||
|
}
|
||
11 years ago
|
}
|