/** * @magentoAppIsolation enabled * @magentoDataFixture Magento/Catalog/_files/product_with_image.php */ public function testImage() { \Magento\TestFramework\Helper\Bootstrap::getInstance()->loadArea(\Magento\Framework\App\Area::AREA_FRONTEND); \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\\Framework\\View\\DesignInterface')->setDefaultDesignTheme(); $product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\\Catalog\\Model\\Product'); $product->load(1); $size = $this->_block->getImageSize(); $this->assertGreaterThan(1, $size); $this->assertContains('/' . $size, $this->_block->getImageUrl($product)); $this->assertStringEndsWith('magento_image.jpg', $this->_block->getImageUrl($product)); }
/** * Prepare before to html * * @return string */ protected function _toHtml() { if ($this->getItemCount()) { return parent::_toHtml(); } return ''; }
/** * Preparing global layout * * @return void */ protected function _prepareLayout() { parent::_prepareLayout(); $headBlock = $this->getLayout()->getBlock('head'); if ($headBlock) { $headBlock->setTitle(__('My Wish List')); } }
/** * Check whether wishlist item has description * * @param \Magento\Wishlist\Model\Item $item * @return bool */ public function hasDescription($item) { $hasDescription = parent::hasDescription($item); if ($hasDescription) { return $item->getDescription() !== $this->_wishlistHelper->defaultCommentString(); } return $hasDescription; }
/** * Prepare global layout * * @return $this * */ protected function _prepareLayout() { parent::_prepareLayout(); $headBlock = $this->getLayout()->getBlock('head'); if ($headBlock) { $headBlock->setTitle($this->getHeader()); } return $this; }
/** * Retrieve block html * * @return string */ protected function _toHtml() { if ($this->isEnabled()) { if (!$this->getLayout()) { return ''; } foreach ($this->getLayout()->getChildBlocks($this->getNameInLayout()) as $child) { if ($child) { $child->setItem($this->getItem()); } } return parent::_toHtml(); } return ''; }
/** * Render block html * * @return string */ protected function _toHtml() { $this->setOptionList($this->getConfiguredOptions()); return parent::_toHtml(); }
/** * @return string */ protected function _toHtml() { if ($this->currentCustomer->getCustomerId()) { return parent::_toHtml(); } else { return ''; } }
/** * Retrieve Product View URL * * @param \Magento\Catalog\Model\Product $product * @param array $additional * @return string */ public function getProductUrl($product, $additional = array()) { $additional['_rss'] = true; return parent::getProductUrl($product, $additional); }
/** * Prepare global layout * * @return $this * */ protected function _prepareLayout() { parent::_prepareLayout(); $this->pageConfig->getTitle()->set($this->getHeader()); return $this; }