public function MockFileSessionStorage::save

Force the session to be saved and closed.

This method must invoke session_write_close() unless this interface is used for a storage object design for unit or functional testing where a real PHP session would interfere with testing, in which case it it should actually persist the session data if required.

Overrides MockArraySessionStorage::save

File

drupal/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/MockFileSessionStorage.php, line 98

Class

MockFileSessionStorage
MockFileSessionStorage is used to mock sessions for functional testing when done in a single PHP process.

Namespace

Symfony\Component\HttpFoundation\Session\Storage

Code

public function save() {
  file_put_contents($this
    ->getFilePath(), serialize($this->data));

  // this is needed for Silex, where the session object is re-used across requests
  // in functional tests. In Symfony, the container is rebooted, so we don't have
  // this issue
  $this->started = false;
}