|
@@ 18-34 (lines=17) @@
|
| 15 |
|
/** |
| 16 |
|
* testFormAuthStrategy. |
| 17 |
|
*/ |
| 18 |
|
public function testFormAuthStrategy() |
| 19 |
|
{ |
| 20 |
|
$authStrategy = new FormAuthStrategy( |
| 21 |
|
[ |
| 22 |
|
'username' => 'admin', |
| 23 |
|
'password' => 'admin', |
| 24 |
|
'form_fields' => ['login', 'password'], |
| 25 |
|
] |
| 26 |
|
); |
| 27 |
|
|
| 28 |
|
$this->assertTrue(array_key_exists('login', $authStrategy->getRequestOptions()['form_params'])); |
| 29 |
|
|
| 30 |
|
$this->assertTrue(array_key_exists('password', $authStrategy->getRequestOptions()['form_params'])); |
| 31 |
|
|
| 32 |
|
$this->assertEquals('admin', $authStrategy->getRequestOptions()['form_params']['login']); |
| 33 |
|
$this->assertEquals('admin', $authStrategy->getRequestOptions()['form_params']['password']); |
| 34 |
|
} |
| 35 |
|
|
| 36 |
|
/** |
| 37 |
|
* tesQueryAuthStrategy. |
|
@@ 39-54 (lines=16) @@
|
| 36 |
|
/** |
| 37 |
|
* tesQueryAuthStrategy. |
| 38 |
|
*/ |
| 39 |
|
public function testQueryAuthStrategy() |
| 40 |
|
{ |
| 41 |
|
$authStrategy = new QueryAuthStrategy( |
| 42 |
|
[ |
| 43 |
|
'username' => 'admin', |
| 44 |
|
'password' => 'admin', |
| 45 |
|
'query_fields' => ['username', 'password'], |
| 46 |
|
] |
| 47 |
|
); |
| 48 |
|
|
| 49 |
|
$this->assertTrue(array_key_exists('username', $authStrategy->getRequestOptions()['query'])); |
| 50 |
|
$this->assertTrue(array_key_exists('password', $authStrategy->getRequestOptions()['query'])); |
| 51 |
|
|
| 52 |
|
$this->assertEquals('admin', $authStrategy->getRequestOptions()['query']['username']); |
| 53 |
|
$this->assertEquals('admin', $authStrategy->getRequestOptions()['query']['password']); |
| 54 |
|
} |
| 55 |
|
|
| 56 |
|
/** |
| 57 |
|
* testHttpBasicAuthStrategy. |
|
@@ 75-91 (lines=17) @@
|
| 72 |
|
/** |
| 73 |
|
* testJsonAuthStrategy. |
| 74 |
|
*/ |
| 75 |
|
public function testJsonAuthStrategy() |
| 76 |
|
{ |
| 77 |
|
$authStrategy = new JsonAuthStrategy( |
| 78 |
|
[ |
| 79 |
|
'username' => 'admin', |
| 80 |
|
'password' => 'admin', |
| 81 |
|
'form_fields' => ['login', 'password'], |
| 82 |
|
] |
| 83 |
|
); |
| 84 |
|
|
| 85 |
|
$this->assertTrue(array_key_exists('login', $authStrategy->getRequestOptions()['json'])); |
| 86 |
|
|
| 87 |
|
$this->assertTrue(array_key_exists('password', $authStrategy->getRequestOptions()['json'])); |
| 88 |
|
|
| 89 |
|
$this->assertEquals('admin', $authStrategy->getRequestOptions()['json']['login']); |
| 90 |
|
$this->assertEquals('admin', $authStrategy->getRequestOptions()['json']['password']); |
| 91 |
|
} |
| 92 |
|
} |
| 93 |
|
|