/**
  * Register bindings in the container.
  *
  * @return void
  */
 public function register()
 {
     $this->app->singleton(Basecamp::class, function ($app) {
         Config::set(['applicationName' => getenv('BASECAMP_APPLICATION_NAME'), 'applicationContact' => getenv('BASECAMP_APPLICATION_CONTACT'), 'authenticationType' => getenv('BASECAMP_AUTHENTICATION_TYPE'), 'clientId' => getenv('BASECAMP_CLIENT_ID'), 'clientSecret' => getenv('BASECAMP_CLIENT_SECRET'), 'redirectUri' => getenv('BASECAMP_REDIRECT_URI'), 'username' => getenv('BASECAMP_USERNAME'), 'password' => getenv('BASECAMP_PASSWORD'), 'accountId' => getenv('BASECAMP_ACCOUNT_ID')]);
         return new Basecamp();
     });
 }
示例#2
0
 public function testCanGetUserAccountId()
 {
     $user = User::getInstance();
     \Zawntech\BasecampAPI\Config::set(['authenticationType' => 'OAuth']);
     // var_dump($user->getAccountId());
     \Zawntech\BasecampAPI\Config::set(['authenticationType' => 'BasicHttp']);
     // var_dump($user->getAccountId());
 }
示例#3
0
 public function testCanSetConfigurationOptions()
 {
     $originalConfig = Config::toArray();
     // Set values by passing an array.
     Config::set(['applicationName' => 'a', 'applicationContact' => 'b', 'clientId' => 'c', 'clientSecret' => 'd', 'redirectUri' => 'e', 'username' => 'f', 'password' => 'g']);
     $this->assertEquals('a', $this->config->applicationName);
     $this->assertEquals('b', $this->config->applicationContact);
     $this->assertEquals('c', $this->config->clientId);
     $this->assertEquals('d', $this->config->clientSecret);
     $this->assertEquals('e', $this->config->redirectUri);
     $this->assertEquals('f', $this->config->username);
     $this->assertEquals('g', $this->config->password);
     // Restore config.
     Config::set($originalConfig);
 }
示例#4
0
<?php

/**
 * Basecamp API PHPUnit Tests Bootstrapper
 */
// Load composer autoloader.
require_once __DIR__ . '/../vendor/autoload.php';
// Load the local configuration file.
$config = (include __DIR__ . '/config.php');
// Set the configuration.
\Zawntech\BasecampAPI\Config::set($config);
// Load oauth token from file.
$json = file_get_contents(__DIR__ . '/basecamp-oauth-redirect/data.json');
$json = json_decode($json);
\Zawntech\BasecampAPI\Auth\Authorizer::injectOAuthToken($json);
require_once __DIR__ . '/TestCase.php';