Skip to content

Commit a1b5177

Browse files
committed
Merge pull request #438 from wmde/hasClaim
Drop Claims::hasClaim
2 parents cc6027e + 9412305 commit a1b5177

3 files changed

Lines changed: 1 addition & 48 deletions

File tree

RELEASE-NOTES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
* Removed `Claims::getGuids`
2222
* Removed `Claims::equals` (and `Claims` no longer implements `Comparable`)
2323
* Removed `Claims::getHash` (and `Claims` no longer implements `Hashable`)
24+
* Removed `Claims::hasClaim`
2425
* Removed `Claims::isEmpty` (you can use `StatementList::isEmpty` instead)
2526
* Removed `Claims::indexOf` (you can use `StatementList::getIndexByGuid` instead)
2627
* Removed `Claims::removeClaim`

src/Claim/Claims.php

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -92,25 +92,6 @@ public function addClaim( Claim $claim ) {
9292
$this[] = $claim;
9393
}
9494

95-
/**
96-
* @since 0.1
97-
* @deprecated since 1.0, should not be needed any more.
98-
*
99-
* @param Claim $claim
100-
*
101-
* @return bool
102-
*/
103-
public function hasClaim( Claim $claim ) {
104-
$guid = $claim->getGuid();
105-
106-
if ( $guid === null ) {
107-
return false;
108-
}
109-
110-
$key = $this->getGuidKey( $guid );
111-
return $this->offsetExists( $key );
112-
}
113-
11495
/**
11596
* @since 0.3
11697
* @deprecated since 1.0, use StatementList::getIndexByGuid() instead.

tests/unit/Claim/ClaimsTest.php

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -85,27 +85,6 @@ public function constructorErrorProvider() {
8585
);
8686
}
8787

88-
public function testHasClaim() {
89-
$claims = new Claims();
90-
$claim1 = $this->makeClaim( new PropertyNoValueSnak( new PropertyId( 'P15' ) ) );
91-
$claim2 = $this->makeClaim( new PropertyNoValueSnak( new PropertyId( 'P16' ) ) );
92-
93-
$this->assertFalse( $claims->hasClaim( $claim1 ) );
94-
$this->assertFalse( $claims->hasClaim( $claim2 ) );
95-
96-
$claims->addClaim( $claim1 );
97-
$this->assertTrue( $claims->hasClaim( $claim1 ) );
98-
$this->assertFalse( $claims->hasClaim( $claim2 ) );
99-
100-
$claims->addClaim( $claim2 );
101-
$this->assertTrue( $claims->hasClaim( $claim1 ) );
102-
$this->assertTrue( $claims->hasClaim( $claim2 ) );
103-
104-
// no guid
105-
$claim0 = new Claim( new PropertyNoValueSnak( new PropertyId( 'P15' ) ) );
106-
$this->assertFalse( $claims->hasClaim( $claim0 ) );
107-
}
108-
10988
public function testHasClaimWithGuid() {
11089
$claims = new Claims();
11190
$claim1 = $this->makeClaim( new PropertyNoValueSnak( new PropertyId( 'P15' ) ) );
@@ -133,13 +112,9 @@ public function testRemoveClaimWithGuid() {
133112
$this->assertSame( 2, $claims->count() );
134113

135114
$claims->removeClaimWithGuid( $claim1->getGuid() );
136-
$this->assertFalse( $claims->hasClaim( $claim1 ) );
137-
$this->assertNull( $claims->getClaimWithGuid( $claim1->getGuid() ) );
138115
$this->assertSame( 1, $claims->count() );
139116

140117
$claims->removeClaimWithGuid( $claim2->getGuid() );
141-
$this->assertFalse( $claims->hasClaim( $claim2 ) );
142-
$this->assertNull( $claims->getClaimWithGuid( $claim2->getGuid() ) );
143118
$this->assertSame( 0, $claims->count() );
144119
}
145120

@@ -153,13 +128,9 @@ public function testOffsetUnset() {
153128
$this->assertSame( 2, $claims->count() );
154129

155130
$claims->offsetUnset( $claim1->getGuid() );
156-
$this->assertFalse( $claims->hasClaim( $claim1 ) );
157-
$this->assertNull( $claims->getClaimWithGuid( $claim1->getGuid() ) );
158131
$this->assertSame( 1, $claims->count() );
159132

160133
$claims->offsetUnset( $claim2->getGuid() );
161-
$this->assertFalse( $claims->hasClaim( $claim2 ) );
162-
$this->assertNull( $claims->getClaimWithGuid( $claim2->getGuid() ) );
163134
$this->assertSame( 0, $claims->count() );
164135
}
165136

0 commit comments

Comments
 (0)