/**
  * @covers \Magento\Framework\Message\AbstractMessage::toString
  */
 public function testToString()
 {
     $someText = 'some text';
     $expectedString = TestingMessage::TYPE_TESTING . ': testing_message: ' . $someText;
     $this->model->setIdentifier('testing_message');
     $this->model->setText($someText);
     $this->assertEquals($expectedString, $this->model->toString());
 }
示例#2
0
 /**
  * @covers \Magento\Framework\Message\AbstractMessage::toString
  */
 public function testToString()
 {
     $someText = 'some text';
     $expectedString = MessageInterface::TYPE_SUCCESS . ': ' . $someText;
     $this->model->expects($this->atLeastOnce())->method('getType')->will($this->returnValue(MessageInterface::TYPE_SUCCESS));
     $this->model->setText($someText);
     $this->assertEquals($expectedString, $this->model->toString());
 }
示例#3
0
 /**
  * Setter for message
  *
  * @param \Magento\Framework\Message\AbstractMessage $message
  * @return $this
  */
 public function addMessage(AbstractMessage $message)
 {
     if (!isset($this->messages[$message->getType()])) {
         $this->messages[$message->getType()] = [];
     }
     $this->messages[$message->getType()][] = $message;
     return $this;
 }
示例#4
0
 /**
  * @param \Magento\Framework\Message\AbstractMessage $message
  * @return $this
  */
 public function addMessage(\Magento\Framework\Message\AbstractMessage $message)
 {
     if (!isset($this->messages[$message->getType()])) {
         $this->messages[$message->getType()] = array();
     }
     $this->messages[$message->getType()][] = $message;
     return $this;
 }