Example #1
0
 public function testDraw()
 {
     $expectedPageSettings = array('table_header' => true);
     $expectedPdfPage = new \Zend_Pdf_Page('a4');
     $expectedPdfData = array(array('lines' => array(array(array('text' => array('Downloadable Documentation'), 'feed' => 35), array('text' => array('downloadable-docu', 'mentation'), 'feed' => 255, 'align' => 'right'), array('text' => '$20.00', 'feed' => 330, 'font' => 'bold', 'align' => 'right'), array('text' => '$-5.00', 'feed' => 380, 'font' => 'bold', 'align' => 'right'), array('text' => '1', 'feed' => 445, 'font' => 'bold', 'align' => 'right'), array('text' => '$2.00', 'feed' => 495, 'font' => 'bold', 'align' => 'right'), array('text' => '$17.00', 'feed' => 565, 'font' => 'bold', 'align' => 'right')), array(array('text' => array('Test Custom Option'), 'font' => 'italic', 'feed' => 35)), array(array('text' => array('test value'), 'feed' => 40)), array(array('text' => array('Download Links'), 'font' => 'italic', 'feed' => 35)), array(array('text' => array('Magento User Guide'), 'feed' => 40))), 'height' => 20));
     $this->_model->setItem(new \Magento\Framework\Object(array('name' => 'Downloadable Documentation', 'sku' => 'downloadable-documentation', 'row_total' => 20.0, 'discount_amount' => 5.0, 'qty' => 1, 'tax_amount' => 2.0, 'hidden_tax_amount' => 0.0, 'order_item' => new \Magento\Framework\Object(array('product_options' => array('options' => array(array('label' => 'Test Custom Option', 'value' => 'test value'))))))));
     $this->_model->expects($this->any())->method('getLinksTitle')->will($this->returnValue('Download Links'));
     $this->_model->expects($this->any())->method('getLinks')->will($this->returnValue(new \Magento\Framework\Object(array('purchased_items' => array(new \Magento\Framework\Object(array('link_title' => 'Magento User Guide')))))));
     $this->_pdf->expects($this->once())->method('drawLineBlocks')->with($this->anything(), $expectedPdfData, $expectedPageSettings)->will($this->returnValue($expectedPdfPage));
     $this->assertNotSame($expectedPdfPage, $this->_model->getPage());
     $this->assertNull($this->_model->draw());
     $this->assertSame($expectedPdfPage, $this->_model->getPage());
 }
 /**
  * @param \Magento\Payment\Helper\Data $paymentData
  * @param \Magento\Framework\Stdlib\StringUtils $string
  * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
  * @param \Magento\Framework\Filesystem $filesystem
  * @param \Magento\Sales\Model\Order\Pdf\Config $pdfConfig
  * @param \Magento\Sales\Model\Order\Pdf\Total\Factory $pdfTotalFactory
  * @param \Magento\Sales\Model\Order\Pdf\ItemsFactory $pdfItemsFactory
  * @param \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate
  * @param \Magento\Framework\Translate\Inline\StateInterface $inlineTranslation
  * @param \Magento\Sales\Model\Order\Address\Renderer $addressRenderer
  * @param Carrier $carrierHelper
  * @param \Magento\Store\Model\StoreManagerInterface $storeManager
  * @param \Magento\Framework\View\LayoutInterface $layout
  * @param \Magento\Framework\Locale\ResolverInterface $localeResolver
  * @param array $data
  *
  * @SuppressWarnings(PHPMD.ExcessiveParameterList)
  */
 public function __construct(\Magento\Payment\Helper\Data $paymentData, \Magento\Framework\Stdlib\StringUtils $string, \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Framework\Filesystem $filesystem, \Magento\Sales\Model\Order\Pdf\Config $pdfConfig, \Magento\Sales\Model\Order\Pdf\Total\Factory $pdfTotalFactory, \Magento\Sales\Model\Order\Pdf\ItemsFactory $pdfItemsFactory, \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate, \Magento\Framework\Translate\Inline\StateInterface $inlineTranslation, \Magento\Sales\Model\Order\Address\Renderer $addressRenderer, Carrier $carrierHelper, \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Framework\View\LayoutInterface $layout, \Magento\Framework\Locale\ResolverInterface $localeResolver, array $data = [])
 {
     $this->_carrierHelper = $carrierHelper;
     $this->_storeManager = $storeManager;
     $this->_layout = $layout;
     $this->_localeResolver = $localeResolver;
     parent::__construct($paymentData, $string, $scopeConfig, $filesystem, $pdfConfig, $pdfTotalFactory, $pdfItemsFactory, $localeDate, $inlineTranslation, $addressRenderer, $data);
 }