/**
  * @param AdapterInterface $adapter
  * @throws \GitHub\Adapter\Exception\AdapterNotFoundException
  */
 public function __construct(AdapterInterface $adapter = null)
 {
     if (!$adapter) {
         $this->setAdapter(AdapterFactory::factory('guzzle'));
     }
     if (defined('GITHUB_URL')) {
         $this->setBaseUrl(GITHUB_URL);
     }
     if (defined('GITHUB_OAUTH_TOKEN')) {
         $this->authenticate(AdapterInterface::AUTH_OAUTH_TOKEN, GITHUB_OAUTH_TOKEN);
     } elseif (defined('GITHUB_USERNAME') && defined('GITHUB_PASSWORD')) {
         $this->authenticate(AdapterInterface::AUTH_HTTP_PASSWORD, GITHUB_USERNAME, GITHUB_PASSWORD);
     }
 }
 public function testAdapterNotFound()
 {
     $this->setExpectedException('\\GitHub\\Adapter\\Exception\\AdapterNotFoundException');
     AdapterFactory::factory('foo');
 }