/**
  * @covers       CollectionType\Map\MapAbstract::remove
  * @covers       CollectionType\Map\MapAbstract::validateValueForKeyType
  * @covers       CollectionType\Map\MapAbstract::containsKey
  * @covers       CollectionType\Map\MapAbstract::isSynchronizedIndex
  * @covers       CollectionType\Map\MapAbstract::__construct
  */
 public function testRemoveForReturnValues()
 {
     $key1 = new \stdClass();
     $key1->param = 'key1';
     $this->dummyKeyType->isValid($key1)->willReturn(true);
     $value1 = new \stdClass();
     $value1->param = 'value1';
     $this->dummyValueType->isValid($value1)->willReturn(true);
     $this->map->put($key1, $value1);
     $key2 = new \stdClass();
     $key2->param = 'key2';
     $this->dummyKeyType->isValid($key2)->willReturn(true);
     $value2 = new \stdClass();
     $value2->param = 'value2';
     $this->dummyValueType->isValid($value2)->willReturn(true);
     $this->map->put($key2, $value2);
     $key3 = new \stdClass();
     $key3->param = 'key3';
     $this->dummyKeyType->isValid($key3)->willReturn(true);
     $value3 = new \stdClass();
     $value3->param = 'value3';
     $this->dummyValueType->isValid($value3)->willReturn(true);
     $this->map->put($key3, $value3);
     $this->map->remove($key2);
     $result = $this->map->values();
     $this->assertEquals([$value1, $value3], $result);
 }
Exemplo n.º 2
0
 /**
  * @expectedException \CollectionType\Exception\SynchronizeException
  *
  * @covers       CollectionType\Map\MapAbstract::remove
  * @covers       CollectionType\Map\MapAbstract::validateValueForKeyType
  * @covers       CollectionType\Map\MapAbstract::containsKey
  * @covers       CollectionType\Map\MapAbstract::isSynchronizedIndex
  * @covers       CollectionType\Map\MapAbstract::__construct
  */
 public function testRemoveForNotSynchronizedMap()
 {
     $key1 = '1';
     $this->dummyKeyType->isValid($key1)->willReturn(true);
     $value1 = '1';
     $this->dummyValueType->isValid($value1)->willReturn(true);
     $this->map->put($key1, $value1);
     /** fake method, only for UnitTests */
     $this->map->putKey('2');
     $this->map->remove($key1);
 }