diff --git a/Tests/MockObjectTest.php b/Tests/MockObjectTest.php index 302822bf..3745c76f 100644 --- a/Tests/MockObjectTest.php +++ b/Tests/MockObjectTest.php @@ -334,6 +334,26 @@ public function testMockObjectsConstructedIndepentantlyShouldNotEqual() $this->assertNotEquals($a,$b); } + public function testClonedMockObjectCanBeUsedInPlaceOfOriginalOne() + { + $x = $this->getMock('stdClass'); + $y = clone $x; + + $mock = $this->getMock('stdClass', array('foo')); + $mock->expects($this->once())->method('foo')->with($this->equalTo($x)); + $mock->foo($y); + } + + public function testClonedMockObjectIsNotIdenticalToOriginalOne() + { + $x = $this->getMock('stdClass'); + $y = clone $x; + + $mock = $this->getMock('stdClass', array('foo')); + $mock->expects($this->once())->method('foo')->with($this->logicalNot($this->identicalTo($x))); + $mock->foo($y); + } + public function testStaticMethodCallWithArgumentCloningEnabled() { $expectedObject = new StdClass;