示例#1
0
 /**
  * @expectedException \InvalidArgumentException
  * @expectedExceptionMessage Order not found.
  */
 public function testGetRssDataWithError()
 {
     $this->orderFactory->expects($this->once())->method('create')->willReturn($this->order);
     $requestData = base64_encode('{"order_id":"1","increment_id":true,"customer_id":true}');
     $this->requestInterface->expects($this->any())->method('getParam')->with('data')->willReturn($requestData);
     $this->orderStatusFactory->expects($this->never())->method('create');
     $this->urlInterface->expects($this->never())->method('getUrl');
     $this->assertEquals($this->feedData, $this->model->getRssData());
 }
 public function testGetData()
 {
     $this->orderFactory->expects($this->once())->method('create')->will($this->returnValue($this->order));
     $this->requestInterface->expects($this->any())->method('getParam')->with('data')->will($this->returnValue('eyJvcmRlcl9pZCI6MSwiaW5jcmVtZW50X2lkIjoiMTAwMDAwMDAxIiwiY3VzdG9tZXJfaWQiOjF9'));
     $resource = $this->getMockBuilder('\\Magento\\Sales\\Model\\ResourceModel\\Order\\Rss\\OrderStatus')->setMethods(['getAllCommentCollection'])->disableOriginalConstructor()->getMock();
     $comment = ['entity_type_code' => 'order', 'increment_id' => '100000001', 'created_at' => '2014-10-09 18:25:50', 'comment' => 'Some comment'];
     $resource->expects($this->once())->method('getAllCommentCollection')->will($this->returnValue([$comment]));
     $this->orderStatusFactory->expects($this->once())->method('create')->will($this->returnValue($resource));
     $this->urlInterface->expects($this->any())->method('getUrl')->with('sales/order/view', ['order_id' => 1])->will($this->returnValue('http://magento.com/sales/order/view/order_id/1'));
     $this->assertEquals($this->feedData, $this->model->getRssData());
 }