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()); }
public function removeKey(Key $key) { $url = TemplateUrlGenerator::generate($this->getAttribute('keys_url'), ['key_id' => $key->getId()]); $this->delete($url); }
public function testAddKey() { $this->mockSimpleRequest($this->httpClient, 'post', json_encode($this->loadJsonFixture('fixture_key.json'))); $repository = new Repository($this->httpClient); $repository->populate($this->loadJsonFixture('fixture_repository.json')); $key = new Key(); $key->setTitle('hello word'); $key->setKey('123'); $this->assertNull($key->getId()); $repository->addKey($key); $this->assertEquals(1, $key->getId()); }