/**
  * Executes this filter.
  *
  * @param sfFilterChain A sfFilterChain instance
  */
 public function execute($filterChain)
 {
     // execute next filter
     $filterChain->execute();
     $response = $this->context->getResponse();
     $request = $this->context->getRequest();
     $fillInForm = new sfFillInForm();
     // converters
     foreach ($this->getParameter('converters', array()) as $functionName => $fields) {
         $fillInForm->addConverter($functionName, $fields);
     }
     // skip fields
     $fillInForm->setSkipFields((array) $this->getParameter('skip_fields', array()));
     // types
     $excludeTypes = (array) $this->getParameter('exclude_types', array('hidden', 'password'));
     $checkTypes = (array) $this->getParameter('check_types', array('text', 'checkbox', 'radio', 'password', 'hidden'));
     $fillInForm->setTypes(array_diff($checkTypes, $excludeTypes));
     // fill in
     $method = 'fillIn' . ucfirst(strtolower($this->getParameter('content_type', 'Html')));
     try {
         $content = $fillInForm->{$method}($response->getContent(), $this->getParameter('name'), $this->getParameter('id'), $request->getParameterHolder()->getAll());
         $response->setContent($content);
     } catch (sfException $e) {
         if (sfConfig::get('sf_logging_enabled')) {
             $this->context->getEventDispatcher()->notify(new sfEvent($this, 'application.log', array($e->getMessage(), 'priority' => sfLogger::ERR)));
         }
     }
 }
$t->is(get_input_value($xml, 'input_checkbox_not_checked', 'checked'), 'checked', '->fillInDom() fills in values for checkbox');
$t->is(get_input_value($xml, 'input_checkbox_multiple[]', 'checked'), array(null, 'checked'), '->fillInDom() fills in values for multiple checkboxes');
$t->is($xml->xpath('//form[@name="form1"]/textarea[@name="textarea"]'), array('my content'), '->fillInDom() fills in values for textarea');
$t->is($xml->xpath('//form[@name="form1"]/select[@name="select"]/option[@selected="selected"]'), array('first'), '->fillInDom() fills in values for select');
$t->is(get_input_value($xml, 'article[description][]'), array('new description', 'new description2'), '->fillInDom() fills in values for multiple text inputs in second dimension array');
$t->is($xml->xpath('//form[@name="form1"]/select[@name="select_multiple"]/option[@selected="selected"]'), array('first', 'last'), '->fillInDom() fills in values for multiple select');
$t->is(get_input_value($xml, 'article[title]'), 'my article title', '->fillInDom() fills in values for text input');
$t->is($xml->xpath('//form[@name="form1"]/select[@name="article[category]"]/option[@selected="selected"]'), array(1, 2), '->fillInDom() fills in values for select');
$t->is(get_input_value($xml, 'multiple_text[]'), array('m1', 'm2'), '->fillInDom() fills in values for multiple text inputs');
$t->is($xml->xpath('//form[@name="form1"]/textarea[@name="multiple_textarea[]"]'), array('a1', 'a2'), '->fillInDom() fills in values for multiple textareas');
$t->is($xml->xpath('//form[@name="form1"]/select[@name="articles[]"][1]/option[@selected="selected"]'), array(1, 2), '->fillInDom() fills in values for multiple select');
$t->is($xml->xpath('//form[@name="form1"]/select[@name="articles[]"][2]/option[@selected="selected"]'), array(2, 3), '->fillInDom() fills in values for multiple select');
// ->setTypes()
$t->diag('->setTypes()');
$f = new sfFillInForm();
$f->setTypes(array('text', 'checkbox', 'radio'));
$xml = simplexml_import_dom($f->fillInDom(clone $dom, null, null, $values));
$t->is(get_input_value($xml, 'hidden_input'), '1', '->setTypes() allows to prevent some input fields from being filled');
$t->is(get_input_value($xml, 'password'), '', '->setTypes() allows to prevent some input fields from being filled');
$t->is(get_input_value($xml, 'input_text'), 'my input text', '->setTypes() allows to prevent some input fields from being filled');
// ->setSkipFields()
$t->diag('->setSkipFields()');
$f = new sfFillInForm();
$f->setSkipFields(array('input_text', 'input_checkbox', 'textarea', 'select_multiple', 'article[title]'));
$xml = simplexml_import_dom($f->fillInDom(clone $dom, null, null, $values));
$t->is(get_input_value($xml, 'hidden_input'), '2', '->setSkipFields() allows to prevent some fields to be filled');
$t->is(get_input_value($xml, 'input_text'), 'default_value', '->setSkipFields() allows to prevent some fields to be filled');
$t->is(get_input_value($xml, 'empty_input_text'), 'input text', '->setSkipFields() allows to prevent some fields to be filled');
$t->is(get_input_value($xml, 'password'), 'mypassword', '->setSkipFields() allows to prevent some fields to be filled');
$t->is(get_input_value($xml, 'input_checkbox', 'checked'), 'checked', '->setSkipFields() allows to prevent some fields to be filled');
$t->is(get_input_value($xml, 'input_checkbox_not_checked', 'checked'), 'checked', '->setSkipFields() allows to prevent some fields to be filled');