Thanks Massimiliano, you're right. I found the example below here
http://www.symfony-project.org/jobeet/1_4/Doctrine/en/09:

$browser->
  get('/')->
  click('Design')->
  get('/category/programming?page=2')->
  get('/category/programming', array('page' => 2))->
  post('search', array('keywords' => 'php'));


but in the action, I'm retrieving the JSON data through $request-
>getContent(). So, if I write the JSON data as an associative
array ,as in the example I have pasted, and then run the test, the
call to $request->getContent() returns NULL, (of course, if I use
normal browser like FF, $request->getContent() returns the JSON data
correctly) ...

Any help?


On Apr 22, 3:21 pm, Massimiliano Arione <garak...@gmail.com> wrote:
> Il giorno giovedì 21 aprile 2011 17:48:41 UTC+2, Javier Garcia ha scritto:
>
>
>
> > I want to create a functional test for an action that receives a POST
> > method with data in JSON format.
>
> > This is what I have:
>
> >   info('set car')->
> >   post('/user/'.$user->getId().'/set-car/'.$car->getId()'->
>
> >   with('request')->ifFormat('json')->begin()->
> >     isParameter('module', 'myModule')->
> >     isParameter('action', 'myAction')->
> >   end()->
>
> > But..where should I set the receiving json data?
>
> > sf 1.4
>
> You should pass data as second argument to post()
>
> cheers
> Massimiliano

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

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
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en

Reply via email to