Skip to content

Multiple returns #15

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

Closed
vincentchalamon opened this issue Aug 11, 2017 · 1 comment
Closed

Multiple returns #15

vincentchalamon opened this issue Aug 11, 2017 · 1 comment
Labels

Comments

@vincentchalamon
Copy link

Hi,
I'm trying to create a mock of file_get_contents function. On the first call, it should throw an exception, but on the second call it should return a value. How can I mock it?:

try {
    $content = 'data:image/jpeg;base64,'.base64_encode(file_get_contents($url));
} catch (\Exception $e) {
    $content = 'data:image/jpeg;base64,'.base64_encode(file_get_contents(realpath(__DIR__.'/path/to/my/image.png')));
}
@malkusch
Copy link
Member

That's a PHPUnit question. I'll close it therefore. Please consult the PHPUnit documentation for this question.

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

No branches or pull requests

2 participants