Skip to content

Instantly share code, notes, and snippets.

@clemherreman
Created May 13, 2011 13:39
Show Gist options
  • Save clemherreman/970560 to your computer and use it in GitHub Desktop.
Save clemherreman/970560 to your computer and use it in GitHub Desktop.
How to partially mock an existing object
<?php
$documentExtractor = new DocumentExtractor(
$ftpDir,
sfConfig::get('sf_test_dir').'/web/documents'
);
$mock = m::mock($documentExtractor);
$mock->shouldReceive('getDistantControlDir')
->with(true)
->andThrow('sfException', 'Mock exception');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment