php - Functional Test in Symfony fake HTTP_ACCEPT_LANGUAGE -



php - Functional Test in Symfony fake HTTP_ACCEPT_LANGUAGE -

i want functional test symfony2 check if users profile displayed , if form working:

namespace dbe\ddbundle\tests\controller;

use symfony\bundle\frameworkbundle\test\webtestcase;

class profilecontrollertest extends webtestcase {

public function testnewsletteronoff(){ // create new client browse application $client = static::createclient(); $client->request('get', '/', array(), array(), array( 'http_accept_language' => 'en', )); $crawler = $client->request('get', '/en/profile/');

after executing test in console: phpunit -c app next error message:

there 1 error: 1) dbe\ddbundle\tests\controller\profilecontrollertest::testnewsletteronoff undefined index: http_accept_language

i guess error comes because controller checking browsers language. how can false http_accept_language in functional tests symfony? in advance help!

i found solution, because website visitor get's redirected depending on browsers language needed define before constructing controller:

$_server['http_accept_language'] = 'en'; $client = static::createclient(); $crawler = $client->request('get', '/en/how');

php symfony2

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

c# - Create a Notification Object (Email or Page) At Run Time -- Dependency Injection or Factory -

Set Up Of Common Name Of SSL Certificate To Protect Plesk Panel -