Skip to content

How to call properties created in setupMethods without closures #390

Answered by geisi
geisi asked this question in Q&A
Discussion options

You must be logged in to vote

Thanks to nuno ->you can achieve that by using the tap() method like mentioned in the docs. https://pestphp.com/docs/higher-order-tests

it('cannot be accessed by unauthenticated')
    ->tap(fn() => actingAs($this->user))
    ->tap(fn() => get(route('company.show', $this->user->currentTeam)))
    ->assertStatus(302);

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by geisi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant