Beispiel #1
0
 /**
  * Check postAction method and assert that review model storeId equals null.
  */
 public function testPostAction()
 {
     $this->_requestMock->expects($this->at(0))->method('getParam')->will($this->returnValue(1));
     $this->_requestMock->expects($this->at(2))->method('getParam')->will($this->returnValue(array('1' => '1')));
     $this->_requestMock->expects($this->once())->method('getPost')->will($this->returnValue(array('status_id' => 1)));
     $this->_objectManagerMock->expects($this->at(0))->method('get')->with('Magento\\Store\\Model\\StoreManagerInterface')->will($this->returnValue($this->_storeManagerInterfaceMock));
     $this->_reviewFactoryMock->expects($this->once())->method('create')->will($this->returnValue($this->_reviewModelMock));
     $this->_ratingFactoryMock->expects($this->once())->method('create')->will($this->returnValue($this->_ratingModelMock));
     $this->_storeManagerInterfaceMock->expects($this->once())->method('hasSingleStore')->will($this->returnValue(true));
     $this->_storeManagerInterfaceMock->expects($this->once())->method('getStore')->will($this->returnValue($this->_storeModelMock));
     $this->_storeModelMock->expects($this->once())->method('getId')->will($this->returnValue(1));
     $this->_reviewModelMock->expects($this->once())->method('save')->will($this->returnValue($this->_reviewModelMock));
     $this->_reviewModelMock->expects($this->once())->method('getId')->will($this->returnValue(1));
     $this->_reviewModelMock->expects($this->once())->method('aggregate')->will($this->returnValue($this->_reviewModelMock));
     $this->_ratingModelMock->expects($this->once())->method('setRatingId')->will($this->returnSelf());
     $this->_ratingModelMock->expects($this->once())->method('setReviewId')->will($this->returnSelf());
     $this->_ratingModelMock->expects($this->once())->method('addOptionVote')->will($this->returnSelf());
     $this->_helperMock->expects($this->once())->method('geturl')->will($this->returnValue('url'));
     $this->_model->execute();
 }