Skip to content

Commit

Permalink
fix(testing): correctly get the JWT token (#1718)
Browse files Browse the repository at this point in the history
  • Loading branch information
alanpoulain authored Feb 14, 2023
1 parent 8145d38 commit 93ff3fc
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions core/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,16 +81,16 @@ abstract class AbstractTest extends ApiTestCase
return $this->token;
}

$response = static::createClient()->request('POST', '/login', ['body' => $body ?: [
$response = static::createClient()->request('POST', '/login', ['json' => $body ?: [
'username' => 'admin@example.com',
'password' => '$3cr3t',
]]);

$this->assertResponseIsSuccessful();
$data = json_decode($response->getContent());
$this->token = $data->access_token;
$data = $response->toArray();
$this->token = $data['token'];

return $data->access_token;
return $data['token'];
}
}
```
Expand Down

0 comments on commit 93ff3fc

Please sign in to comment.