I want to check my main copyrighted pages. The tamper test works fine. But I am struggling with an authorized login, because I do not know how to set the headers in the test.
I could not find any tips on how to set the headers on $this->call() . The only information I could find was:
$this->call($method, $uri, $parameters, $cookies, $files, $server, $content);
and missing headers.
How to easily check basic auth on laravel. Specific: how to set the main auth header for a test request?
I currently have:
class ExampleTest extends TestCase { public function test401UnauthorizedOnMe() { $response = $this->call('GET', '/api/me'); $this->assertResponseStatus( 401); } public function testCorrectLoginOnMe() {
I tried $this->$request->setHeader(); but with this I get an error:
1) ExampleTest::testCorrectLoginOnMe ErrorException: Undefined property: ExampleTest::$request
jerik source share