Hi, I am writing a functional test for my restful api. My rest API returns a json format output. I write a test for validating the return of the api like below.
1) $browser-> get('vod/1/en/dfdfd/vodcategories')-> with('response')->begin()-> isStatusCode(200)-> end() ; 2) $browser->info('3 - The web service supports the JSON format'); $browser-> get('vod/1/en/dfdfd/vodcategories')-> with('request')->begin()-> isFormat('json')-> end() ; It works fine. Now I want to check the value of an element in the json output. The content of my json output is below. { "apiVersion":1, "languageid":1, "totalcount":10, "start":1, "count":1, "contenttype":"VOD", "categories": [ {"id":"9","name":"Love"}, {"id":"12","name":"Fun"}, {"id":"13","name":"Action VOD"}, {"id":"14","name":"Sports"} ], "status": {"flag":"success","errorcode":"0","errordescription":""} } I write the following tests, but they are not working. Can somebody help me regarding this? 1) $browser->info('3 - Version checking'); $browser-> get('VOD/1/en/dfdfd/1/33/8/allvodcontents')-> with('request')->isFormat('json')-> with('response')->begin()->isValid()- >checkElement('apiversion', 'sdsd')-> end() ; 2) $browser->info('3 - Version checking'); $browser-> get('VOD/1/en/dfdfd/1/33/8/allvodcontents')-> with('request')->isFormat('json')-> with('response')->matches('/"contenttype"\: "1"/')-> end() ; -- 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