Hi Joao,

I also place form fields using the array accessor like this. I wound
up doing this late one night...

class myTestBrowser extends sfTestBrowser
{
  public function post($uri, $parameters = array(), $formClass = null)
  {
    if ($formClass)
    {
      $parameters[sfForm::getCSRFFieldName()] =
call_user_func(array(new $formClass, 'getCSRFToken'),
sfConfig::get('sf_csrf_secret'));
    }

    return parent::post($uri, $parameters);
  }
}

// etc...

$browser->post('foo/save', array('bar' => 'baz'), 'myFooForm')

If that makes any sense.

Kris

On Jun 17, 9:41 am, Joao <[EMAIL PROTECTED]> wrote:
> Clarification:
> csrf can be disabled on a specific environment, test but the
>    <?php echo $form['_csrf_token'] ?>
> is still there.
> If it is not commented the test will fail because:
> [message]     Widget "_csrf_token" does not exist.
>
> Any tips ?
>
> Regards
> Joao Correia
>
> On Jun 17, 5:28 pm, Joao <[EMAIL PROTECTED]> wrote:
>
> > Any ideas how to bypass  csrf token  for functional testing ?
>
> > # post /user/signin
> > not ok 1 - last request threw an uncaught exception
> > InvalidArgumentException: Widget _csrf_token does not exist.
>
> > Regards
> > Joao
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to