public function SessionTest::testGetSetFlashes

File

drupal/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/SessionTest.php, line 171

Class

SessionTest
SessionTest

Namespace

Symfony\Component\HttpFoundation\Tests\Session

Code

public function testGetSetFlashes() {
  $array = array(
    'notice' => 'hello',
    'error' => 'none',
  );
  $this
    ->assertEquals(array(), $this->session
    ->getFlashes());
  $this->session
    ->setFlashes($array);
  $this
    ->assertEquals($array, $this->session
    ->getFlashes());
  $this
    ->assertEquals(array(), $this->session
    ->getFlashes());
  $this->session
    ->getFlashBag()
    ->add('notice', 'foo');

  // test that BC works by only retrieving the first added.
  $this->session
    ->getFlashBag()
    ->add('notice', 'foo2');
  $this
    ->assertEquals(array(
    'notice' => 'foo',
  ), $this->session
    ->getFlashes());
}