Skip to content

Commit 93ff3fc

Browse files
authored
fix(testing): correctly get the JWT token (#1718)
1 parent 8145d38 commit 93ff3fc

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

core/testing.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,16 +81,16 @@ abstract class AbstractTest extends ApiTestCase
8181
return $this->token;
8282
}
8383

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

8989
$this->assertResponseIsSuccessful();
90-
$data = json_decode($response->getContent());
91-
$this->token = $data->access_token;
90+
$data = $response->toArray();
91+
$this->token = $data['token'];
9292

93-
return $data->access_token;
93+
return $data['token'];
9494
}
9595
}
9696
```

0 commit comments

Comments
 (0)