Skip to content

Instantly share code, notes, and snippets.

@ivanhoe011
Created August 23, 2014 09:53
Show Gist options
  • Save ivanhoe011/396e77a5c1e4db50c081 to your computer and use it in GitHub Desktop.
Save ivanhoe011/396e77a5c1e4db50c081 to your computer and use it in GitHub Desktop.
mocking
$mock = Mockery::mock('SceneMongo');
$mock->shouldReceive('where')->with('visible', 1)->once()->andReturn($mock);
$mock->shouldReceive('where')->with('published_at', '<=', Mockery::type('int'))->once()->andReturn($mock);
$mock->shouldReceive('take')->with($limit)->once()->andReturn($mock);
$mock->shouldReceive('orderBy')->with('rating', 'DESC')->once()->andReturn($mock);
$mock->shouldReceive('get')->once()->andReturn($collection);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment