Extend session namespace tests

refs #4639
This commit is contained in:
Johannes Meyer 2014-04-11 09:36:09 +02:00
parent 3d62b8fda2
commit 6897db63a7
1 changed files with 23 additions and 0 deletions

View File

@ -5,6 +5,7 @@
namespace Tests\Icinga\Session;
use \Exception;
use \Mockery;
use Icinga\Test\BaseTestCase;
use Icinga\Web\Session\SessionNamespace;
@ -85,4 +86,26 @@ class SessionNamespaceTest extends BaseTestCase
$this->assertEquals($value, $values[$key]);
}
}
/**
* @expectedException Exception
* @expectedExceptionMessage Cannot save, session not set
*/
public function testInvalidParentWrite()
{
$ns = new SessionNamespace();
$ns->write();
}
/**
* Check whether it is possible to write a namespace's parent
*/
public function testValidParentWrite()
{
$sessionMock = Mockery::mock('Icinga\Web\Session\Session');
$sessionMock->shouldReceive('write')->atLeast()->times(1);
$ns = new SessionNamespace($sessionMock);
$ns->write();
}
}