Пример #1
0
 public function testSetMessages()
 {
     $collection = $this->getMockBuilder('Magento\\Framework\\Message\\Collection')->disableOriginalConstructor()->getMock();
     $this->collectionFactory->expects($this->never())->method('create');
     $this->messages->setMessages($collection);
     $this->assertSame($collection, $this->messages->getMessageCollection());
 }
Пример #2
0
 public function testGetMessages()
 {
     $messageCollection = $this->getMockBuilder('Magento\\Framework\\Message\\Collection')->disableOriginalConstructor()->setMethods(['addMessage'])->getMock();
     $this->messagesFactory->expects($this->atLeastOnce())->method('create')->will($this->returnValue($messageCollection));
     $this->session->expects($this->at(0))->method('getData')->with(Manager::DEFAULT_GROUP)->will($this->returnValue(null));
     $this->session->expects($this->at(1))->method('setData')->with(Manager::DEFAULT_GROUP, $messageCollection)->will($this->returnValue($this->session));
     $this->session->expects($this->at(2))->method('getData')->with(Manager::DEFAULT_GROUP)->will($this->returnValue($messageCollection));
     $this->eventManager->expects($this->never())->method('dispatch');
     $this->assertEquals($messageCollection, $this->model->getMessages());
 }