| @@ 26-35 (lines=10) @@ | ||
| 23 | ]); |
|
| 24 | } |
|
| 25 | ||
| 26 | public function testValidRequestGetsToken() |
|
| 27 | { |
|
| 28 | $grantType = new JwtBearer($this->getClient(), [ |
|
| 29 | 'client_id' => 'testClient', |
|
| 30 | 'private_key' => new SplFileObject(__DIR__ . '/../private.key') |
|
| 31 | ]); |
|
| 32 | $token = $grantType->getToken(); |
|
| 33 | $this->assertNotEmpty($token->getToken()); |
|
| 34 | $this->assertTrue($token->getExpires()->getTimestamp() > time()); |
|
| 35 | } |
|
| 36 | } |
|
| 37 | ||
| @@ 16-26 (lines=11) @@ | ||
| 13 | new PasswordCredentials($this->getClient()); |
|
| 14 | } |
|
| 15 | ||
| 16 | public function testValidPasswordGetsToken() |
|
| 17 | { |
|
| 18 | $grantType = new PasswordCredentials($this->getClient(), [ |
|
| 19 | 'client_id' => 'testClient', |
|
| 20 | 'username' => 'validUsername', |
|
| 21 | 'password' => 'validPassword', |
|
| 22 | ]); |
|
| 23 | $token = $grantType->getToken(); |
|
| 24 | $this->assertNotEmpty($token->getToken()); |
|
| 25 | $this->assertTrue($token->getExpires()->getTimestamp() > time()); |
|
| 26 | } |
|
| 27 | } |
|
| 28 | ||