Example #1
0
 /**
  * @testdox Calling getTokenUsingCredentials with valid credentials should return a token.
  * @group integration
  * @medium
  */
 public function testGetTokenUsingCredentials()
 {
     $username = getenv('soundcloud_username');
     $password = getenv('soundcloud_password');
     if (isset($this->mock)) {
         $this->mock->addResponse(new Response(200, ['Content-type' => 'application/json'], Stream::factory(json_encode(['access_token' => 'dummy-access-token', 'expires_in' => 300, 'scope' => '*', 'refresh_token' => 'dummy-refresh-token']))));
     }
     $result = $this->soundcloud->getTokenUsingCredentials($username, $password);
     $this->assertTrue(array_key_exists('access_token', $result));
     $this->assertTrue(array_key_exists('expires_in', $result));
     $this->assertTrue(array_key_exists('scope', $result));
     $this->assertTrue(array_key_exists('refresh_token', $result));
     return $result['access_token'];
 }