Browse Source

100% test coverage for CacheSession

tags/2.0.0-beta
Carsten Brandt 11 years ago
parent
commit
128ee07b78
  1. 13
      tests/unit/framework/web/CacheSessionTest.php

13
tests/unit/framework/web/CacheSessionTest.php

@ -18,11 +18,22 @@ class CacheSessionTest extends \yiiunit\TestCase
Yii::$app->setComponent('cache', new FileCache());
}
public function testCreate()
public function testCacheSession()
{
$session = new CacheSession();
$session->writeSession('test', 'sessionData');
$this->assertEquals('sessionData', $session->readSession('test'));
$session->destroySession('test');
$this->assertEquals('', $session->readSession('test'));
}
public function testInvalidCache()
{
$this->setExpectedException('yii\base\InvalidConfigException');
$session = new CacheSession(array(
'cache' => 'invalid',
));
}
}

Loading…
Cancel
Save