Wild cards (*) for fixtures #394
GregoireGaonach
started this conversation in
Ideas
Replies: 1 comment
-
|
I have (I think), the very same problem today. My ideal test would look like this: But when I run the test, the URL which is called is: which results in: Basically, I don't care about the end of the URL after the email parameter as they won't change the return I'm expecting. To add, the test still fails, even if I use the full URL (URL encoded or not) e.g. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello everyone!
SaloonPHP has been absolutely amazing for my project, so thank you from the bottom of my heart.
Just an idea I wanted to share. I am writing some tests for the European Parliament API endpoint. To get all the data, there is a need to do nested calls, which I can easily handle with nested actions.
Anyway, on the tests, because of this, I need to design a lot of fixtures to have the test pass as close to reality as possible. At the moment it looks like this:
Saloon::fake([ 'data.europarl.europa.eu/api/v1/corporate-bodies/ep-9' => MockResponse::fixture('corporate-body-ep-9'), 'data.europarl.europa.eu/api/v1/corporate-bodies/6417' => MockResponse::fixture('corporate-body-6417'), 'data.europarl.europa.eu/api/v1/corporate-bodies/5116' => MockResponse::fixture('corporate-body-5116'), 'data.europarl.europa.eu/api/v1/corporate-bodies/6359' => MockResponse::fixture('corporate-body-6359'), ... ... )];What I would love to be able to do is something like this:
Saloon::fake([ 'data.europarl.europa.eu/api/v1/corporate-bodies/*' => MockResponse::fixture('corporate-body-*'), )];As far as I know this is not possible at the moment, wildcards
(*)are only supported for the endpoint and not for the fixture.I would be happy to try to implement this feature if you think it is a good idea, but I would have to dive into the codebase first.
Thanks again for the great work!
Beta Was this translation helpful? Give feedback.
All reactions