Closed prototorpedo closed 4 months ago
The issue you are running into due to the use of static values in the apereo/phpcas
package. That's not really fixable here. I think you will find the conversation in this recent #124 PR to be relevant and useful.
I'll offer the same suggestion in your case. You really want to avoid any use of phpCAS during automated test execution. (I would say this applies to all external dependencies.) You can do this by creating an interface that is injected into the various places you need it, then use a different concrete implementation for production vs running tests.
I tried implementing something, an interface implemented by a fake cas service and the real cas service and I switch between them in AppServiceProvider...but I get the same error...
LATER EDIT: never mind, it was just me being dumb. Actually this solution works great! thanks for the help!
Glad to hear it and happy to help out!
After upgrading an app to php 8.2 and laravel 10 and subfission/cas to 4.4, tests now fail with error:
phpCAS::client() has already been called
when using actingAs($user) in consecutive tests (even though RefreshDatabase is used).