コード例 #1
0
ファイル: KeyTest.php プロジェクト: mpscholten/github-api
 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());
 }
コード例 #2
0
ファイル: Repository.php プロジェクト: mpscholten/github-api
 public function removeKey(Key $key)
 {
     $url = TemplateUrlGenerator::generate($this->getAttribute('keys_url'), ['key_id' => $key->getId()]);
     $this->delete($url);
 }
コード例 #3
0
 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());
 }