class NativeFileSessionHandlerTest in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/symfony/http-foundation/Tests/Session/Storage/Handler/NativeFileSessionHandlerTest.php \Symfony\Component\HttpFoundation\Tests\Session\Storage\Handler\NativeFileSessionHandlerTest
Test class for NativeFileSessionHandler.
@author Drak <drak@zikula.org>
@runTestsInSeparateProcesses @preserveGlobalState disabled
Hierarchy
- class \Symfony\Component\HttpFoundation\Tests\Session\Storage\Handler\NativeFileSessionHandlerTest extends \Symfony\Component\HttpFoundation\Tests\Session\Storage\Handler\PHPUnit_Framework_TestCase
Expanded class hierarchy of NativeFileSessionHandlerTest
File
- vendor/
symfony/ http-foundation/ Tests/ Session/ Storage/ Handler/ NativeFileSessionHandlerTest.php, line 25
Namespace
Symfony\Component\HttpFoundation\Tests\Session\Storage\HandlerView source
class NativeFileSessionHandlerTest extends \PHPUnit_Framework_TestCase {
public function testConstruct() {
$storage = new NativeSessionStorage(array(
'name' => 'TESTING',
), new NativeFileSessionHandler(sys_get_temp_dir()));
if (PHP_VERSION_ID < 50400) {
$this
->assertEquals('files', $storage
->getSaveHandler()
->getSaveHandlerName());
$this
->assertEquals('files', ini_get('session.save_handler'));
}
else {
$this
->assertEquals('files', $storage
->getSaveHandler()
->getSaveHandlerName());
$this
->assertEquals('user', ini_get('session.save_handler'));
}
$this
->assertEquals(sys_get_temp_dir(), ini_get('session.save_path'));
$this
->assertEquals('TESTING', ini_get('session.name'));
}
/**
* @dataProvider savePathDataProvider
*/
public function testConstructSavePath($savePath, $expectedSavePath, $path) {
$handler = new NativeFileSessionHandler($savePath);
$this
->assertEquals($expectedSavePath, ini_get('session.save_path'));
$this
->assertTrue(is_dir(realpath($path)));
rmdir($path);
}
public function savePathDataProvider() {
$base = sys_get_temp_dir();
return array(
array(
"{$base}/foo",
"{$base}/foo",
"{$base}/foo",
),
array(
"5;{$base}/foo",
"5;{$base}/foo",
"{$base}/foo",
),
array(
"5;0600;{$base}/foo",
"5;0600;{$base}/foo",
"{$base}/foo",
),
);
}
/**
* @expectedException \InvalidArgumentException
*/
public function testConstructException() {
$handler = new NativeFileSessionHandler('something;invalid;with;too-many-args');
}
public function testConstructDefault() {
$path = ini_get('session.save_path');
$storage = new NativeSessionStorage(array(
'name' => 'TESTING',
), new NativeFileSessionHandler());
$this
->assertEquals($path, ini_get('session.save_path'));
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
NativeFileSessionHandlerTest:: |
public | function | ||
NativeFileSessionHandlerTest:: |
public | function | ||
NativeFileSessionHandlerTest:: |
public | function | ||
NativeFileSessionHandlerTest:: |
public | function | @expectedException \InvalidArgumentException | |
NativeFileSessionHandlerTest:: |
public | function | @dataProvider savePathDataProvider |