Support the ongoing development of Laravel.io →
Authentication Testing

We are implementing Luca Degasperi's OAuth 2 server in our REST app.

The integration seem to work very well, but a crucial server call seems to fail during unit tests with PHPUnit. We can easily retrieve the token bearer's id with:

ResourceServer::getOwnerId()

But this seem to always return 0 when called during a unit test. The authentication part works well under unit tests.

Is there something specific we need to do to get the ResourceServer prepped when setting up the test fixture?

Last updated 3 years ago.
0

Had super help from the author and came up with a workable solution: https://gist.github.com/JannieT/9659047

Last updated 3 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

JannieT janniet Joined 21 Feb 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.