What am i doing wrong when trying to use withActor() in a test? #1188
-
I have a controller that has I call In a test i use During the test https://spiral.dev/docs/testing-http/current/en#sessionauthentication is says
Does withActor() not create an authentication context? is it just for quickly switching actors? Also to note that i have the UserRepository implement the ActorProviderInterface if that makes a difference. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 7 replies
-
I think it was fixed there #1176 |
Beta Was this translation helpful? Give feedback.
-
Looks like it's still the same.. also is it not meant to work with AuthMiddleware? Also the withoutMiddleware() seems like it's also not working? $fakeHttp->withoutMiddleware(CsrfMiddleware::class, CsrfFirewall::class)
// Received response status code [412 : Bad CSRF Token] but expected 201. I can get around the auth issue though by creating a token and creating the session data: $token = $tokenStorage->create(['userID' => $this->user->getUuid()]);
$fakeHttp-->withSession(
data: [
'auth' => [
'token' => [
'id' => $token->getID(),
'payload' => $token->getPayload(),
'expiresAt' => $token->getExpiresAt(),
]
]
],
) |
Beta Was this translation helpful? Give feedback.
I think it was fixed there #1176
but it was not released yet