From 128ee07b78f83848f5ebeded650c6e89cb14675b Mon Sep 17 00:00:00 2001 From: Carsten Brandt Date: Wed, 18 Sep 2013 22:54:11 +0200 Subject: [PATCH] 100% test coverage for CacheSession --- tests/unit/framework/web/CacheSessionTest.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/tests/unit/framework/web/CacheSessionTest.php b/tests/unit/framework/web/CacheSessionTest.php index c80fa1c..e740596 100644 --- a/tests/unit/framework/web/CacheSessionTest.php +++ b/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', + )); } }