Hi #pest experts, I need your help.
I want to integrate tests with pest but as my app makes heavy use of github.com/omniphx/forrest
Would it be possible to fake this calls so I don't have to have a salesforce instance to polute?
Hi #pest experts, I need your help.
I want to integrate tests with pest but as my app makes heavy use of github.com/omniphx/forrest
If it's presented as an eloquent driver (i.e. eloquent treats the salesforce API like a database), then you could just use an SQLite database to back those models in tests.
Hmm, this seems very interesting. I'll look into the library to see if it supports it. I'm worried is not but I'll look if I can edit the library to support it. Do you happen to know another driver where it works like that so I can look at code for reference?
Ok after digging in the code a bit I didn't find how to replace the "database" with sqlite but apparently here: github.com/omniphx/forrest/blob/b9a62e2bd4d3b5e3ddfa779b93d1cf8c86e51b00/src/Omniphx/Forrest/Providers/Laravel/ForrestServiceProvider.php#L27
it instantiates a guzzle http client.I've seen it done before on a project that used github.com/PortableStudios/eloquent-zoho
- but that driver is built differently - it completely acts like a database driver (complete with schema builder/migrations) so it can easily be swapped for another database driver for testing or local development.
Ah, that kind of driver would be beyond my current knowledge to implement.
I’ll see if I have better luck with the Http::fake() route.
That seems to be the fastest approach and would be ideal, as I’d still like to test which API calls are sent and how they function.
Thank you for the reference, being abble to implement a complete eloquent database driver would be a nice skill to have in the future but is not achievable today due to time constraints.