/** * @magentoConfigFixture sales_email/invoice/enabled 1 * @magentoConfigFixture current_store design/theme/full_name default/default/default * @magentoDataFixture Mage/Sales/_files/order.php */ public function testSendEmail() { $order = new Mage_Sales_Model_Order(); $order->loadByIncrementId('100000001'); $order->setCustomerEmail('*****@*****.**'); $invoice = new Mage_Sales_Model_Order_Invoice(); $invoice->setOrder($order); $paymentInfoBlock = Mage::helper('Mage_Payment_Helper_Data')->getInfoBlock($order->getPayment()); $paymentInfoBlock->setArea('invalid-area'); $invoice->setPaymentInfoBlock($paymentInfoBlock); $this->assertNull($invoice->getEmailSent()); $invoice->sendEmail(true); $this->assertTrue($invoice->getEmailSent()); $this->assertEquals('frontend', $paymentInfoBlock->getArea()); }
/** * send invoice to customer if that was configured by the merchant * * @param Mage_Sales_Model_Order_Invoice $invoice Invoice to be sent * * @return void */ public function sendInvoiceToCustomer(Mage_Sales_Model_Order_Invoice $invoice) { if (false == $invoice->getEmailSent() && $this->getConfig()->getSendInvoice()) { $invoice->sendEmail($notifyCustomer = true); } }