public function MockFileSessionStorageTest::testSave

File

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

Class

MockFileSessionStorageTest
Test class for MockFileSessionStorage.

Namespace

Symfony\Component\HttpFoundation\Tests\Session\Storage

Code

public function testSave() {
  $this->storage
    ->start();
  $id = $this->storage
    ->getId();
  $this
    ->assertNotEquals('108', $this->storage
    ->getBag('attributes')
    ->get('new'));
  $this
    ->assertFalse($this->storage
    ->getBag('flashes')
    ->has('newkey'));
  $this->storage
    ->getBag('attributes')
    ->set('new', '108');
  $this->storage
    ->getBag('flashes')
    ->set('newkey', 'test');
  $this->storage
    ->save();
  $storage = $this
    ->getStorage();
  $storage
    ->setId($id);
  $storage
    ->start();
  $this
    ->assertEquals('108', $storage
    ->getBag('attributes')
    ->get('new'));
  $this
    ->assertTrue($storage
    ->getBag('flashes')
    ->has('newkey'));
  $this
    ->assertEquals(array(
    'test',
  ), $storage
    ->getBag('flashes')
    ->peek('newkey'));
}