Example #1
0
 public function testRemove()
 {
     $set1 = new Set();
     $set2 = new Set([100, 200]);
     $set1->add(200);
     $set1->add(300);
     $set2->retainAll($set1);
     $this->assertEquals($set1->toArray(), [200, 300]);
     $this->assertEquals($set2->toArray(), [200]);
     $this->assertFalse($set1->equals($set2));
     $this->assertFalse($set2->equals($set1));
     $set1->remove(300);
     $this->assertTrue($set1->equals($set2));
     $this->assertTrue($set2->equals($set1));
     $set1->removeAll($set2);
     $this->assertTrue($set1->isEmpty());
     $this->assertFalse($set2->isEmpty());
 }