Skip to content

Instantly share code, notes, and snippets.

@jarektkaczyk
Created June 13, 2020 14:18
Show Gist options
  • Save jarektkaczyk/5b74b5078265113eb1a840cb403c98bf to your computer and use it in GitHub Desktop.
Save jarektkaczyk/5b74b5078265113eb1a840cb403c98bf to your computer and use it in GitHub Desktop.
phpunit consecutive meh
<?php
// meh
$mock
->method('sum')
->withConsecutive([1,2,3], [4,5,6])
->willReturnOnConsecutiveCalls(6, 15);
// instead?
$mock->method('sum')->with(1,2,3)->willReturn(6);
$mock->method('sum')->with(4,5,6)->willReturn(15);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment