Skip to content

Commit

Permalink
add docs on how to test basic/digest auth
Browse files Browse the repository at this point in the history
  • Loading branch information
LordSimal committed Sep 17, 2023
1 parent 27c0d04 commit e48ff9d
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions docs/en/testing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,23 @@ With token based authentication you need to simulate the
$this->get('/api/bookmarks');
$this->assertResponseOk();
}


Basic/Digest based authentication
=================================

When testing Basic or Digest Authentication, you can add the environment
variables that `PHP creates <https://php.net/manual/en/features.http-auth.php>`_
automatically.::

public function testGet()
{
$this->configRequest([
'environment' => [
'PHP_AUTH_USER' => 'username',
'PHP_AUTH_PW' => 'password',
]
]);
$this->get('/api/bookmarks');
$this->assertResponseOk();
}

0 comments on commit e48ff9d

Please sign in to comment.