71 'title' =>
'Order # 100000001 Notification(s)',
72 'link' =>
'http://magento.com/sales/order/view/order_id/1',
73 'description' =>
'Order # 100000001 Notification(s)',
77 'title' =>
'Details for Order #100000001',
78 'link' =>
'http://magento.com/sales/order/view/order_id/1',
79 'description' =>
'<p>Notified Date: <br/>Comment: Some comment<br/></p>',
82 'title' =>
'Order #100000001 created at ',
83 'link' =>
'http://magento.com/sales/order/view/order_id/1',
84 'description' =>
'<p>Current Status: Pending<br/>Total: 15.00<br/></p>' 91 $this->objectManager = $this->createMock(\
Magento\Framework\ObjectManagerInterface::class);
92 $this->urlInterface = $this->createMock(\
Magento\Framework\UrlInterface::class);
93 $this->requestInterface = $this->createMock(\
Magento\Framework\
App\RequestInterface::class);
94 $this->orderStatusFactory =
96 ->setMethods([
'create'])
97 ->disableOriginalConstructor()
99 $this->timezoneInterface = $this->createMock(\
Magento\Framework\Stdlib\DateTime\TimezoneInterface::class);
100 $this->orderFactory = $this->createPartialMock(\
Magento\Sales\Model\OrderFactory::class, [
'create']);
101 $this->scopeConfigInterface = $this->createMock(\
Magento\Framework\
App\
Config\ScopeConfigInterface::class);
103 $this->order = $this->getMockBuilder(\
Magento\Sales\Model\Order::class)
114 ])->disableOriginalConstructor()->getMock();
115 $this->order->expects($this->any())->method(
'getId')->will($this->returnValue(1));
116 $this->order->expects($this->any())->method(
'getIncrementId')->will($this->returnValue(
'100000001'));
117 $this->order->expects($this->any())->method(
'getCustomerId')->will($this->returnValue(1));
118 $this->order->expects($this->any())->method(
'getStatusLabel')->will($this->returnValue(
'Pending'));
119 $this->order->expects($this->any())->method(
'formatPrice')->will($this->returnValue(
'15.00'));
120 $this->order->expects($this->any())->method(
'getGrandTotal')->will($this->returnValue(15));
121 $this->order->expects($this->any())->method(
'load')->with(1)->will($this->returnSelf());
123 $this->objectManagerHelper =
new ObjectManagerHelper($this);
124 $this->model = $this->objectManagerHelper->getObject(
125 \
Magento\Sales\Model\Rss\OrderStatus::class,
127 'objectManager' => $this->objectManager,
128 'urlBuilder' => $this->urlInterface,
129 'request' => $this->requestInterface,
130 'orderResourceFactory' => $this->orderStatusFactory,
131 'localeDate' => $this->timezoneInterface,
132 'orderFactory' => $this->orderFactory,
133 'scopeConfig' => $this->scopeConfigInterface
140 $this->orderFactory->expects($this->once())->method(
'create')->willReturn($this->order);
141 $requestData = base64_encode(
'{"order_id":1,"increment_id":"100000001","customer_id":1}');
143 $this->requestInterface->expects($this->any())->method(
'getParam')->with(
'data')->willReturn(
$requestData);
146 ->setMethods([
'getAllCommentCollection'])
147 ->disableOriginalConstructor()
150 'entity_type_code' =>
'order',
151 'increment_id' =>
'100000001',
152 'created_at' =>
'2014-10-09 18:25:50',
153 'comment' =>
'Some comment',
155 $resource->expects($this->once())->method(
'getAllCommentCollection')->willReturn([$comment]);
156 $this->orderStatusFactory->expects($this->once())->method(
'create')->willReturn(
$resource);
157 $this->urlInterface->expects($this->any())->method(
'getUrl')
158 ->with(
'sales/order/view', [
'order_id' => 1])
159 ->will($this->returnValue(
'http://magento.com/sales/order/view/order_id/1'));
161 $this->assertEquals($this->feedData, $this->model->getRssData());
170 $this->orderFactory->expects($this->once())->method(
'create')->willReturn($this->order);
172 $requestData = base64_encode(
'{"order_id":"1","increment_id":true,"customer_id":true}');
174 $this->requestInterface->expects($this->any())->method(
'getParam')->with(
'data')->willReturn(
$requestData);
176 $this->orderStatusFactory->expects($this->never())->method(
'create');
178 $this->urlInterface->expects($this->never())->method(
'getUrl');
180 $this->assertEquals($this->feedData, $this->model->getRssData());
185 $this->scopeConfigInterface->expects($this->once())->method(
'getValue')
186 ->with(
'rss/order/status', \
Magento\Store\Model\ScopeInterface::SCOPE_STORE)
187 ->will($this->returnValue(
true));
188 $this->assertTrue($this->model->isAllowed());
198 $this->requestInterface->expects($this->any())->method(
'getParam')
201 $this->orderFactory->expects($this->once())->method(
'create')->will($this->returnValue($this->order));
202 $this->assertEquals(
'rss_order_status_data_' .
$result, $this->model->getCacheKey());
211 [base64_encode(
'{"order_id":1,"increment_id":"100000001","customer_id":1}'), md5(
'11000000011')],
212 [base64_encode(
'{"order_id":"1","increment_id":true,"customer_id":true}'),
'']
218 $this->assertEquals(600, $this->model->getCacheLifetime());