示例#1
0
 /**
  * Retrieve messages collection
  *
  * @return \Magento\Framework\Message\Collection
  */
 public function getMessageCollection()
 {
     if (!$this->messages instanceof \Magento\Framework\Message\Collection) {
         $this->messages = $this->collectionFactory->create();
     }
     return $this->messages;
 }
示例#2
0
 /**
  * Retrieve messages
  *
  * @param string|null $group
  * @param bool $clear
  * @return Collection
  */
 public function getMessages($clear = false, $group = null)
 {
     $group = $this->prepareGroup($group);
     if (!$this->session->getData($group)) {
         $this->session->setData($group, $this->messagesFactory->create());
     }
     if ($clear) {
         $messages = clone $this->session->getData($group);
         $this->session->getData($group)->clear();
         $this->eventManager->dispatch('session_abstract_clear_messages');
         return $messages;
     }
     return $this->session->getData($group);
 }
 public function testCreate()
 {
     $message = $this->model->create();
     $this->assertInstanceOf('\\Magento\\Framework\\Message\\Collection', $message);
 }