public function testCurrency() { $price = 10.0; $priceHtml = '<span class="price">$10.00</span>'; $this->assertEquals($priceHtml, $this->_helper->currency($price)); $this->assertEquals($priceHtml, $this->_helper->formatCurrency($price)); }
/** * Prepare fees info * * @return void */ protected function _prepareLayout() { parent::_prepareLayout(); $this->_shouldRenderInfo = true; $this->_addInfo(array('label' => $this->_fields->getFieldLabel('currency_code'), 'value' => $this->_recurringPayment->getCurrencyCode())); $params = array('init_amount', 'trial_billing_amount', 'billing_amount', 'tax_amount', 'shipping_amount'); foreach ($params as $key) { $value = $this->_recurringPayment->getData($key); if ($value) { $this->_addInfo(array('label' => $this->_fields->getFieldLabel($key), 'value' => $this->_coreHelper->formatCurrency($value, false), 'is_amount' => true)); } } }
public function testFormatCurrency() { $amount = '120'; $includeContainer = false; $result = '10grn.'; $this->priceCurrency->expects($this->once())->method('convertAndFormat')->with($amount, $includeContainer)->will($this->returnValue($result)); $this->assertEquals($result, $this->model->formatCurrency($amount, $includeContainer)); }
/** * Prepare related grid data * * @return void */ protected function _prepareLayout() { parent::_prepareLayout(); $this->_prepareRelatedOrders(array('increment_id', 'created_at', 'customer_firstname', 'customer_lastname', 'base_grand_total', 'status')); $this->_relatedOrders->addFieldToFilter('status', array('in' => $this->_config->getVisibleOnFrontStatuses())); $pager = $this->getLayout()->createBlock('Magento\\Theme\\Block\\Html\\Pager')->setCollection($this->_relatedOrders)->setIsOutputRequired(false); $this->setChild('pager', $pager); $this->setGridColumns(array(new \Magento\Framework\Object(array('index' => 'increment_id', 'title' => __('Order #'), 'is_nobr' => true, 'width' => 1)), new \Magento\Framework\Object(array('index' => 'created_at', 'title' => __('Date'), 'is_nobr' => true, 'width' => 1)), new \Magento\Framework\Object(array('index' => 'customer_name', 'title' => __('Customer Name'))), new \Magento\Framework\Object(array('index' => 'base_grand_total', 'title' => __('Order Total'), 'is_nobr' => true, 'width' => 1, 'is_amount' => true)), new \Magento\Framework\Object(array('index' => 'status', 'title' => __('Order Status'), 'is_nobr' => true, 'width' => 1)))); $orders = array(); foreach ($this->_relatedOrders as $order) { $orders[] = new \Magento\Framework\Object(array('increment_id' => $order->getIncrementId(), 'created_at' => $this->formatDate($order->getCreatedAt()), 'customer_name' => $order->getCustomerName(), 'base_grand_total' => $this->_coreHelper->formatCurrency($order->getBaseGrandTotal(), false), 'status' => $order->getStatusLabel(), 'increment_id_link_url' => $this->getUrl('sales/order/view/', array('order_id' => $order->getId())))); } if ($orders) { $this->setGridElements($orders); } }