public function testRequestCredentialsToken() { $expected = array('grant_type' => 'client_credentials', 'scope' => 'user-read-email'); $headers = array('Authorization' => 'Basic Yjc3NzI5MmFmMGRlZjIyZjkyNTc5OTFmYzc3MGI1MjA6NmEwNDE5ZjQzZDBhYTkzYjJhZTg4MTQyOWI2YjliYzI='); $return = array('body' => get_fixture('access-token')); $stub = $this->setupStub('POST', '/api/token', $expected, $headers, $return); $session = new SpotifyWebAPI\Session($this->clientID, $this->clientSecret, $this->redirectURI, $stub); $result = $session->requestCredentialsToken(array('user-read-email')); $this->assertTrue($result); $this->assertNotEmpty($session->getAccessToken()); $this->assertEquals(time() + 3600, $session->getTokenExpiration()); }