public function testLazyLoadUserByUrl() { $this->mockSimpleRequest($this->httpClient, 'get', json_encode($this->loadJsonFixture('fixture_user.json'))); $user = new User($this->httpClient); $user->populate(['url' => 'https://api.github.com/users/octocat']); $this->assertEquals(1, $user->getId()); }
/** * @param $login string The login name of the user, e.g. "octocat" * @throws Exception\GithubException In case the user was not found * @return Search */ public function getUser($login) { $user = new User($this->client); $user->populate(['login' => $login]); try { $user->getId(); } catch (GithubException $e) { throw new GithubException(sprintf('User %s was not found.', $login), 0, $e); } return $user; }