From e48ff9ded04110722e92934d18bf7e978b6bd07a Mon Sep 17 00:00:00 2001 From: Kevin Pfeifer Date: Sun, 17 Sep 2023 16:12:28 +0200 Subject: [PATCH] add docs on how to test basic/digest auth --- docs/en/testing.rst | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/docs/en/testing.rst b/docs/en/testing.rst index 276ecd31..b05b9eb8 100644 --- a/docs/en/testing.rst +++ b/docs/en/testing.rst @@ -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 `_ +automatically.:: + + public function testGet() + { + $this->configRequest([ + 'environment' => [ + 'PHP_AUTH_USER' => 'username', + 'PHP_AUTH_PW' => 'password', + ] + ]); + $this->get('/api/bookmarks'); + $this->assertResponseOk(); + }