Skip to content

Instantly share code, notes, and snippets.

@rickard2 rickard2/gist:6062801
Last active Dec 20, 2015

What would you like to do?
$mock = $this->getMockBuilder('SomeClass')->setMethods('foo')->getMock();
$foo = $mock->expects($this->exactly(2))->method('foo');
$object = new OtherClass($mock);
$result = $object->doStuff();
$this->assertEquals( ... , $result);
$foo->will($this->throwException(new Exception()));
$result = $object->doStuff();
$this->assertEquals( ... , $result);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.