안녕하세요, 테스트를 위해 phpunit을 사용하고 있습니다. 단위 테스트를 위해 Symfony \ Bundle \ FrameworkBundle \ Test \ WebTestCase를 사용하고 있습니다. 지금까지는 문제가 없었지만 이제는 https를 사용하기 시작하고 테스트가 더 이상 작동하지 않습니다. 테스트에서 모든 요청에 대해 301 응답 코드를 받기 시작합니다. 내 질문은 어떻게 https : //localhost.com/uri에 http : // : //localhost.com/uri 대신에 Symfony \ Component \ HttpKernel \ Client에게 요청할 수 있습니까?symfony2 기능 테스트에서 https 요청을하는 방법은 무엇입니까?
심포니 웹 사이트 http://symfony.com/doc/current/book/testing.html 편집은
그들은 서버 매개 변수를 구성하고 나의 코드를 변경 내가 http://php.net/manual/en/reserved.variables.server.php에서 언급 된 HTTPS 요소를 제공하기 위해 노력
$client->request(
'GET',
'/demo/hello/Fabien',
array(),
array(),
array(
'CONTENT_TYPE' => 'application/json',
'HTTP_REFERER' => '/foo/bar',
'HTTP_X-Requested-With' => 'XMLHttpRequest',
)
);
같은 코드 평화가하는 방법을 보여줍니다
$client->request('GET',
'/'.$version.'/agencies/'.$agencyId,
array(),
array(),
array('HTTPS' => 'on')
);
그러나 여전히 작동하지 않습니까?
static::createClient();
에 : @WouterJ에
$ client-> request ('GET', 'https : // localhost/uri')를 시도 했습니까? ? – ziollek
그는 ** http ** 요청이 아닌 ** https ** 요청을 원합니다. – ferdynator
$ this-> createClient()의 세 번째 인수는 서버 배열입니다. 'https'요소를 설정하면 어떻게됩니까? –