2018-09-16 14:08:09 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Engelsystem\Test\Unit\Http\SessionHandlers;
|
|
|
|
|
|
|
|
use Engelsystem\Test\Unit\Http\SessionHandlers\Stub\ArrayHandler;
|
|
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
|
|
|
|
class AbstractHandlerTest extends TestCase
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @covers \Engelsystem\Http\SessionHandlers\AbstractHandler::open
|
|
|
|
*/
|
2022-12-14 19:15:20 +01:00
|
|
|
public function testOpen(): void
|
2018-09-16 14:08:09 +02:00
|
|
|
{
|
|
|
|
$handler = new ArrayHandler();
|
|
|
|
$return = $handler->open('/foo/bar', '1337asd098hkl7654');
|
|
|
|
|
|
|
|
$this->assertTrue($return);
|
|
|
|
$this->assertEquals('1337asd098hkl7654', $handler->getName());
|
|
|
|
$this->assertEquals('/foo/bar', $handler->getSessionPath());
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @covers \Engelsystem\Http\SessionHandlers\AbstractHandler::close
|
|
|
|
*/
|
2022-12-14 19:15:20 +01:00
|
|
|
public function testClose(): void
|
2018-09-16 14:08:09 +02:00
|
|
|
{
|
|
|
|
$handler = new ArrayHandler();
|
|
|
|
$return = $handler->close();
|
|
|
|
|
|
|
|
$this->assertTrue($return);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @covers \Engelsystem\Http\SessionHandlers\AbstractHandler::gc
|
|
|
|
*/
|
2022-12-14 19:15:20 +01:00
|
|
|
public function testGc(): void
|
2018-09-16 14:08:09 +02:00
|
|
|
{
|
|
|
|
$handler = new ArrayHandler();
|
|
|
|
$return = $handler->gc(60 * 60 * 24);
|
|
|
|
|
2022-12-10 20:39:09 +01:00
|
|
|
$this->assertEquals(0, $return);
|
2018-09-16 14:08:09 +02:00
|
|
|
}
|
|
|
|
}
|