Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

- Fix testMockedMethodIsCalledOnceWithCorrectParameter() test.

- Remove testMockedMethodIsCalledOnceWithWrongParameter() test because
  this cannot be tested.
  • Loading branch information...
commit b8f4d155238f896e794259c4b90c9661b06e1b5f 1 parent 7aa3d5e
@sebastianbergmann authored
Showing with 5 additions and 30 deletions.
  1. +5 −30 PHPUnit/Tests/Framework/MockObjectTest.php
View
35 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');
}
}
?>
Please sign in to comment.
Something went wrong with that request. Please try again.