/**
  * @dataProvider buildUpdateClaimSummaryProvider
  */
 public function testBuildUpdateClaimSummary(Statement $originalStatement, Statement $modifiedStatement, $action)
 {
     $claimSummaryBuilder = new ClaimSummaryBuilder('wbsetclaim', new ClaimDiffer(new OrderedListDiffer(new ComparableComparer())));
     $summary = $claimSummaryBuilder->buildClaimSummary($originalStatement, $modifiedStatement);
     $this->assertInstanceOf('Wikibase\\Summary', $summary, "this should return a Summary object");
     $this->assertEquals('wbsetclaim', $summary->getModuleName());
     $this->assertEquals($action, $summary->getActionName());
 }
Exemple #2
0
 /**
  * @param array $params
  * @param Statement $statement
  * @param Entity $entity
  *
  * @throws InvalidArgumentException
  * @return Summary
  *
  * @todo this summary builder is ugly and summary stuff needs to be refactored
  */
 private function getSummary(array $params, Statement $statement, Entity $entity)
 {
     if (!$entity instanceof StatementListProvider) {
         throw new InvalidArgumentException('$entity must be a StatementListProvider');
     }
     $claimSummaryBuilder = new ClaimSummaryBuilder($this->getModuleName(), new ClaimDiffer(new OrderedListDiffer(new ComparableComparer())));
     $summary = $claimSummaryBuilder->buildClaimSummary($entity->getStatements()->getFirstStatementWithGuid($statement->getGuid()), $statement);
     if (isset($params['summary'])) {
         $summary->setUserSummary($params['summary']);
     }
     return $summary;
 }