public function setUp() { $document = new MediaWikiDocument(new SimpleXMLElement($this->documentManyRevisionsXml)); $contributor = new MediaWikiContributor(json_decode($this->documentManyRevisionsUserJson, true)); $this->instance = new GitCommitFileRevision($document, 'foo/', '.html'); $revisionsList = $document->getRevisions(); for ($revisionsList->rewind(); $revisionsList->valid(); $revisionsList->next()) { $rev = $revisionsList->current(); $rev->setContributor($contributor, false); } $this->instance->setRevision($document->getLatest()); }
/** * @covers ::getLatest */ public function testRevisionOrderingListContributors() { // Made sure we have at least 2 revisions in SAMPLE // dumpBackupXml, and that the the contributors usernames // are in order. $hardcodedContributors = 'Dgash,Shepazu'; $obj = new MediaWikiDocument($this->dumpBackupXml->page[0]); $stack = $obj->getRevisions(); $stack->rewind(); $contributors = array(); while ($stack->valid()) { $contributors[] = $stack->current()->getContributorName(); $stack->next(); } $this->assertSame(implode($contributors, ','), $hardcodedContributors); }