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