Skip to content

Commit 1244b10

Browse files
author
Joan He
committed
Merge remote-tracking branch 'arcticfoxes/MC-5545' into pr
2 parents 354fbd2 + 2640e04 commit 1244b10

File tree

2 files changed

+16
-10
lines changed

2 files changed

+16
-10
lines changed

app/code/Magento/Catalog/Block/Adminhtml/Rss/NotifyStock.php

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
/**
1111
* Class NotifyStock
12+
*
1213
* @package Magento\Catalog\Block\Adminhtml\Rss
1314
*/
1415
class NotifyStock extends \Magento\Backend\Block\AbstractBlock implements DataProviderInterface
@@ -41,7 +42,7 @@ public function __construct(
4142
}
4243

4344
/**
44-
* @return void
45+
* @inheritdoc
4546
*/
4647
protected function _construct()
4748
{
@@ -50,12 +51,12 @@ protected function _construct()
5051
}
5152

5253
/**
53-
* {@inheritdoc}
54+
* @inheritdoc
5455
*/
5556
public function getRssData()
5657
{
57-
$newUrl = $this->rssUrlBuilder->getUrl(['_secure' => true, '_nosecret' => true, 'type' => 'notifystock']);
58-
$title = __('Low Stock Products');
58+
$newUrl = $this->rssUrlBuilder->getUrl(['_secure' => true, '_nosecret' => true, 'type' => 'notifystock']);
59+
$title = __('Low Stock Products')->render();
5960
$data = ['title' => $title, 'description' => $title, 'link' => $newUrl, 'charset' => 'UTF-8'];
6061

6162
foreach ($this->rssModel->getProductsCollection() as $item) {
@@ -65,39 +66,39 @@ public function getRssData()
6566
['id' => $item->getId(), '_secure' => true, '_nosecret' => true]
6667
);
6768
$qty = 1 * $item->getQty();
68-
$description = __('%1 has reached a quantity of %2.', $item->getName(), $qty);
69+
$description = __('%1 has reached a quantity of %2.', $item->getName(), $qty)->render();
6970
$data['entries'][] = ['title' => $item->getName(), 'link' => $url, 'description' => $description];
7071
}
7172

7273
return $data;
7374
}
7475

7576
/**
76-
* {@inheritdoc}
77+
* @inheritdoc
7778
*/
7879
public function getCacheLifetime()
7980
{
8081
return 600;
8182
}
8283

8384
/**
84-
* {@inheritdoc}
85+
* @inheritdoc
8586
*/
8687
public function isAllowed()
8788
{
8889
return true;
8990
}
9091

9192
/**
92-
* {@inheritdoc}
93+
* @inheritdoc
9394
*/
9495
public function getFeeds()
9596
{
9697
return [];
9798
}
9899

99100
/**
100-
* {@inheritdoc}
101+
* @inheritdoc
101102
*/
102103
public function isAuthRequired()
103104
{

app/code/Magento/Catalog/Test/Unit/Block/Adminhtml/Rss/NotifyStockTest.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,12 @@ public function testGetRssData()
9696
$this->urlBuilder->expects($this->once())->method('getUrl')
9797
->with('catalog/product/edit', ['id' => 1, '_secure' => true, '_nosecret' => true])
9898
->will($this->returnValue('http://magento.com/catalog/product/edit/id/1'));
99-
$this->assertEquals($this->rssFeed, $this->block->getRssData());
99+
100+
$data = $this->block->getRssData();
101+
$this->assertTrue(is_string($data['title']));
102+
$this->assertTrue(is_string($data['description']));
103+
$this->assertTrue(is_string($data['entries'][0]['description']));
104+
$this->assertEquals($this->rssFeed, $data);
100105
}
101106

102107
public function testGetCacheLifetime()

0 commit comments

Comments
 (0)