| @@ 10-29 (lines=20) @@ | ||
| 7 | /** |
|
| 8 | * @author Guillaume Cavavana <[email protected]> |
|
| 9 | */ |
|
| 10 | class FormAuthStrategyTest extends \PHPUnit_Framework_TestCase |
|
| 11 | { |
|
| 12 | /** |
|
| 13 | * testGetToken. |
|
| 14 | */ |
|
| 15 | public function testGetToken() |
|
| 16 | { |
|
| 17 | $authStrategy = new FormAuthStrategy( |
|
| 18 | [ |
|
| 19 | 'username' => 'admin', |
|
| 20 | 'password' => 'admin', |
|
| 21 | 'form_fields' => ['login', 'password'], |
|
| 22 | ] |
|
| 23 | ); |
|
| 24 | ||
| 25 | $this->assertTrue(array_key_exists('login', $authStrategy->getGuzzleRequestOptions()['form_params'])); |
|
| 26 | ||
| 27 | $this->assertTrue(array_key_exists('password', $authStrategy->getGuzzleRequestOptions()['form_params'])); |
|
| 28 | } |
|
| 29 | } |
|
| 30 | ||
| @@ 10-28 (lines=19) @@ | ||
| 7 | /** |
|
| 8 | * @author Guillaume Cavavana <[email protected]> |
|
| 9 | */ |
|
| 10 | class QueryAuthStrategyTest extends \PHPUnit_Framework_TestCase |
|
| 11 | { |
|
| 12 | /** |
|
| 13 | * testGetToken. |
|
| 14 | */ |
|
| 15 | public function testGetToken() |
|
| 16 | { |
|
| 17 | $authStrategy = new QueryAuthStrategy( |
|
| 18 | [ |
|
| 19 | 'username' => 'admin', |
|
| 20 | 'password' => 'admin', |
|
| 21 | 'query_fields' => ['username', 'password'], |
|
| 22 | ] |
|
| 23 | ); |
|
| 24 | ||
| 25 | $this->assertTrue(array_key_exists('username', $authStrategy->getGuzzleRequestOptions()['query'])); |
|
| 26 | $this->assertTrue(array_key_exists('password', $authStrategy->getGuzzleRequestOptions()['query'])); |
|
| 27 | } |
|
| 28 | } |
|
| 29 | ||