public function testGetRssData() { $this->rssUrlBuilder->expects($this->once())->method('getUrl')->with(['type' => 'special_products', 'store_id' => 1])->will($this->returnValue('http://magento.com/rss/feed/index/type/special_products/store_id/1')); $item = $this->getItemMock(); $this->rssModel->expects($this->once())->method('getProductsCollection')->will($this->returnValue([$item])); $this->msrpHelper->expects($this->once())->method('canApplyMsrp')->will($this->returnValue(false)); $this->dateFactory->expects($this->once())->method('create'); $this->localeDate->expects($this->once())->method('formatDate')->will($this->returnValue(date('Y-m-d'))); $this->priceCurrency->expects($this->any())->method('convertAndFormat')->will($this->returnArgument(0)); $this->imageHelper->expects($this->once())->method('init')->with($item, 'thumbnail')->will($this->returnSelf()); $this->imageHelper->expects($this->once())->method('resize')->with(75, 75)->will($this->returnValue('image_link')); $this->outputHelper->expects($this->once())->method('productAttribute')->will($this->returnValue('')); $data = ['title' => 'Store 1 - Special Products', 'description' => 'Store 1 - Special Products', 'link' => 'http://magento.com/rss/feed/index/type/special_products/store_id/1', 'charset' => 'UTF-8', 'language' => 'en_US', 'entries' => [['title' => 'Product Name', 'link' => 'http://magento.com/product-name.html']]]; $rssData = $this->block->getRssData(); $description = $rssData['entries'][0]['description']; unset($rssData['entries'][0]['description']); $this->assertEquals($data, $rssData); $this->assertContains('<a href="http://magento.com/product-name.html"><', $description); $this->assertContains(sprintf('<p>Price: Special Price: 10<br />Special Expires On: %s</p>', date('Y-m-d')), $description); $this->assertContains('<img src="image_link" alt="" border="0" align="left" height="75" width="75" />', $description); }
public function testUtcDate() { $this->dateFactory->expects($this->any())->method('create')->with(['date' => 1347260470, 'part' => null, 'locale' => $this->locale])->will($this->returnValue(new \Magento\Framework\Stdlib\DateTime\Date(1347260470, null, $this->locale))); $date = $this->timezone->utcDate(\Magento\Core\Helper\Data::XML_PATH_DEFAULT_TIMEZONE, 1347260470); $this->assertSame('UTC', $date->getTimezone()); }
public function testUtcDate() { $this->dateFactory->expects($this->any())->method('create')->with(['date' => 1347260470, 'part' => null, 'locale' => $this->locale])->will($this->returnValue(new \Magento\Framework\Stdlib\DateTime\Date(1347260470, null, $this->locale))); $date = $this->timezone->utcDate('general/locale/timezone', 1347260470); $this->assertSame('UTC', $date->getTimezone()); }