/** * @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()); }
/** * @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()); }
/** * 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; }
/** * @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; }