/** * @param \Magento\Framework\DataObject $row * @return string */ public function render(\Magento\Framework\DataObject $row) { $this->_actions = []; if ($this->_salesReorder->canReorder($row->getId())) { $reorderAction = ['@' => ['href' => $this->getUrl('sales/order_create/reorder', ['order_id' => $row->getId()])], '#' => __('Reorder')]; $this->addToActions($reorderAction); } $this->_eventManager->dispatch('adminhtml_customer_orders_add_action_renderer', ['renderer' => $this, 'row' => $row]); return $this->_actionsToHtml(); }
/** * Tests what happens if the customer is logged in and the order does or does not allow reorders. * * @param bool $orderCanReorder * @return void * @dataProvider getOrderCanReorder */ public function testCanReorderCustomerLoggedInAndOrderCanReorder($orderCanReorder) { $this->setupOrderMock(true); $this->customerSessionMock->expects($this->once())->method('isLoggedIn')->will($this->returnValue(true)); $this->orderMock->expects($this->once())->method('canReorder')->will($this->returnValue($orderCanReorder)); $this->assertEquals($orderCanReorder, $this->helper->canReorder($this->orderMock)); }