/**
  * @return MergeChangeOpsFactory
  */
 protected function newChangeOpFactory()
 {
     $mockProvider = new ChangeOpTestMockProvider($this);
     $toItemId = new ItemId('Q3');
     $constraintProvider = $this->getMockBuilder('Wikibase\\Repo\\Validators\\EntityConstraintProvider')->disableOriginalConstructor()->getMock();
     $changeOpFactoryProvider = new ChangeOpFactoryProvider($constraintProvider, $mockProvider->getMockGuidGenerator(), $mockProvider->getMockGuidValidator(), $mockProvider->getMockGuidParser($toItemId), $mockProvider->getMockSnakValidator(), $mockProvider->getMockTermValidatorFactory(), MockSiteStore::newFromTestSites());
     return new MergeChangeOpsFactory($constraintProvider, $changeOpFactoryProvider, MockSiteStore::newFromTestSites());
 }
 protected function makeChangeOpsMerge(Item $fromItem, Item $toItem, array $ignoreConflicts = array(), $siteLookup = null)
 {
     if ($siteLookup === null) {
         $siteLookup = MockSiteStore::newFromTestSites();
     }
     // A validator which makes sure that no site link is for page 'DUPE'
     $siteLinkUniquenessValidator = $this->getMock('Wikibase\\Repo\\Validators\\EntityValidator');
     $siteLinkUniquenessValidator->expects($this->any())->method('validateEntity')->will($this->returnCallback(function (Item $item) {
         $siteLinks = $item->getSiteLinkList();
         foreach ($siteLinks as $siteLink) {
             if ($siteLink->getPageName() === 'DUPE') {
                 return Result::newError(array(Error::newError('SiteLink conflict')));
             }
         }
         return Result::newSuccess();
     }));
     $constraintProvider = $this->getMockBuilder('Wikibase\\Repo\\Validators\\EntityConstraintProvider')->disableOriginalConstructor()->getMock();
     $constraintProvider->expects($this->any())->method('getUpdateValidators')->will($this->returnValue(array($siteLinkUniquenessValidator)));
     $changeOpFactoryProvider = new ChangeOpFactoryProvider($constraintProvider, $this->mockProvider->getMockGuidGenerator(), $this->mockProvider->getMockGuidValidator(), $this->mockProvider->getMockGuidParser($toItem->getId()), $this->mockProvider->getMockSnakValidator(), $this->mockProvider->getMockTermValidatorFactory(), $siteLookup);
     return new ChangeOpsMerge($fromItem, $toItem, $ignoreConflicts, $constraintProvider, $changeOpFactoryProvider, $siteLookup);
 }
 /**
  * @return ChangeOpFactoryProvider
  */
 protected function newChangeOpFactoryProvider()
 {
     $entityId = new ItemId('Q2');
     $constraintProvider = new EntityConstraintProvider($this->mockProvider->getMockLabelDescriptionDuplicateDetector(), $this->mockProvider->getMockSiteLinkConflictLookup());
     return new ChangeOpFactoryProvider($constraintProvider, $this->mockProvider->getMockGuidGenerator(), $this->mockProvider->getMockGuidValidator(), $this->mockProvider->getMockGuidParser($entityId), $this->mockProvider->getMockSnakValidator(), $this->mockProvider->getMockTermValidatorFactory(), new HashSiteStore(TestSites::getSites()));
 }
 /**
  * @return StatementChangeOpFactory
  */
 protected function newChangeOpFactory()
 {
     $mockProvider = new ChangeOpTestMockProvider($this);
     $entityId = new PropertyId('P7');
     return new StatementChangeOpFactory($mockProvider->getMockGuidGenerator(), $mockProvider->getMockGuidValidator(), $mockProvider->getMockGuidParser($entityId), $mockProvider->getMockSnakValidator(), $mockProvider->getMockSnakValidator());
 }