public function testGetLogEntry() { $this->setupGetEntities(); $q10 = new ItemId('Q10'); $q11 = new ItemId('Q11'); $redirect = new EntityRedirect($q10, $q11); $revId = $this->repo->saveRedirect($redirect, 'foo', $GLOBALS['wgUser'], EDIT_NEW); $logEntry = $this->repo->getLogEntry($revId); $this->assertNotNull($logEntry); $this->assertEquals($revId, $logEntry['revision']); $this->assertEquals('Q10', $logEntry['entity']); $this->assertEquals('foo', $logEntry['summary']); }
/** * Asserts that the revision with the given ID has a summary matching $regex * * @param string|string[] $regex The regex to match, or an array to build a regex from * @param int $revid * @param string $message */ public function assertRevisionSummary($regex, $revid, $message = '') { if (is_array($regex)) { $r = ''; foreach ($regex as $s) { if (strlen($r) > 0) { $r .= '.*'; } $r .= preg_quote($s, '!'); } $regex = "!{$r}!"; } $entry = $this->mockRepository->getLogEntry($revid); Assert::assertNotNull($entry, "revision not found: {$revid}"); Assert::assertRegExp($regex, $entry['summary'], $message); }