public function testGetApiToken() { $expected = 'test_token'; $this->configManager->expects($this->once())->method('get')->with(ConfigurationProvider::TOKEN_FIELD)->will($this->returnValue($expected)); $actual = $this->provider->getApiToken(); $this->assertEquals($expected, $actual); }
/** * @return Client * @throws InvalidConfigurationException */ protected function getClient() { if (!$this->client) { $this->client = $this->gitHubClientFactory->createClient(); $token = $this->configProvider->getApiToken(); if (empty($token)) { throw new InvalidConfigurationException('GitHub API token isn\'t set.'); } $this->client->authenticate($token, null, Client::AUTH_URL_TOKEN); } return $this->client; }