public function testObserverNotification() { $commit = new GitPHP_Commit($this->getMockBuilder('GitPHP_Project')->disableOriginalConstructor()->getMock(), '1234567890abcdef1234567890ABCDEF12345678', $this->getMockCommitLoader()); $observer = $this->getMock('GitPHP_Observer_Interface'); $matcher = $this->once(); $observer->expects($matcher)->method('ObjectChanged')->with($this->isInstanceOf('GitPHP_Commit'), $this->equalTo(GitPHP_Observer_Interface::CacheableDataChange)); $commit->AddObserver($observer); $title = $commit->GetTitle(); $title = $commit->GetTitle(); //cached $this->assertEquals(1, $matcher->getInvocationCount()); }