示例#1
0
 public function setUp()
 {
     parent::setUp();
     $connection = new Unsplash\Connection($this->provider, $this->accessToken);
     Unsplash\HttpClient::$connection = $connection;
     $this->total = ["photo_downloads" => 189, "batch_downloads" => 31];
 }
示例#2
0
 /**
  * @expectedException Crew\Unsplash\Exception
  * @expectedExceptionCode 401
  */
 public function testFindCurrentUserOnUnconnectedUser()
 {
     $connection = new Unsplash\Connection($this->provider);
     Unsplash\HttpClient::$connection = $connection;
     VCR::insertCassette('users.yml');
     $user = Unsplash\User::current();
     VCR::eject();
 }
 protected function generate($year, $month)
 {
     HttpClient::init(['applicationId' => env('IMG_ID'), 'secret' => env('IMG_SECRET')]);
     $date = Carbon::now();
     $date->year = $year;
     $date->month = $month;
     $date->startOfMonth();
     $end = $date->copy()->endOfMonth();
     while ($date->lte($end)) {
         $random = uPhoto::random();
         $link = $random->links['html'];
         $image = $random->urls['thumb'];
         Photo::create(['date' => $date->toDateString(), 'link' => $link, 'image' => $image]);
         $date->addDays(1);
     }
     return redirect('view/' . $year . '/' . $month);
 }
示例#4
0
 public function __construct($id)
 {
     HttpClient::init(['applicationId' => \get_field('ai_unsplash_api_key', 'option'), 'secret' => \get_field('ai_unsplash_api_secret', 'option')]);
     $this->id = $id;
 }
示例#5
0
 public function setUp()
 {
     parent::setUp();
     $connection = new Unsplash\Connection($this->provider, $this->accessToken);
     Unsplash\HttpClient::$connection = $connection;
 }
 public function testConnectionFromHttpClient()
 {
     Unsplash\HttpClient::$connection = $this->connection;
     $token = Unsplash\HttpClient::$connection->generateToken('mock_code');
     $this->assertEquals('Bearer mock_access_token_1', Unsplash\HttpClient::$connection->getAuthorizationToken());
 }
 /**
  * Unsplash constructor (start HttpClient)
  */
 public function __construct()
 {
     HttpClient::init(['applicationId' => $this->applicationId]);
 }
 public function setUp()
 {
     parent::setUp();
     Unsplash\HttpClient::init(['clientId' => 'mock_client_id', 'clientSecret' => 'mock_secret', 'redirectUri' => 'none'], ['access_token' => getenv('ACCESS_TOKEN')]);
 }