on my phone atm, so can't type a lot of code. But i just did a similar thing and this link was what helped me the most:
https://stefanzweifel.io/posts/how-i-write-integration-tests-for-laravel-socialite-powered-apps
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
In my Laravel application, I'm using a third-party API which in order to use, it requires a token generated when logging into the application using OAuth.
For example, when a user signs in using GitLab, they receive a token which is saved in the database. This token is then used to create issues within GitLab.
What is the best way to write feature tests for this logic?
How do I write a test which tests if a user can create an issue with their API token? Specifically testing that if the user has a valid token, when they send a request to the API they receive a "successful" JSON response from the API.
If anyone has any tips or best practice guidelines or articles which help to explain this process, I would much appreciate it.
Please or to participate in this conversation.