public function searchAction()
 {
     $form = new CustomerForm();
     $form->get('submit')->setValue('Search');
     $customer = new Customer();
     $customers = null;
     $request = $this->getRequest();
     if ($request->isPost()) {
         $customer = new Customer();
         $form->setInputFilter($customer->getInputFilter());
         $form->setData($request->getPost());
         if ($form->isValid()) {
             $customer->exchangeArray($form->getData());
             $customers = $this->getCustomerTable()->searchCustomer($customer);
         } else {
             $messages = $form->getMessages();
         }
     }
     return array('form' => $form, 'customer' => $customer, 'customers' => $customers);
 }
 public function testSetDataAndGetData()
 {
     $data = array('id' => 42, 'firstname' => 'Manfred', 'lastname' => 'Mustermann', 'street' => 'Am Testen 123', 'postcode' => '54321', 'city' => 'Musterhausen', 'country' => 'de');
     $customerForm = new CustomerForm();
     $customerForm->init();
     $customerForm->setData($data);
     $this->assertSame($data['id'], $customerForm->get('id')->getValue());
     $this->assertSame($data['firstname'], $customerForm->get('firstname')->getValue());
     $this->assertSame($data['lastname'], $customerForm->get('lastname')->getValue());
     $this->assertSame($data['street'], $customerForm->get('street')->getValue());
     $this->assertSame($data['postcode'], $customerForm->get('postcode')->getValue());
     $this->assertSame($data['city'], $customerForm->get('city')->getValue());
     $this->assertSame($data['country'], $customerForm->get('country')->getValue());
 }