Skip to content

[9.x] Allow removing token during tests#42841

Merged
taylorotwell merged 2 commits intolaravel:9.xfrom
tontonsb:patch-26
Jun 17, 2022
Merged

[9.x] Allow removing token during tests#42841
taylorotwell merged 2 commits intolaravel:9.xfrom
tontonsb:patch-26

Conversation

@tontonsb
Copy link
Copy Markdown
Contributor

Once you use a token, you are stuck with an Authorization header for the remainder of the test:

$this->getJson('a');

$this->withToken($token)->getJson('b');

$this->getJson('c'); // also uses the token

This PR adds a small helpers to turn off the token:

$this->getJson('a');

$this->withToken($token)->getJson('b');
$this->getJson('c'); // also uses the token

$this->withoutToken()->getJson('d'); // does not use the token
$this->getJson('e'); // no token either

@taylorotwell taylorotwell merged commit ebb4cdc into laravel:9.x Jun 17, 2022
@GrahamCampbell GrahamCampbell changed the title Allow removing token during tests [9.x] Allow removing token during tests Jun 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants