diff --git a/lib/Cake/Test/Case/Event/CakeEventManagerTest.php b/lib/Cake/Test/Case/Event/CakeEventManagerTest.php index 4211e8e86..04a358ab4 100644 --- a/lib/Cake/Test/Case/Event/CakeEventManagerTest.php +++ b/lib/Cake/Test/Case/Event/CakeEventManagerTest.php @@ -241,13 +241,11 @@ class CakeEventManagerTest extends CakeTestCase { $manager->attach(array($anotherListener, 'listenerFunction'), 'fake.event'); $event = new CakeEvent('fake.event'); - $listener->expects($this->at(0)) - ->method('listenerFunction') - ->with($event) + $firstStep = clone $event; + $listener->expects($this->at(0))->method('listenerFunction') + ->with($firstStep) ->will($this->returnValue('something special')); - $anotherListener->expects($this->at(0)) - ->method('listenerFunction') - ->with($event); + $anotherListener->expects($this->at(0))->method('listenerFunction')->with($event); $manager->dispatch($event); $this->assertEquals('something special', $event->result); } @@ -265,11 +263,11 @@ class CakeEventManagerTest extends CakeTestCase { $manager->attach(array($anotherListener, 'listenerFunction'), 'fake.event'); $event = new CakeEvent('fake.event'); + $originalEvent = clone $event; $listener->expects($this->at(0))->method('listenerFunction') - ->with($event) + ->with($originalEvent) ->will($this->returnValue(false)); - $anotherListener->expects($this->never()) - ->method('listenerFunction'); + $anotherListener->expects($this->never())->method('listenerFunction'); $manager->dispatch($event); $this->assertTrue($event->isStopped()); }