Skip to content

Commit 89a45f2

Browse files
committed
Removed Claims::getBestClaims
1 parent aab569b commit 89a45f2

3 files changed

Lines changed: 1 addition & 72 deletions

File tree

RELEASE-NOTES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
* `Statement::setClaim` and `Statement::getClaim` have been removed
1010
* Removed `ClaimList`
1111
* Removed `ClaimListAccess`
12+
* Removed `Claims::getBestClaims` (you can use `StatementList::getBestStatements` instead)
1213

1314
## Version 2.6.0 (2015-03-08)
1415

src/Claim/Claims.php

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -421,30 +421,6 @@ public function getByRanks( array $ranks ) {
421421
return $claims;
422422
}
423423

424-
/**
425-
* Returns a new instance only containing the best claims (these are the highest
426-
* ranked claims, but never deprecated ones). This implementation ignores the properties
427-
* so you probably want to call Claims::getClaimsForProperty first or use
428-
* StatementList::getBestStatementPerProperty instead.
429-
*
430-
* @see Claims::getClaimsForProperty
431-
* @see StatementList::getBestStatementPerProperty
432-
*
433-
* @since 0.7
434-
*
435-
* @return Claims
436-
*/
437-
public function getBestClaims() {
438-
$rank = Statement::RANK_PREFERRED;
439-
440-
do {
441-
$claims = $this->getByRank( $rank );
442-
$rank--;
443-
} while ( $claims->isEmpty() && $rank > Statement::RANK_DEPRECATED );
444-
445-
return $claims;
446-
}
447-
448424
/**
449425
* @see Comparable::equals
450426
*

tests/unit/Claim/ClaimsTest.php

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -621,54 +621,6 @@ public function testGetByRanks( Claims $input, $ranks, $expected ) {
621621
$this->assertEquals( $input->getByRanks( $ranks ), $expected );
622622
}
623623

624-
public function testGetBestClaimsEmpty() {
625-
$claims = new Claims();
626-
$this->assertEquals( $claims->getBestClaims(), new Claims() );
627-
}
628-
629-
public function testGetBestClaimsOnlyOne() {
630-
$statement = $this->makeStatement( new PropertyNoValueSnak( new PropertyId( 'P1' ) ) );
631-
$statement->setRank( Statement::RANK_NORMAL );
632-
633-
$claims = new Claims( array( $statement ) );
634-
$this->assertEquals( $claims->getBestClaims(), $claims );
635-
}
636-
637-
public function testGetBestClaimsNoDeprecated() {
638-
$statement = $this->makeStatement( new PropertyNoValueSnak( new PropertyId( 'P1' ) ) );
639-
$statement->setRank( Statement::RANK_DEPRECATED );
640-
641-
$claims = new Claims( array( $statement ) );
642-
$this->assertEquals( $claims->getBestClaims(), new Claims() );
643-
}
644-
645-
public function testGetBestClaimsReturnOne() {
646-
$s1 = $this->makeStatement( new PropertyNoValueSnak( new PropertyId( 'P1' ) ) );
647-
$s1->setRank( Statement::RANK_DEPRECATED );
648-
649-
$s2 = $this->makeStatement( new PropertyNoValueSnak( new PropertyId( 'P2' ) ) );
650-
$s2->setRank( Statement::RANK_NORMAL );
651-
652-
$claims = new Claims( array( $s1, $s2 ) );
653-
$expected = new Claims( array( $s2 ) );
654-
$this->assertEquals( $claims->getBestClaims(), $expected );
655-
}
656-
657-
public function testGetBestClaimsReturnTwo() {
658-
$s1 = $this->makeStatement( new PropertyNoValueSnak( new PropertyId( 'P1' ) ) );
659-
$s1->setRank( Statement::RANK_NORMAL );
660-
661-
$s2 = $this->makeStatement( new PropertyNoValueSnak( new PropertyId( 'P2' ) ) );
662-
$s2->setRank( Statement::RANK_PREFERRED );
663-
664-
$s3 = $this->makeStatement( new PropertyNoValueSnak( new PropertyId( 'P3' ) ) );
665-
$s3->setRank( Statement::RANK_PREFERRED );
666-
667-
$claims = new Claims( array( $s3, $s1, $s2 ) );
668-
$expected = new Claims( array( $s2, $s3 ) );
669-
$this->assertEquals( $claims->getBestClaims(), $expected );
670-
}
671-
672624
public function testEmptyListEqualsEmptyList() {
673625
$list = new Claims( array() );
674626
$this->assertTrue( $list->equals( clone $list ) );

0 commit comments

Comments
 (0)