Skip to content

Commit 287e36a

Browse files
committed
Fix method introduced in #471
1 parent 110014c commit 287e36a

2 files changed

Lines changed: 6 additions & 17 deletions

File tree

src/Statement/StatementList.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,8 @@ public function removeStatementsWithGuid( $guid ) {
115115
unset( $this->statements[$index] );
116116
}
117117
}
118+
119+
$this->statements = array_values( $this->statements );
118120
}
119121

120122
/**

tests/unit/Statement/StatementListTest.php

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -268,11 +268,7 @@ public function testGivenGuidOfPresentStatement_statementIsRemoved() {
268268
$list = new StatementList( array( $statement1, $statement2, $statement3 ) );
269269
$list->removeStatementsWithGuid( 'foo' );
270270

271-
$statements = array();
272-
$statements[1] = $statement2;
273-
$statements[2] = $statement3;
274-
275-
$this->assertEquals( $statements, $list->toArray() );
271+
$this->assertEquals( new StatementList( $statement2, $statement3 ), $list );
276272
}
277273

278274
public function testGivenGuidOfMultipleStatements_multipleStatementsAreRemoved() {
@@ -283,10 +279,7 @@ public function testGivenGuidOfMultipleStatements_multipleStatementsAreRemoved()
283279
$list = new StatementList( array( $statement1, $statement2, $statement3 ) );
284280
$list->removeStatementsWithGuid( 'bar' );
285281

286-
$this->assertEquals(
287-
new StatementList( array( $statement1 ) ),
288-
$list
289-
);
282+
$this->assertEquals( new StatementList( $statement1 ), $list );
290283
}
291284

292285
public function testGivenNotPresentGuid_listIsNotModified() {
@@ -297,10 +290,7 @@ public function testGivenNotPresentGuid_listIsNotModified() {
297290
$list = new StatementList( array( $statement1, $statement2, $statement3 ) );
298291
$list->removeStatementsWithGuid( 'baz' );
299292

300-
$this->assertEquals(
301-
new StatementList( array( $statement1, $statement2, $statement3 ) ),
302-
$list
303-
);
293+
$this->assertEquals( new StatementList( $statement1, $statement2, $statement3 ), $list );
304294
}
305295

306296
public function testGivenNullGuid_allStatementsWithNoGuidAreRemoved() {
@@ -311,10 +301,7 @@ public function testGivenNullGuid_allStatementsWithNoGuidAreRemoved() {
311301
$list = new StatementList( array( $statement1, $statement2, $statement3 ) );
312302
$list->removeStatementsWithGuid( null );
313303

314-
$this->assertEquals(
315-
new StatementList( array( $statement1 ) ),
316-
$list
317-
);
304+
$this->assertEquals( new StatementList( $statement1 ), $list );
318305
}
319306

320307
public function testCanConstructWithClaimsObjectContainingOnlyStatements() {

0 commit comments

Comments
 (0)