Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow partial overriding of fixtures #416

Open
innocenzi opened this issue May 22, 2024 · 1 comment · May be fixed by #425
Open

Allow partial overriding of fixtures #416

innocenzi opened this issue May 22, 2024 · 1 comment · May be fixed by #425

Comments

@innocenzi
Copy link

So I've been using automatic fixture generation to test integration with an API that returns a lot of data.

However, I find myself duplicating some fixtures to edit some information in them so my assertions can pass depending on what I send in the request.

Instead of doing that, it would be great to have the following API:

MockClient::global([
    UpdateDealRequest::class => MockResponse::fixture('pipedrive/deal/update-16685-response', merge: [
        'status' => 'won'
    ]),
]);

The merge parameter would merge the array into the mocked response, so the following assertion would pass:

expect($response->dto())->status->toBe(Status::WON);

I am totally open to PRing that, I created the issue to avoid working on it if it was not going to be accepted 👍

@innocenzi
Copy link
Author

Ended up PRing anyway since the changes were relatively simple.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant