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

Added support for multiple calls of the same function with different args #9

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

Merged
michalbundyra merged 1 commit into php-mock:master from michalbundyra:hotfix/multiple-calls
Mar 27, 2018

Conversation

Copy link
Member

@michalbundyra michalbundyra commented Mar 23, 2018

Fixes #6

@rjmackay would you be able to have a look on this solution and test it with your project? Thanks!

rjmackay and krodyrobi reacted with thumbs up emoji
Copy link

That seems to work for me.

Here's some of the code I have testing an IMAP email integration just to give you an idea:

$mockFetchStructure = PHPMockery::mock("Ushahidi\App\DataSource\Email", "imap_fetchstructure");
 // Call for first email
 $mockFetchStructure
 ->with('notreallyaconnection', 1, FT_UID)
 ->once()
 ->andReturn(
 (object)[
 'parts' => [
 11 => (object)[
 'subtype' => 'HTML'
 ],
 111 => (object)[
 'subtype' => 'PLAIN'
 ]
 ]
 ]
 );
 // Handle call for 2nd message
 $mockFetchStructure
 ->once()
 ->with('notreallyaconnection', 5, FT_UID)
 ->andReturn(
 (object)[
 'parts' => [
 55 => (object)[
 'subtype' => 'HTML'
 ]
 ]
 ]
 );
 // Handle call for 3rd message
 $mockFetchStructure
 ->once()
 ->with('notreallyaconnection', 7, FT_UID)
 ->andReturn(
 (object)[
 'parts' => [
 77 => (object)[
 'subtype' => 'PLAIN'
 ]
 ]
 ]
 );

Copy link
Member Author

@rjmackay Thanks for your feedback! I'm going to release it shortly :)

@michalbundyra michalbundyra merged commit 7b9b4f8 into php-mock:master Mar 27, 2018
michalbundyra added a commit that referenced this pull request Mar 27, 2018
@michalbundyra michalbundyra deleted the hotfix/multiple-calls branch March 27, 2018 07:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Projects
None yet
Milestone
1.3.0
Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /