示例#1
0
文件: Set.php 项目: actank/phan
 /**
  * @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);
 }