mk() public method

make a new key with a given value
public mk ( string $key, string $value, integer $ttl ) : array
$key string
$value string
$ttl integer
return array $body
Beispiel #1
0
 public function execute(InputInterface $input, OutputInterface $output)
 {
     $server = $input->getArgument('server');
     $key = $input->getArgument('key');
     $value = $input->getArgument('value');
     $output->writeln("<info>Create `{$key}` with `{$value}`</info>");
     $client = new EtcdClient($server);
     $data = $client->mk($key, $value);
     $json = json_encode($data, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES);
     echo $json;
 }
Beispiel #2
0
 /**
  * @covers LinkORB\Component\Etcd\Client::mk
  * @expectedException \LinkORB\Component\Etcd\Exception\KeyExistsException
  */
 public function testMk()
 {
     $this->client->mk('testmk', 'mkvalue');
     $this->assertEquals('mkvalue', $this->client->get('testmk'));
     $this->client->mk('testmk', 'mkvalue');
 }