Skip to content

Commit fc06314

Browse files
committed
Replace Claim alias usages
1 parent b440d13 commit fc06314

2 files changed

Lines changed: 134 additions & 155 deletions

File tree

tests/unit/ByPropertyIdArrayTest.php

Lines changed: 17 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
use ReflectionClass;
77
use ReflectionMethod;
88
use Wikibase\DataModel\ByPropertyIdArray;
9-
use Wikibase\DataModel\Claim\Claim;
109
use Wikibase\DataModel\Claim\Claims;
1110
use Wikibase\DataModel\Entity\PropertyId;
1211
use Wikibase\DataModel\Snak\PropertyNoValueSnak;
@@ -29,18 +28,18 @@
2928
class ByPropertyIdArrayTest extends \PHPUnit_Framework_TestCase {
3029

3130
public function testArrayObjectNotConstructedFromObject() {
32-
$claim1 = new Claim( new PropertyNoValueSnak( 1 ) );
33-
$claim1->setGuid( '1' );
34-
$claim2 = new Claim( new PropertyNoValueSnak( 2 ) );
35-
$claim2->setGuid( '2' );
31+
$statement1 = new Statement( new PropertyNoValueSnak( 1 ) );
32+
$statement1->setGuid( '1' );
33+
$statement2 = new Statement( new PropertyNoValueSnak( 2 ) );
34+
$statement2->setGuid( '2' );
3635

3736
$claims = new Claims();
38-
$claims->append( $claim1 );
37+
$claims->append( $statement1 );
3938

4039
$byPropertyIdArray = new ByPropertyIdArray( $claims );
4140
// According to the documentation append() "cannot be called when the ArrayObject was
4241
// constructed from an object." This test makes sure it was not constructed from an object.
43-
$byPropertyIdArray->append( $claim2 );
42+
$byPropertyIdArray->append( $statement2 );
4443

4544
$this->assertCount( 2, $byPropertyIdArray );
4645
}
@@ -71,13 +70,6 @@ public function listProvider() {
7170

7271
$lists[] = $snaks;
7372

74-
$lists[] = array_map(
75-
function( Snak $snak ) {
76-
return new Claim( $snak );
77-
},
78-
$snaks
79-
);
80-
8173
$lists[] = array_map(
8274
function( Snak $snak ) {
8375
return new Statement( $snak );
@@ -95,9 +87,9 @@ function( Snak $snak ) {
9587
}
9688

9789
/**
98-
* @return Claim[]
90+
* @return Statement[]
9991
*/
100-
protected function claimsProvider() {
92+
protected function statementsProvider() {
10193
$snaks = array(
10294
new PropertyNoValueSnak( new PropertyId( 'P1' ) ),
10395
new PropertySomeValueSnak( new PropertyId( 'P1' ) ),
@@ -109,7 +101,7 @@ protected function claimsProvider() {
109101

110102
return array_map(
111103
function( Snak $snak ) {
112-
return new Claim( $snak );
104+
return new Statement( $snak );
113105
},
114106
$snaks
115107
);
@@ -247,7 +239,7 @@ public function testToFlatArray( array $objects ) {
247239
}
248240

249241
public function moveProvider() {
250-
$c = $this->claimsProvider();
242+
$c = $this->statementsProvider();
251243
$argLists = array();
252244

253245
$argLists[] = array( $c, $c[0], 0, $c );
@@ -330,27 +322,27 @@ public function testMoveObjectToIndex(
330322
}
331323

332324
public function testMoveThrowingOutOfBoundsExceptionIfObjectNotPresent() {
333-
$claims = $this->claimsProvider();
334-
$indexedArray = new ByPropertyIdArray( $claims );
325+
$statements = $this->statementsProvider();
326+
$indexedArray = new ByPropertyIdArray( $statements );
335327
$indexedArray->buildIndex();
336328

337329
$this->setExpectedException( 'OutOfBoundsException' );
338330

339-
$indexedArray->moveObjectToIndex( new Claim( new PropertyNoValueSnak( new PropertyId( 'P9999' ) ) ), 0 );
331+
$indexedArray->moveObjectToIndex( new Statement( new PropertyNoValueSnak( new PropertyId( 'P9999' ) ) ), 0 );
340332
}
341333

342334
public function testMoveThrowingOutOfBoundsExceptionOnInvalidIndex() {
343-
$claims = $this->claimsProvider();
344-
$indexedArray = new ByPropertyIdArray( $claims );
335+
$statements = $this->statementsProvider();
336+
$indexedArray = new ByPropertyIdArray( $statements );
345337
$indexedArray->buildIndex();
346338

347339
$this->setExpectedException( 'OutOfBoundsException' );
348340

349-
$indexedArray->moveObjectToIndex( $claims[0], 9999 );
341+
$indexedArray->moveObjectToIndex( $statements[0], 9999 );
350342
}
351343

352344
public function addProvider() {
353-
$c = $this->claimsProvider();
345+
$c = $this->statementsProvider();
354346

355347
$argLists = array();
356348

0 commit comments

Comments
 (0)