Skip to content

Conversation

@michalbundyra
Copy link
Member

Fixes #6

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

@rjmackay
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'
                        ]
                    ]
                ]
            );

@michalbundyra
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants