/**
  * Tests that a PostRevision::fromStorageRow & ::toStorageRow roundtrip
  * returns the same DB data.
  */
 public function testRoundtrip()
 {
     $row = $this->generateRow();
     $object = PostRevision::fromStorageRow($row);
     // toStorageRow will add a bogus column 'rev_content_url' - that's ok.
     // It'll be caught in code to distinguish between external content and
     // content to be saved in rev_content, and, before inserting into DB,
     // it'll be unset. We'll ignore this column here.
     $roundtripRow = PostRevision::toStorageRow($object);
     unset($roundtripRow['rev_content_url']);
     // Due to our desire to store alphadecimal values in cache and binary values on
     // disk we need to perform uuid conversion before comparing
     $roundtripRow = UUID::convertUUIDs($roundtripRow, 'binary');
     $this->assertEquals($row, $roundtripRow);
 }
 /**
  * Returns a PostRevision object.
  *
  * You can pass in arguments to override default data.
  * With no arguments tossed in, a default revision (resembling a newly-
  * created topic title) will be returned.
  *
  * @param array[optional] $row DB row data (only specify override columns)
  * @param array[optional] $children Array of child PostRevision objects
  * @param int[optional] $depth Depth of the PostRevision object
  * @return PostRevision
  */
 protected function generateObject(array $row = array(), $children = array(), $depth = 0)
 {
     $row = $this->generateRow($row);
     $revision = PostRevision::fromStorageRow($row);
     $revision->setChildren($children);
     $revision->setDepth($depth);
     return $revision;
 }