Permalink
Browse files

- Fix testMockedMethodIsCalledOnceWithCorrectParameter() test.

- Remove testMockedMethodIsCalledOnceWithWrongParameter() test because
  this cannot be tested.
  • Loading branch information...
sebastianbergmann committed Feb 7, 2007
1 parent 7aa3d5e commit b8f4d155238f896e794259c4b90c9661b06e1b5f
Showing with 5 additions and 30 deletions.
  1. +5 −30 PHPUnit/Tests/Framework/MockObjectTest.php
@@ -65,38 +65,13 @@ class Framework_MockObjectTest extends PHPUnit_Framework_TestCase
{
public function testMockedMethodIsCalledOnceWithCorrectParameter()
{
- $mock = PHPUnit_Framework_MockObject_Mock::generate('AnInterface');
- $mockClass = new ReflectionClass($mock->mockClassName);
- $mockObject = $mockClass->newInstance();
-
- $mockObject->expects($this->once())
- ->method('doSomething')
- ->with($this->equalTo('something')
+ $mock = $this->getMock('AnInterface');
+ $mock->expects($this->once())
+ ->method('doSomething')
+ ->with($this->equalTo('something')
);
- $mockObject->doSomething('something');
- }
-
- public function testMockedMethodIsCalledOnceWithWrongParameter()
- {
- $mock = PHPUnit_Framework_MockObject_Mock::generate('AnInterface');
- $mockClass = new ReflectionClass($mock->mockClassName);
- $mockObject = $mockClass->newInstance();
-
- $mockObject->expects($this->once())
- ->method('doSomething')
- ->with($this->equalTo('something')
- );
-
- try {
- $mockObject->doSomething('anything');
- }
-
- catch (Exception $e) {
- return;
- }
-
- $this->fail();
+ $mock->doSomething('something');
}
}
?>

0 comments on commit b8f4d15

Please sign in to comment.