Comments (5)
This is a valid point, we'll look into possible solutions. For now you could the fixtures by success/fail and load a different fixtures path until we have a working solution.
from php-http-fixture-client.
@Fivell, I think it is hard to determine which response should be returned at which time if the uri is the same. Do you have an idea for a possible implementation?
You can use different fixture paths as suggested by @bbrala. Besides, this client extends php-http/mock-client. This allows you to add custom responses (or exceptions) that ignore the fixtures.
$client = new \Swis\Http\Fixture\Client(...);
$response = $this->createMock('Psr\Http\Message\ResponseInterface');
$client->addResponse($response);
$client->sendRequest(new Request(...)); // uses above response from queue
$client->sendRequest(new Request(...)); // uses fixture file
N.B. You can't use a default response for the mock client because this client uses that to set the response from the fixture.
from php-http-fixture-client.
I have added a note about the underlying mock-client to the readme: https://github.com/swisnl/php-http-fixture-client/blob/master/README.md#mocks-advanced
from php-http-fixture-client.
I think it is hard to determine which response should be returned at which time if the uri is the same. Do you have an idea for a possible implementation?
I didn't dig into implementation of current library (i even not a php guy for ages) but for sure the only way is to also take request body into a account not only method/path, also we finally succeed with php-vcr library (which stores yaml files with both requests and responses in fuxtures) when test our api client.
Feel free to close this issue since you find a way to do it ignoring fixtures and we find more complex library for our needs
from php-http-fixture-client.
I'm closing this issue because alternatives exist and this can't be fixed using the current matching strategy i.e. mapping a request (body) to a static file.
from php-http-fixture-client.
Related Issues (7)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from php-http-fixture-client.