/** * @covers CollectionType\Collection\CollectionAbstract::removeAll */ public function testRemoveAllWhenContainValueAfterRemove() { $value = 'A'; $someCollection = clone $this->collection; $someCollection->add($value); $this->dummyType->isValid($value)->willReturn(true); $this->collection->add('A'); $this->collection->add('B'); $this->collection->add('C'); $this->collection->removeAll($someCollection); $result = $this->collection->getAll(); $this->assertEquals(['B', 'C'], $result); }
/** * @covers CollectionType\Collection\CollectionAbstract::removeAll */ public function testRemoveAllWhenContainValueAfterRemove() { $a = new \stdClass(); $a->param = 'A'; $b = new \stdClass(); $b->param = 'B'; $c = new \stdClass(); $c->param = 'C'; $someCollection = clone $this->collection; $someCollection->add($a); $this->dummyType->isValid($a)->willReturn(true); $this->collection->add($a); $this->collection->add($b); $this->collection->add($c); $this->collection->removeAll($someCollection); $result = $this->collection->getAll(); $this->assertEquals([$b, $c], $result); }