Esempio n. 1
0
 /**
  * {@inheritdoc}
  */
 public function scopeDate($scope = null, $date = null, $includeTime = false)
 {
     $timezone = $this->_scopeConfig->getValue($this->getDefaultTimezonePath(), $this->_scopeType, $scope);
     $date = $this->_dateFactory->create(array('date' => $date, 'part' => null, 'locale' => $this->_localeResolver->getLocale()));
     $date->setTimezone($timezone);
     if (!$includeTime) {
         $date->setHour(0)->setMinute(0)->setSecond(0);
     }
     return $date;
 }
Esempio n. 2
0
 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);
 }
Esempio n. 3
0
 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());
 }
Esempio n. 4
0
 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());
 }