Beispiel #1
0
 /**
  * @covers       CollectionType\Collection\CollectionList\ListAbstract::add
  * @covers       CollectionType\Collection\CollectionList\ListAbstract::__construct
  */
 public function testAddTheSameValues()
 {
     $value1 = '1';
     $this->dummyType->isValid($value1)->willReturn(true);
     $value2 = '2';
     $this->dummyType->isValid($value2)->willReturn(true);
     $this->list->add($value1);
     $this->list->add($value2);
     $this->list->add($value1);
     $this->list->add($value1);
     $result = $this->list->getAll();
     $this->assertEquals([$value1, $value2, $value1, $value1], $result);
 }
 /**
  * @covers       CollectionType\Collection\CollectionList\ListAbstract::addAll
  */
 public function testAddAllForDifferentValues()
 {
     $addedCollection = clone $this->list;
     $valueA = 'A';
     $valueB = 'B';
     $valueC = 'C';
     $valueD = 'D';
     $valueE = 'E';
     $this->dummyType->isValid($valueA)->willReturn(true);
     $this->list->add($valueA);
     $this->dummyType->isValid($valueB)->willReturn(true);
     $this->list->add($valueB);
     $this->dummyType->isValid($valueC)->willReturn(true);
     $this->list->add($valueC);
     $this->dummyType->isValid($valueD)->willReturn(true);
     $addedCollection->add($valueD);
     $this->dummyType->isValid($valueE)->willReturn(true);
     $addedCollection->add($valueE);
     $this->list->addAll($addedCollection);
     $this->assertEquals(['A', 'B', 'C', 'D', 'E'], $this->list->getAll());
 }