Skip to content
This repository was archived by the owner on Feb 20, 2023. It is now read-only.

Commit b167e11

Browse files
committed
Added additional test cases on how #100 affects the mock comparator and a failing test in that regard
Changing Framework/MockObject/Generator/mocked_clone.tpl.dist to: public function __clone() { if ($this->__phpunit_invocationMocker !== NULL) { $this->__phpunit_invocationMocker = clone $this->__phpunit_getInvocationMocker; } } maybe helps but the test still doesn't pass.
1 parent be7772f commit b167e11

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

Tests/MockObjectTest.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,26 @@ public function testMockObjectsConstructedIndepentantlyShouldNotEqual()
334334
$this->assertNotEquals($a,$b);
335335
}
336336

337+
public function testClonedMockObjectCanBeUsedInPlaceOfOriginalOne()
338+
{
339+
$x = $this->getMock('stdClass');
340+
$y = clone $x;
341+
342+
$mock = $this->getMock('stdClass', array('foo'));
343+
$mock->expects($this->once())->method('foo')->with($this->equalTo($x));
344+
$mock->foo($y);
345+
}
346+
347+
public function testClonedMockObjectIsNotIdenticalToOriginalOne()
348+
{
349+
$x = $this->getMock('stdClass');
350+
$y = clone $x;
351+
352+
$mock = $this->getMock('stdClass', array('foo'));
353+
$mock->expects($this->once())->method('foo')->with($this->logicalNot($this->identicalTo($x)));
354+
$mock->foo($y);
355+
}
356+
337357
public function testStaticMethodCallWithArgumentCloningEnabled()
338358
{
339359
$expectedObject = new StdClass;

0 commit comments

Comments
 (0)