@@ -260,6 +260,50 @@ public function testAddStatementWithGuid() {
260260 $ this ->assertEquals ( new StatementList ( $ statement ), $ list );
261261 }
262262
263+ public function testRemoveStatementsWithGuid_singleStatementRemoved () {
264+ $ statement1 = new Statement ( $ this ->newSnak ( 24 , 'foo ' ), null , null , 'foo ' );
265+ $ statement2 = new Statement ( $ this ->newSnak ( 32 , 'bar ' ), null , null , 'bar ' );
266+ $ statement3 = new Statement ( $ this ->newSnak ( 32 , 'bar ' ), null , null , 'bar ' );
267+
268+ $ list = new StatementList ( array ( $ statement1 , $ statement2 , $ statement3 ) );
269+ $ list ->removeStatementsWithGuid ( 'foo ' );
270+
271+ $ statements = array ();
272+ $ statements [1 ] = $ statement2 ;
273+ $ statements [2 ] = $ statement3 ;
274+
275+ $ this ->assertEquals ( $ statements , $ list ->toArray () );
276+ }
277+
278+ public function testRemoveStatementsWithGuid_multipleStatementsRemoved () {
279+ $ statement1 = new Statement ( $ this ->newSnak ( 24 , 'foo ' ), null , null , 'foo ' );
280+ $ statement2 = new Statement ( $ this ->newSnak ( 32 , 'bar ' ), null , null , 'bar ' );
281+ $ statement3 = new Statement ( $ this ->newSnak ( 32 , 'bar ' ), null , null , 'bar ' );
282+
283+ $ list = new StatementList ( array ( $ statement1 , $ statement2 , $ statement3 ) );
284+ $ list ->removeStatementsWithGuid ( 'bar ' );
285+
286+ $ this ->assertEquals (
287+ new StatementList ( array ( $ statement1 ) ),
288+ $ list
289+ );
290+ }
291+
292+ public function testRemoveStatementsWithGuid_nowStatementRemoved () {
293+ $ statement1 = new Statement ( $ this ->newSnak ( 24 , 'foo ' ), null , null , 'foo ' );
294+ $ statement2 = new Statement ( $ this ->newSnak ( 32 , 'bar ' ), null , null , 'bar ' );
295+ $ statement3 = new Statement ( $ this ->newSnak ( 32 , 'bar ' ), null , null , 'bar ' );
296+
297+ $ list = new StatementList ( array ( $ statement1 , $ statement2 , $ statement3 ) );
298+ $ list ->removeStatementsWithGuid ( 'baz ' );
299+
300+ $ this ->assertEquals (
301+ new StatementList ( array ( $ statement1 , $ statement2 , $ statement3 ) ),
302+ $ list
303+ );
304+ }
305+
306+
263307 public function testCanConstructWithClaimsObjectContainingOnlyStatements () {
264308 $ statementArray = array (
265309 $ this ->getStatementWithSnak ( 1 , 'foo ' ),
0 commit comments