| @@ 194-211 (lines=18) @@ | ||
| 191 | new Facebook($config); |
|
| 192 | } |
|
| 193 | ||
| 194 | public function testMcryptCsprgCanBeForced() |
|
| 195 | { |
|
| 196 | if (!function_exists('mcrypt_create_iv')) { |
|
| 197 | $this->markTestSkipped( |
|
| 198 | 'Mcrypt must be installed to test mcrypt_create_iv().' |
|
| 199 | ); |
|
| 200 | } |
|
| 201 | ||
| 202 | $config = array_merge($this->config, [ |
|
| 203 | 'persistent_data_handler' => 'memory', // To keep session errors from happening |
|
| 204 | 'pseudo_random_string_generator' => 'mcrypt' |
|
| 205 | ]); |
|
| 206 | $fb = new Facebook($config); |
|
| 207 | $this->assertInstanceOf( |
|
| 208 | 'Facebook\PseudoRandomString\McryptPseudoRandomStringGenerator', |
|
| 209 | $fb->getRedirectLoginHelper()->getPseudoRandomStringGenerator() |
|
| 210 | ); |
|
| 211 | } |
|
| 212 | ||
| 213 | public function testOpenSslCsprgCanBeForced() |
|
| 214 | { |
|
| @@ 213-230 (lines=18) @@ | ||
| 210 | ); |
|
| 211 | } |
|
| 212 | ||
| 213 | public function testOpenSslCsprgCanBeForced() |
|
| 214 | { |
|
| 215 | if (!function_exists('openssl_random_pseudo_bytes')) { |
|
| 216 | $this->markTestSkipped( |
|
| 217 | 'The OpenSSL extension must be enabled to test openssl_random_pseudo_bytes().' |
|
| 218 | ); |
|
| 219 | } |
|
| 220 | ||
| 221 | $config = array_merge($this->config, [ |
|
| 222 | 'persistent_data_handler' => 'memory', // To keep session errors from happening |
|
| 223 | 'pseudo_random_string_generator' => 'openssl' |
|
| 224 | ]); |
|
| 225 | $fb = new Facebook($config); |
|
| 226 | $this->assertInstanceOf( |
|
| 227 | 'Facebook\PseudoRandomString\OpenSslPseudoRandomStringGenerator', |
|
| 228 | $fb->getRedirectLoginHelper()->getPseudoRandomStringGenerator() |
|
| 229 | ); |
|
| 230 | } |
|
| 231 | ||
| 232 | public function testUrandomCsprgCanBeForced() |
|
| 233 | { |
|
| @@ 232-255 (lines=24) @@ | ||
| 229 | ); |
|
| 230 | } |
|
| 231 | ||
| 232 | public function testUrandomCsprgCanBeForced() |
|
| 233 | { |
|
| 234 | if (ini_get('open_basedir')) { |
|
| 235 | $this->markTestSkipped( |
|
| 236 | 'Cannot test /dev/urandom generator due to open_basedir constraint.' |
|
| 237 | ); |
|
| 238 | } |
|
| 239 | ||
| 240 | if (!is_readable('/dev/urandom')) { |
|
| 241 | $this->markTestSkipped( |
|
| 242 | '/dev/urandom not found or is not readable.' |
|
| 243 | ); |
|
| 244 | } |
|
| 245 | ||
| 246 | $config = array_merge($this->config, [ |
|
| 247 | 'persistent_data_handler' => 'memory', // To keep session errors from happening |
|
| 248 | 'pseudo_random_string_generator' => 'urandom' |
|
| 249 | ]); |
|
| 250 | $fb = new Facebook($config); |
|
| 251 | $this->assertInstanceOf( |
|
| 252 | 'Facebook\PseudoRandomString\UrandomPseudoRandomStringGenerator', |
|
| 253 | $fb->getRedirectLoginHelper()->getPseudoRandomStringGenerator() |
|
| 254 | ); |
|
| 255 | } |
|
| 256 | ||
| 257 | /** |
|
| 258 | * @expectedException \InvalidArgumentException |
|