本文整理汇总了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);
}