public function createCustomerController($customer = null, $customerManager = null, $addressManager = null, $formFactory = null, $order = null, $orderManager = null)
{
if (null === $customerManager) {
$customerManager = $this->getMock('Sonata\\Component\\Customer\\CustomerManagerInterface');
}
if (null !== $customer) {
$customerManager->expects($this->once())->method('findOneBy')->will($this->returnValue($customer));
}
if (null === $orderManager) {
$orderManager = $this->getMock('Sonata\\Component\\Order\\OrderManagerInterface');
}
if (null === $addressManager) {
$addressManager = $this->getMock('Sonata\\Component\\Customer\\AddressManagerInterface');
}
if (null !== $order) {
$orderManager->expects($this->once())->method('findBy')->will($this->returnValue(array($order)));
}
if (null === $formFactory) {
$formFactory = $this->getMock('Symfony\\Component\\Form\\FormFactoryInterface');
}
return new CustomerController($customerManager, $orderManager, $addressManager, $formFactory);
}