本文整理匯總了PHP中Revision::fetchRevision方法的典型用法代碼示例。如果您正苦於以下問題:PHP Revision::fetchRevision方法的具體用法?PHP Revision::fetchRevision怎麽用?PHP Revision::fetchRevision使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Revision
的用法示例。
在下文中一共展示了Revision::fetchRevision方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testFetchRevision
/**
* @covers Revision::fetchRevision
*/
public function testFetchRevision()
{
$page = $this->createPage('RevisionStorageTest_testFetchRevision', 'one', CONTENT_MODEL_WIKITEXT);
// Hidden process cache assertion below
$page->getRevision()->getId();
$page->doEditContent(new WikitextContent('two'), 'second rev');
$id = $page->getRevision()->getId();
$res = Revision::fetchRevision($page->getTitle());
# note: order is unspecified
$rows = [];
while ($row = $res->fetchObject()) {
$rows[$row->rev_id] = $row;
}
$this->assertEquals(1, count($rows), 'expected exactly one revision');
$this->assertArrayHasKey($id, $rows, 'missing revision with id ' . $id);
}
示例2: testFetchRevision
/**
* @covers Revision::fetchRevision
*/
public function testFetchRevision()
{
$page = $this->createPage('RevisionStorageTest_testFetchRevision', 'one');
$id1 = $page->getRevision()->getId();
$page->doEdit('two', 'second rev');
$id2 = $page->getRevision()->getId();
$res = Revision::fetchRevision($page->getTitle());
#note: order is unspecified
$rows = array();
while ($row = $res->fetchObject()) {
$rows[$row->rev_id] = $row;
}
$row = $res->fetchObject();
$this->assertEquals(1, count($rows), 'expected exactly one revision');
$this->assertArrayHasKey($id2, $rows, 'missing revision with id ' . $id2);
}