Ciao sto usando phpunit per il test e Symfony \ Bundle \ FrameworkBundle \ Test \ WebTestCase per il test delle unità. Finora non c'erano problemi, ma ora iniziamo a usare https e i miei test non funzionano più. Comincio a ottenere il codice di risposta 301 per ogni mia richiesta nei miei test. La mia domanda è come dire a Symfony \ Component \ HttpKernel \ Client di effettuare richieste a https: //lhosthost.com/uri anziché http: //lhosthost.com/uri?Come eseguire richieste https nel test funzionale symfony2?
EDIT
Nel sito di symfony http://symfony.com/doc/current/book/testing.html mostrano come configurare i parametri del server e non v'è una pace codice come
$client->request(
'GET',
'/demo/hello/Fabien',
array(),
array(),
array(
'CONTENT_TYPE' => 'application/json',
'HTTP_REFERER' => '/foo/bar',
'HTTP_X-Requested-With' => 'XMLHttpRequest',
)
);
ho cercato di dare elemento HTTPS come indicato nel http://php.net/manual/en/reserved.variables.server.php cambiato il mio codice come
$client->request('GET',
'/'.$version.'/agencies/'.$agencyId,
array(),
array(),
array('HTTPS' => 'on')
);
Tuttavia, è ancora non funziona?
hai provato $ client-> richiesta ('GET', 'https: // localhost/uri'); ? – ziollek
Vuole una richiesta ** https ** non una richiesta ** http **. – ferdynator
Il terzo argomento di $ this-> createClient() è un array di server. Cosa succede se imposti l'elemento "https"? –