php-k8s icon indicating copy to clipboard operation
php-k8s copied to clipboard

[enhancement] Mocking during testing

Open georgeboot opened this issue 3 years ago • 5 comments

I would love to test our code that implements this package. However, I can't seem to find an easy way to mock this package cq the underlying HTTP client.

What approach are others using?

georgeboot avatar Mar 28 '22 12:03 georgeboot

This issue has been automatically closed because it has not had any recent activity. 😨

stale[bot] avatar Apr 28 '22 19:04 stale[bot]

I got an eye on @Sammyjo20's Saloon package and might use it. 😁

rennokki avatar May 05 '22 22:05 rennokki

@rennokki if you want an example or two of how I set up mocking for my SDKs just let me know!

Sammyjo20 avatar May 06 '22 06:05 Sammyjo20

This issue has been automatically closed because it has not had any recent activity. 😨

stale[bot] avatar Jun 19 '22 00:06 stale[bot]

Hey @rennokki just got notified about this issue, it’s been a while since we last spoke about it and Saloon has matured a lot in the time!

I built an SDK template repo which you can use and it has support for mocking out of the box. You can do

$sdk = new SDK() $sdk->withMockClient($mockClient)

$sdk->request(new MyRequest)

// Or configure request collections

$sdk->users()->all()

The SDK repo is here but it’s all covered in the docs too 😀

https://github.com/Sammyjo20/saloon-sdk-template

Sammyjo20 avatar Jun 19 '22 04:06 Sammyjo20

This issue has been automatically closed because it has not had any recent activity. 😨

stale[bot] avatar Sep 28 '22 02:09 stale[bot]

Hey @rennokki I saw that you reopened the issue, Saloon v2 is on the horizon (before the end of the year) so that might be an exciting moment to consider using it again, but if you are interested in Mocking I've recently built a really cool Fixture recording feature that might help!

https://docs.saloon.dev/next-steps/testing-faking-responses/recording-requests

Sammyjo20 avatar Nov 09 '22 12:11 Sammyjo20

@Sammyjo20 Yeah, I actually reconsidered it since I've recently came back to become more involved into the project, so first steps are to have a proper cleanup of the issues and prioritize fixes, and take care of features and enhancements afterwards. :D

If you got the beta version, I might as well use it (with the risk of breaks) and merge it once the first few releases of v2 are published.

rennokki avatar Nov 09 '22 12:11 rennokki

That’s awesome!! I haven’t written the updated docs yet but as soon as I do that, I’ll tag a beta. You can start using the v2 branch now if you like but it may be a bit tricky without docs. You can always message me on Twitter :)

Sammyjo20 avatar Nov 09 '22 12:11 Sammyjo20

This issue has been automatically closed because it has not had any recent activity. 😨

stale[bot] avatar Dec 31 '22 21:12 stale[bot]

@rennokki do you still have plans to start using Saloon for this package?

georgeboot avatar Jan 10 '23 15:01 georgeboot

Just to let you know I intent to release the beta for Saloon v2 this week, the docs are still work-in-progress but all the basics are covered

Sammyjo20 avatar Jan 11 '23 07:01 Sammyjo20

The v2 beta is now ready and most of the docs are up ⬆️ https://docs.saloon.dev/v/2

Sammyjo20 avatar Jan 15 '23 19:01 Sammyjo20