Exemplo n.º 1
0
 /**
  * @magentoAppIsolation enabled
  */
 public function testAddMessage()
 {
     $errorMessage = $this->objectManager->create('Magento\\Framework\\Message\\Error', array('text' => 'some text'));
     $this->model->addMessage($errorMessage);
     $customGroup = 'custom-group';
     $errorMessageCustom = $this->objectManager->create('Magento\\Framework\\Message\\Error', array('text' => 'some custom group'));
     $this->model->addMessage($errorMessageCustom, $customGroup);
     $this->assertEquals($errorMessage, $this->model->getMessages()->getLastAddedMessage());
     $this->assertEquals($errorMessageCustom, $this->model->getMessages(false, $customGroup)->getLastAddedMessage());
     $this->assertEquals($errorMessageCustom, $this->model->getMessages(true, $customGroup)->getLastAddedMessage());
     $this->assertEmpty($this->model->getMessages(false, $customGroup)->getItems());
     $this->assertEmpty($this->model->getMessages(false, $customGroup)->getLastAddedMessage());
 }