Пример #1
0
 private function add($type, $message, $domain)
 {
     if ($this->flashBag->has($this->prefix)) {
         $messages = $this->flashBag->get($this->prefix);
     } else {
         $messages = [];
     }
     $messages[$type][] = ['text' => $message, 'domain' => $domain];
     $this->flashBag->set($this->prefix, $messages);
 }
Пример #2
0
 public function testPeekAll()
 {
     $this->bag->set('notice', 'Foo');
     $this->bag->set('error', 'Bar');
     $this->assertEquals(array('notice' => array('Foo'), 'error' => array('Bar')), $this->bag->peekAll());
     $this->assertTrue($this->bag->has('notice'));
     $this->assertTrue($this->bag->has('error'));
     $this->assertEquals(array('notice' => array('Foo'), 'error' => array('Bar')), $this->bag->peekAll());
 }
Пример #3
0
 /**
  * @covers Symfony\Component\HttpFoundation\Session\Flash\FlashBag::getIterator
  * @group legacy
  */
 public function testLegacyGetIterator()
 {
     $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());
 }
 /**
  * @covers Symfony\Component\HttpFoundation\Session\Flash\FlashBag::getIterator
  */
 public function testLegacyGetIterator()
 {
     $this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
     $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());
 }
Пример #5
0
 /**
  * Set flash alert.
  *
  * @param Alert $alert
  */
 public function setFlashAlert(Alert $alert)
 {
     $this->flashBag->set('silvestra_notification_alerts', $alert->all());
 }
Пример #6
0
 /**
  * Set flash alert.
  *
  * @param Alert $alert
  */
 public function setFlashAlert(Alert $alert)
 {
     $this->flashBag->set(self::FLASH_BAG_KEY, $alert->all());
 }
Пример #7
0
 /**
  * Sets all flash messages.
  *
  * @param array $flashes
  */
 public function setAll(array $flashes)
 {
     $this->flashBag->set($this->storageKey, $flashes);
 }