/** * Tests the update() invocation on a mockup. */ public function testUpdateCalling() { $subject = new User(); $observer = $this->getMock('SplObserver'); $subject->attach($observer); $observer->expects($this->once())->method('update')->with($subject); $subject->notify(); }
public function testChangeInUserLeadsToUserObserverBeingNotified() { $observer = new UserObserver(); $user = new User(); $user->attach($observer); $user->changeEmail('*****@*****.**'); $this->assertCount(1, $observer->getChangedUsers()); }