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