public function FlashBagTest::testGetIterator

@covers Symfony\Component\HttpFoundation\Session\Flash\FlashBag::getIterator

File

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

Class

FlashBagTest
FlashBagTest

Namespace

Symfony\Component\HttpFoundation\Tests\Session\Flash

Code

public function testGetIterator() {
  $flashes = array(
    'hello' => 'world',
    'beep' => 'boop',
    'notice' => 'nope',
  );
  foreach ($flashes as $key => $val) {
    $this->bag
      ->set($key, $val);
  }
  $i = 0;
  foreach ($this->bag as $key => $val) {
    $this
      ->assertEquals(array(
      $flashes[$key],
    ), $val);
    $i++;
  }
  $this
    ->assertEquals(count($flashes), $i);
  $this
    ->assertEquals(0, count($this->bag));
}