Skip to content

Commit

Permalink
Add some more tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianbergmann committed Feb 7, 2007
1 parent f8acff7 commit f096632
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions PHPUnit/Tests/Framework/MockObjectTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 f096632

Please sign in to comment.