예제 #1
0
 /**
  * @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);
 }
 /**
  * @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);
 }