public function NativeSessionStorageTest::testCanStartOutside54

@expectedException \RuntimeException

File

drupal/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Storage/NativeSessionStorageTest.php, line 233

Class

NativeSessionStorageTest
Test class for NativeSessionStorage.

Namespace

Symfony\Component\HttpFoundation\Tests\Session\Storage

Code

public function testCanStartOutside54() {
  if (version_compare(phpversion(), '5.4.0', '<')) {
    $this
      ->markTestSkipped('Test skipped, for PHP 5.4 only.');
  }
  $storage = $this
    ->getStorage();
  $this
    ->assertFalse(isset($_SESSION));
  $this
    ->assertFalse($storage
    ->getSaveHandler()
    ->isActive());
  $this
    ->assertFalse($storage
    ->isStarted());
  session_start();
  $this
    ->assertTrue(isset($_SESSION));
  $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();
}