public function testPopulateWithSampleData() { $key = new Key(); $key->populate($this->loadJsonFixture('fixture_key.json')); $this->assertEquals(1, $key->getId()); $this->assertEquals('ssh-rsa AAA...', $key->getKey()); $this->assertEquals('octocat@octomac', $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()); }