public function AutoExpireFlashBagTest::testInitialize

File

drupal/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Flash/AutoExpireFlashBagTest.php, line 47

Class

AutoExpireFlashBagTest
AutoExpireFlashBagTest

Namespace

Symfony\Component\HttpFoundation\Tests\Session\Flash

Code

public function testInitialize() {
  $bag = new FlashBag();
  $array = array(
    'new' => array(
      'notice' => array(
        'A previous flash message',
      ),
    ),
  );
  $bag
    ->initialize($array);
  $this
    ->assertEquals(array(
    'A previous flash message',
  ), $bag
    ->peek('notice'));
  $array = array(
    'new' => array(
      'notice' => array(
        'Something else',
      ),
      'error' => array(
        'a',
      ),
    ),
  );
  $bag
    ->initialize($array);
  $this
    ->assertEquals(array(
    'Something else',
  ), $bag
    ->peek('notice'));
  $this
    ->assertEquals(array(
    'a',
  ), $bag
    ->peek('error'));
}