public function NativeSessionStorageTest::testStartedOutside in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/symfony/http-foundation/Tests/Session/Storage/NativeSessionStorageTest.php \Symfony\Component\HttpFoundation\Tests\Session\Storage\NativeSessionStorageTest::testStartedOutside()
@expectedException \RuntimeException
File
- vendor/
symfony/ http-foundation/ Tests/ Session/ Storage/ NativeSessionStorageTest.php, line 226
Class
- NativeSessionStorageTest
- Test class for NativeSessionStorage.
Namespace
Symfony\Component\HttpFoundation\Tests\Session\StorageCode
public function testStartedOutside() {
$storage = $this
->getStorage();
$this
->assertFalse($storage
->getSaveHandler()
->isActive());
$this
->assertFalse($storage
->isStarted());
session_start();
$this
->assertTrue(isset($_SESSION));
if (PHP_VERSION_ID >= 50400) {
// this only works in PHP >= 5.4 where session_status is available
$this
->assertTrue($storage
->getSaveHandler()
->isActive());
}
// PHP session might have started, but the storage driver has not, so false is correct here
$this
->assertFalse($storage
->isStarted());
$key = $storage
->getMetadataBag()
->getStorageKey();
$this
->assertFalse(isset($_SESSION[$key]));
$storage
->start();
}