コード例 #1
0
 /**
  * @covers       CollectionType\Collection\CollectionAbstract::remove
  * @covers       CollectionType\Collection\CollectionAbstract::contains
  * @covers       CollectionType\Common\ValueTypeTrait::validateValueForValueType
  */
 public function testRemoveForCheckingValuesAfterRemove()
 {
     $this->collection->add('A');
     $this->collection->add('B');
     $this->collection->add('C');
     $value = 'B';
     $this->dummyType->isValid($value)->willReturn(true);
     $this->collection->remove($value);
     $result = $this->collection->getAll();
     $this->assertEquals(['A', 'C'], $result);
 }
コード例 #2
0
 /**
  * @covers       CollectionType\Collection\CollectionAbstract::remove
  * @covers       CollectionType\Collection\CollectionAbstract::contains
  */
 public function testRemoveForCheckingValuesAfterRemove()
 {
     $a = new \stdClass();
     $a->param = 'A';
     $b = new \stdClass();
     $b->param = 'B';
     $c = new \stdClass();
     $c->param = 'C';
     $this->collection->add($a);
     $this->collection->add($b);
     $this->collection->add($c);
     $this->dummyType->isValid($b)->willReturn(true);
     $this->collection->remove($b);
     $result = $this->collection->getAll();
     $this->assertEquals([$a, $c], $result);
 }