public function addKey(Key $key) { $url = TemplateUrlGenerator::generate($this->getAttribute('keys_url'), ['key_id' => null]); $response = $this->post($url, ['title' => $key->getTitle(), 'key' => $key->getKey()]); $key->populate($response); // repopulate for getting the id }
public function testSetter() { $key = new Key(); $key->populate($this->loadJsonFixture('fixture_key.json')); $key->setKey('hello world'); $key->setTitle('my first key'); $this->assertEquals('hello world', $key->getKey()); $this->assertEquals('my first key', $key->getTitle()); }