/** * Test that the helper method ebayenterprise_order/factory::getCurrentCustomer() * when invoked it will instantiate customer/session object and then called * the method customer/session::getCustomer() which will return an instance * of type customer/customer. Finally, the method * ebayenterprise_order/factory::getCurrentCustomer() will return this instance * of type customer/customer. */ public function testGetCurrentCustomer() { /** @var Mage_Customer_Model_Customer */ $customer = Mage::getModel('customer/customer'); /** @var Mock_Mage_Customer_Model_Customer */ $session = $this->getModelMockBuilder('customer/session')->disableOriginalConstructor()->setMethods(['getCustomer'])->getMock(); $session->expects($this->once())->method('getCustomer')->will($this->returnValue($customer)); $this->replaceByMock('singleton', 'customer/session', $session); $this->assertSame($customer, $this->_factory->getCurrentCustomer()); }
/** * Get the current customer id, prefixed by the client customer prefix * @return string | null null if no current customer logged in */ protected function _getPrefixedCurrentCustomerId() { $customerId = $this->_factory->getCurrentCustomer()->getId(); return $customerId ? $this->prefixCustomerId($customerId) : null; }