Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

MockHandler - Add support to reset internal queue#2143

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged

Conversation

@ingluisjimenez
Copy link
Contributor

@ingluisjimenezingluisjimenez commentedSep 13, 2018
edited
Loading

QA
Bug?no
New Feature?yes
Version6.3.3

Actual Behavior

MockHandler doesn't offer a way of resetting the internal queue. There are testing scenarios where the handler has been initialized in the setUp() method of a test suite, to avoid duplication, and some specific responses are queued up as the default behavior but then you have tests which need to queue up something different (i.e a request error).

In this cases, it is not possible to reuse the handler defined in setUp(), and instad, it is required to re-instantiate and re-wire a handler and the dependencies all over again.

Expected Behavior

To avoid having to wire and set up the handler all over again, it would be great to expose a way to reset the internal queue in the MockHandler instance, and then just queue the new response(s).

This PR adds a method to MockHandler to reset the internal queue. Calling$handler->reset(); would reset the internal array and allow the tester to queue up new responses.

@ingluisjimenez
Copy link
ContributorAuthor

@sagikazarmark@Nyholm Please let me know what do you think about this little feature, and whether this is the correct way of doing this or if there is a better way that maybe I'm not aware of.

@ingluisjimenezingluisjimenezforce-pushed themock-handler-reset-queue branch 2 times, most recently from9e2dde8 to0ff5bf2CompareSeptember 14, 2018 15:33
Copy link
Member

@NyholmNyholm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Thank you

@NyholmNyholm added this to the6.5.0 milestoneOct 19, 2019
@ingluisjimenez
Copy link
ContributorAuthor

rebased with latest from master

Nyholm reacted with hooray emoji

@NyholmNyholm merged commit6a94646 intoguzzle:masterOct 23, 2019
@ingluisjimenez
Copy link
ContributorAuthor

Thank you for reviewing/merging! 🎉

Nyholm and dialupdev reacted with hooray emoji

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@sagikazarmarksagikazarmarksagikazarmark approved these changes

@NyholmNyholmNyholm approved these changes

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

6.5.0

Development

Successfully merging this pull request may close these issues.

3 participants

@ingluisjimenez@sagikazarmark@Nyholm

[8]ページ先頭

©2009-2025 Movatter.jp