Skip to content

Latest commit

 

History

History
20 lines (15 loc) · 622 Bytes

http_authentication.rst

File metadata and controls

20 lines (15 loc) · 622 Bytes

single: Tests; HTTP Authentication

How to simulate HTTP Authentication in a Functional Test

If your application needs HTTP authentication, pass the username and password as server variables to createClient():

$client = static::createClient(array(), array(
    'PHP_AUTH_USER' => 'username',
    'PHP_AUTH_PW'   => 'pa$$word',
));

You can also override it on a per request basis:

$client->request('DELETE', '/post/12', array(), array(
    'PHP_AUTH_USER' => 'username',
    'PHP_AUTH_PW'   => 'pa$$word',
));