set() public method

Sets key/value in the map.
public set ( mixed $key, mixed $value )
$key mixed key
$value mixed value
Beispiel #1
0
 public function testSupportsRetrievingKeysAndValues()
 {
     $keys = array(new Varint('1'), new Varint('2'), new Varint('3'), new Varint('4'), new Varint('5'), new Varint('6'), new Varint('7'), new Varint('8'));
     $values = array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h');
     $map = new Map(\Cassandra::TYPE_VARINT, \Cassandra::TYPE_VARCHAR);
     for ($i = 0; $i < count($keys); $i++) {
         $map->set($keys[$i], $values[$i]);
     }
     $this->assertEquals($keys, $map->keys());
     $this->assertEquals($values, $map->values());
 }
Beispiel #2
0
 /**
  * @expectedException         InvalidArgumentException
  * @expectedExceptionMessage  Invalid value: null is not supported inside maps
  */
 public function testSupportsNullValues()
 {
     $map = new Map(\Cassandra::TYPE_VARCHAR, \Cassandra::TYPE_VARCHAR);
     $map->set("test", null);
 }