/** * Create Service Factory * * @param ServiceLocatorInterface $serviceLocator */ public function createService(ServiceLocatorInterface $serviceLocator) { $inputFilterManager = $serviceLocator->get('InputFilterManager'); $table = $serviceLocator->get('Customer\\Table\\Customer'); $filter = $inputFilterManager->get('Customer\\CustomerFilter'); $service = new CustomerService(); $service->setCustomerTable($table); $service->setCustomerFilter($filter); return $service; }
public function testSaveInvalidData() { $data = array('id' => 'a', 'firstname' => 'Manfred 0815', 'lastname' => '#(9(au', 'street' => '', 'postcode' => '64654564564646464654654654', 'city' => 'M', 'country' => 'it'); $customerFilter = new CustomerInputFilter(); $customerFilter->init(); $customerService = new CustomerService(); $customerService->setCustomerFilter($customerFilter); $customerEntity = $customerService->save($data); $this->assertFalse($customerEntity); }
public function testDeleteNotExistingCustomer() { $customerFilter = new CustomerInputFilter(); $customerTable = new CustomerTable($this->adapter); $customerService = new CustomerService(); $customerService->setCustomerFilter($customerFilter); $customerService->setCustomerTable($customerTable); $result = $customerService->delete('99'); $this->assertFalse($result); }