Created
May 20, 2015 16:14
-
-
Save manchuck/6506a0b3e6b34bc7b566 to your computer and use it in GitHub Desktop.
My mistake you do not need ordered just have define the times it should be called
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
include 'vendor/autoload.php'; | |
class FileObject { | |
public function readBytes() { /* ... */} | |
} | |
$stub = \Mockery::mock('FileObject'); | |
$stub->shouldReceive('readBytes') | |
->andReturn('foo') | |
->once(); | |
$stub->shouldReceive('readBytes') | |
->once() | |
->andReturn('bar'); | |
$stub->shouldReceive('readBytes') | |
->atLeast(1) | |
->andReturn('baz'); | |
var_dump($stub->readBytes()); | |
var_dump($stub->readBytes()); | |
var_dump($stub->readBytes()); | |
var_dump($stub->readBytes()); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
string(3) "foo" | |
string(3) "bar" | |
string(3) "baz" | |
string(3) "baz" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment