Ejemplo n.º 1
0
 /**
  * @return boolean
  */
 public function add($element)
 {
     if ($this->contains($element)) {
         return false;
     }
     return parent::add($element);
 }
Ejemplo n.º 2
0
 public function testAddAllAddsUnique()
 {
     $setA = new BasicSet(new SimpleComparator());
     $setA->add('foo');
     $collectionB = new BasicCollection();
     $collectionB->add('foo');
     self::assertFalse($setA->addAll($collectionB));
 }
Ejemplo n.º 3
0
 public function testConvertToArray()
 {
     $collection = new BasicCollection();
     $collection->add('foo');
     $collection->add('bar');
     $collection->add('baz');
     $collection->remove('bar');
     // this call should not create a gap in the index sequence
     $actual = $collection->toArray();
     $expected = [0 => 'foo', 1 => 'baz'];
     self::assertEquals($expected, $actual);
 }