2013-06-10 14:21:17 +02:00
|
|
|
<?php
|
2013-06-10 17:03:01 +02:00
|
|
|
// {{{ICINGA_LICENSE_HEADER}}}
|
|
|
|
// {{{ICINGA_LICENSE_HEADER}}}
|
2013-06-10 14:21:17 +02:00
|
|
|
|
|
|
|
namespace Tests\Icinga\Authentication;
|
|
|
|
|
|
|
|
require_once("../../library/Icinga/Authentication/Session.php");
|
|
|
|
require_once("../../library/Icinga/Authentication/PhpSession.php");
|
|
|
|
require_once("../../library/Icinga/Application/Logger.php");
|
2013-06-25 12:24:52 +02:00
|
|
|
require_once("../../library/Icinga/Exception/ConfigurationError.php");
|
2013-06-10 14:21:17 +02:00
|
|
|
require_once("Zend/Log.php");
|
|
|
|
|
|
|
|
use Icinga\Authentication\PhpSession as PhpSession;
|
|
|
|
|
|
|
|
class PHPSessionTest extends \PHPUnit_Framework_TestCase
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @runInSeparateProcess
|
|
|
|
**/
|
|
|
|
public function testSessionCreation()
|
|
|
|
{
|
|
|
|
$session = new PhpSession();
|
|
|
|
$session = new PhpSession(array("ssesion.use_cookies"=>false));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @runInSeparateProcess
|
|
|
|
**/
|
|
|
|
public function testOpenSession()
|
|
|
|
{
|
|
|
|
$this->assertEquals(session_id(), '');
|
|
|
|
$session = new PhpSession();
|
|
|
|
$session->open();
|
|
|
|
$this->assertNotEquals(session_id(), '');
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @runInSeparateProcess
|
|
|
|
**/
|
|
|
|
public function testCloseSession()
|
|
|
|
{
|
|
|
|
|
|
|
|
$this->assertEquals(session_id(), '');
|
|
|
|
$session = new PhpSession();
|
|
|
|
$session->open();
|
|
|
|
$this->assertNotEquals(session_id(), '');
|
|
|
|
$session->close();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @runInSeparateProcess
|
|
|
|
**/
|
|
|
|
public function testPurgeSession()
|
|
|
|
{
|
|
|
|
$this->assertEquals(session_id(), '');
|
|
|
|
$session = new PhpSession();
|
|
|
|
$session->open();
|
|
|
|
$this->assertNotEquals(session_id(), '');
|
|
|
|
$session->purge();
|
|
|
|
$this->assertEquals(session_id(), '');
|
|
|
|
}
|
|
|
|
}
|