Пример #1
0
 /**
  * @param Set $other
  * A set of items to union with this set
  *
  * @return Set
  * A new set which contains only items in this
  * Set and the given Set.
  *
  * @suppress PhanUnreferencedMethod
  */
 public function union(Set $other) : Set
 {
     $set = new Set();
     $set->addAll($this);
     $set->addAll($other);
     return $set;
 }
Пример #2
0
 public function testAddAll()
 {
     $set1 = new Set(['lol']);
     $set2 = new Set(['foo']);
     $set1->addAll($set2);
     $set2->addAll($set1);
     $this->assertTrue($set1->equals($set2));
 }
Пример #3
0
 public function testAddAllNoDuplicates()
 {
     $this->setExpectedException('\\InvalidArgumentException');
     $this->object->add($this->items['alpha']);
     $set = new TreeSet();
     $set->add($this->items['alpha']);
     $set->add($this->items['bravo']);
     $set->add($this->items['charlie']);
     $this->object->addAll($set);
 }