Пример #1
0
 protected function setUp()
 {
     parent::setUp();
     $this->bag = new FlashBag();
     $this->array = array('notice' => array('A previous flash message'));
     $this->bag->initialize($this->array);
 }
Пример #2
0
 public function testPeekAll()
 {
     $this->bag->set('notice', 'Foo');
     $this->bag->set('error', 'Bar');
     $this->assertEquals(array('notice' => 'Foo', 'error' => 'Bar'), $this->bag->peekAll());
     $this->assertTrue($this->bag->has('notice'));
     $this->assertTrue($this->bag->has('error'));
     $this->assertEquals(array('notice' => 'Foo', 'error' => 'Bar'), $this->bag->peekAll());
 }
Пример #3
0
 /**
  * @covers Symfony\Component\HttpFoundation\Session\Flash\FlashBag::getIterator
  */
 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->assertCount(0, $this->bag->all());
 }