Permalink
Browse files

- Add some more tests.

  • Loading branch information...
sebastianbergmann committed Feb 7, 2007
1 parent 09e2f2d commit 4ffdcdfe6eab20d033bdea4e86e2d4a49acbe6e1
Showing with 28 additions and 0 deletions.
  1. +28 −0 PHPUnit/Tests/Framework/MockObjectTest.php
@@ -117,5 +117,33 @@ public function testMockedMethodIsCalledExactly()
$mock->doSomething();
$mock->doSomething();
}
+
+ public function testStubbedException()
+ {
+ $mock = $this->getMock('AnInterface');
+ $mock->expects($this->any())
+ ->method('doSomething')
+ ->will($this->throwException(new Exception));
+
+ try {
+ $mock->doSomething();
+ }
+
+ catch (Exception $e) {
+ return;
+ }
+
+ $this->fail();
+ }
+
+ public function testStubbedReturnValue()
+ {
+ $mock = $this->getMock('AnInterface');
+ $mock->expects($this->any())
+ ->method('doSomething')
+ ->will($this->returnValue('something'));
+
+ $this->assertEquals('something', $mock->doSomething());
+ }
}
?>

0 comments on commit 4ffdcdf

Please sign in to comment.