From 4b8a9a5189a625bf99fedec7fd31f6e146410a14 Mon Sep 17 00:00:00 2001 From: emkael Date: Thu, 26 Apr 2018 01:00:12 +0200 Subject: Update FB API library --- .../PseudoRandomStringFactoryTest.php | 71 ++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 lib/facebook-graph-sdk/tests/PseudoRandomString/PseudoRandomStringFactoryTest.php (limited to 'lib/facebook-graph-sdk/tests/PseudoRandomString/PseudoRandomStringFactoryTest.php') diff --git a/lib/facebook-graph-sdk/tests/PseudoRandomString/PseudoRandomStringFactoryTest.php b/lib/facebook-graph-sdk/tests/PseudoRandomString/PseudoRandomStringFactoryTest.php new file mode 100644 index 0000000..9dc679e --- /dev/null +++ b/lib/facebook-graph-sdk/tests/PseudoRandomString/PseudoRandomStringFactoryTest.php @@ -0,0 +1,71 @@ +assertInstanceOf(self::COMMON_INTERFACE, $pseudoRandomStringGenerator); + $this->assertInstanceOf($expected, $pseudoRandomStringGenerator); + } + + /** + * @return array + */ + public function csprngProvider() + { + $providers = [ + [null, self::COMMON_INTERFACE], + ]; + if (function_exists('random_bytes')) { + $providers[] = ['random_bytes', self::COMMON_NAMESPACE . 'RandomBytesPseudoRandomStringGenerator']; + } + if (function_exists('mcrypt_create_iv')) { + $providers[] = ['mcrypt', self::COMMON_NAMESPACE . 'McryptPseudoRandomStringGenerator']; + } + if (function_exists('openssl_random_pseudo_bytes')) { + $providers[] = ['openssl', self::COMMON_NAMESPACE . 'OpenSslPseudoRandomStringGenerator']; + } + if (!ini_get('open_basedir') && is_readable('/dev/urandom')) { + $providers[] = ['urandom', self::COMMON_NAMESPACE . 'UrandomPseudoRandomStringGenerator']; + } + + return $providers; + } +} -- cgit v1.2.3