public function testHasOnes()
 {
     /** @var DataDifferencerTest_Object $obj1 */
     $obj1 = $this->objFromFixture('DataDifferencerTest_Object', 'obj1');
     $image1 = $this->objFromFixture('Image', 'image1');
     $image2 = $this->objFromFixture('Image', 'image2');
     $relobj1 = $this->objFromFixture('DataDifferencerTest_HasOneRelationObject', 'relobj1');
     $relobj2 = $this->objFromFixture('DataDifferencerTest_HasOneRelationObject', 'relobj2');
     // create a new version
     $beforeVersion = $obj1->Version;
     $obj1->ImageID = $image2->ID;
     $obj1->HasOneRelationID = $relobj2->ID;
     $obj1->write();
     $afterVersion = $obj1->Version;
     $this->assertNotEquals($beforeVersion, $afterVersion);
     /** @var DataDifferencerTest_Object $obj1v1 */
     $obj1v1 = Versioned::get_version('DataDifferencerTest_Object', $obj1->ID, $beforeVersion);
     /** @var DataDifferencerTest_Object $obj1v2 */
     $obj1v2 = Versioned::get_version('DataDifferencerTest_Object', $obj1->ID, $afterVersion);
     $differ = new DataDifferencer($obj1v1, $obj1v2);
     $obj1Diff = $differ->diffedData();
     $this->assertContains($image1->Name, $obj1Diff->getField('Image'));
     $this->assertContains($image2->Name, $obj1Diff->getField('Image'));
     $this->assertContains('<ins>obj2</ins><del>obj1</del>', str_replace(' ', '', $obj1Diff->getField('HasOneRelationID')));
 }
 /**
  * Compare two version, and return the diff between them.
  *
  * @param string $from The version to compare from.
  * @param string $to The version to compare to.
  *
  * @return DataObject
  */
 public function compareVersions($from, $to)
 {
     $owner = $this->owner;
     $fromRecord = Versioned::get_version($owner->class, $owner->ID, $from);
     $toRecord = Versioned::get_version($owner->class, $owner->ID, $to);
     $diff = new DataDifferencer($fromRecord, $toRecord);
     return $diff->diffedData();
 }