| @@ 53-74 (lines=22) @@ | ||
| 50 | * |
|
| 51 | * @return void |
|
| 52 | */ |
|
| 53 | public function testApply($fieldValue) |
|
| 54 | { |
|
| 55 | $cookie = new Cookie( |
|
| 56 | $this->propertyKey, |
|
| 57 | $fieldValue, |
|
| 58 | time() + 3600 * 24 * 7, |
|
| 59 | '/', |
|
| 60 | null, |
|
| 61 | false, |
|
| 62 | false |
|
| 63 | ); |
|
| 64 | $this->client->getCookieJar()->set($cookie); |
|
| 65 | $this->client->request( |
|
| 66 | 'GET', //method |
|
| 67 | '/', //uri |
|
| 68 | array(), //parameters |
|
| 69 | array(), //files |
|
| 70 | array() //server |
|
| 71 | ); |
|
| 72 | ||
| 73 | $this->assertSame($fieldValue, $this->strategy->apply($this->client->getRequest())); |
|
| 74 | } |
|
| 75 | ||
| 76 | /** |
|
| 77 | * @return array<string> |
|
| @@ 105-126 (lines=22) @@ | ||
| 102 | * |
|
| 103 | * @return void |
|
| 104 | */ |
|
| 105 | public function testApplyExtract($username, $fieldValue) |
|
| 106 | { |
|
| 107 | $cookie = new Cookie( |
|
| 108 | $this->propertyKey, |
|
| 109 | $fieldValue, |
|
| 110 | time() + 3600 * 24 * 7, |
|
| 111 | '/', |
|
| 112 | null, |
|
| 113 | false, |
|
| 114 | false |
|
| 115 | ); |
|
| 116 | $this->client->getCookieJar()->set($cookie); |
|
| 117 | $this->client->request( |
|
| 118 | 'GET', //method |
|
| 119 | '/', //uri |
|
| 120 | array(), //parameters |
|
| 121 | array(), //files |
|
| 122 | array() //server |
|
| 123 | ); |
|
| 124 | ||
| 125 | $this->assertSame($username, $this->strategy->apply($this->client->getRequest())); |
|
| 126 | } |
|
| 127 | ||
| 128 | /** |
|
| 129 | * @return array<string> |
|
| @@ 58-81 (lines=24) @@ | ||
| 55 | * |
|
| 56 | * @return void |
|
| 57 | */ |
|
| 58 | public function testApply() |
|
| 59 | { |
|
| 60 | $fieldValue = 'exampleAuthenticationHeader'; |
|
| 61 | ||
| 62 | $cookie = new Cookie( |
|
| 63 | $this->propertyKey, |
|
| 64 | $fieldValue, |
|
| 65 | time() + 3600 * 24 * 7, |
|
| 66 | '/', |
|
| 67 | null, |
|
| 68 | false, |
|
| 69 | false |
|
| 70 | ); |
|
| 71 | $this->client->getCookieJar()->set($cookie); |
|
| 72 | $this->client->request( |
|
| 73 | 'GET', //method |
|
| 74 | '/', //uri |
|
| 75 | array(), //parameters |
|
| 76 | array(), //files |
|
| 77 | array() //server |
|
| 78 | ); |
|
| 79 | ||
| 80 | $this->assertSame($fieldValue, $this->strategy->apply($this->client->getRequest())); |
|
| 81 | } |
|
| 82 | } |
|
| 83 | ||