You are here

public function MockFileSessionStorageTest::testSave in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/http-foundation/Tests/Session/Storage/MockFileSessionStorageTest.php \Symfony\Component\HttpFoundation\Tests\Session\Storage\MockFileSessionStorageTest::testSave()

File

vendor/symfony/http-foundation/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'));
}