public function testLazyLoadFollowers() { $expectedResponse = json_encode($this->loadJsonFixture('fixture_followers.json')); $this->mockSimpleRequest($this->httpClient, 'get', $expectedResponse, 'https://api.github.com/users/octocat/followers'); $user = new User($this->httpClient); $user->populate($this->loadJsonFixture('fixture_user.json')); $this->assertContainsOnlyInstancesOf(User::CLASS_NAME, $user->getFollowers()); }
/** * @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; }