| Total Complexity | 3 |
| Total Lines | 44 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 10 | class SessionTest extends TestCase |
||
| 11 | { |
||
| 12 | /** |
||
| 13 | * @var Session |
||
| 14 | */ |
||
| 15 | private $session; |
||
| 16 | |||
| 17 | protected function setUp() |
||
| 18 | { |
||
| 19 | parent::setUp(); |
||
| 20 | $config = new Config( |
||
| 21 | getenv('CLIENT_ID'), |
||
| 22 | getenv('CLIENT_SECRET'), |
||
| 23 | getenv('REDIRECT_URI') |
||
| 24 | ); |
||
| 25 | $this->session = new Session( |
||
| 26 | $config |
||
| 27 | ); |
||
| 28 | } |
||
| 29 | |||
| 30 | |||
| 31 | public function testGetAuthorizeUrl() |
||
| 32 | { |
||
| 33 | $redirectUrl = $this->session->getAuthorizeUrl(); |
||
| 34 | |||
| 35 | $this->assertNotEmpty($redirectUrl, 'authorize url from spotify is empty'); |
||
| 36 | $parseRedirectUrl = parse_url($redirectUrl); |
||
| 37 | $this->assertSame('accounts.spotify.com', $parseRedirectUrl['host']); |
||
| 38 | $this->assertSame('/authorize', $parseRedirectUrl['path']); |
||
| 39 | |||
| 40 | $this->assertNotEmpty($parseRedirectUrl['query']); |
||
| 41 | |||
| 42 | $info = []; |
||
| 43 | parse_str($parseRedirectUrl['query'], $info); |
||
| 44 | |||
| 45 | $this->assertSame('code', $info['response_type']); |
||
| 46 | $this->assertSame('http://localhost/', $info['redirect_uri']); |
||
| 47 | $this->assertTrue(isset($info['client_id'])); |
||
| 48 | } |
||
| 49 | |||
| 50 | public function testRefreshAccessToken() |
||
| 54 | } |
||
| 55 | |||
| 56 | } |
||
| 57 |