public function testInputFiltersAreSetCorrectly() { $issue = new Issue(); $inputFilter = $issue->getInputFilter(); $this->assertSame(2, $inputFilter->count()); $this->assertTrue($inputFilter->has('id')); $this->assertTrue($inputFilter->has('title')); }
public function addAction() { if (!$this->zfcUserAuthentication()->hasIdentity()) { return $this->redirect()->toRoute('issue'); } $form = new IssueForm(); $form->get('submit')->setValue('Add'); $request = $this->getRequest(); if ($request->isPost()) { $issue = new Issue(); $form->setInputFilter($issue->getInputFilter()); $form->setData($request->getPost()); if ($form->isValid()) { $issue->exchangeArray($form->getData()); $this->getIssueTable()->saveIssue($issue, $this->zfcUserAuthentication()->getIdentity()->getId()); // Redirect to list of issues return $this->redirect()->toRoute('issue'); } } return array('form' => $form); }