Ejemplo n.º 1
0
 /**
  * @test
  */
 public function authorization_url()
 {
     // Arrange
     $service = new OAuth2Service();
     $options = ['foo' => 'bar'];
     $credentials = ['client_id' => 'cl13nt1d', 'client_secret' => 'cl13nts3cr3t'];
     $scopes = ['email', 'read', 'write'];
     $expectedQuery = ['foo' => 'bar', 'client_id' => 'cl13nt1d', 'redirect_uri' => '', 'response_type' => 'code', 'type' => 'web_server', 'scope' => join(' ', $scopes)];
     $service->setCredentials($credentials);
     $service->setScopes($scopes);
     // Act
     $authorizationUrl = $service->authorizationUrl($options);
     // Assert
     list($endpoint, $queryString) = explode('?', $authorizationUrl);
     parse_str($queryString, $query);
     $this->assertEquals('', $endpoint);
     $this->assertEquals($expectedQuery, $query);
 }