summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Tests/Core/Util/ClassUtilsTest.php9
-rwxr-xr-xTests/Core/Util/SecureRandomTest.php31
-rwxr-xr-xTests/Core/Util/StringUtilsTest.php (renamed from Tests/Core/Util/StringTest.php)11
3 files changed, 48 insertions, 3 deletions
diff --git a/Tests/Core/Util/ClassUtilsTest.php b/Tests/Core/Util/ClassUtilsTest.php
index 16378a6..edfd779 100644
--- a/Tests/Core/Util/ClassUtilsTest.php
+++ b/Tests/Core/Util/ClassUtilsTest.php
@@ -1,5 +1,14 @@
<?php
+/*
+ * This file is part of the Symfony package.
+ *
+ * (c) Fabien Potencier <fabien@symfony.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
namespace Symfony\Component\Security\Tests\Core\Util
{
use Symfony\Component\Security\Core\Util\ClassUtils;
diff --git a/Tests/Core/Util/SecureRandomTest.php b/Tests/Core/Util/SecureRandomTest.php
index fae7806..1a4bdbd 100755
--- a/Tests/Core/Util/SecureRandomTest.php
+++ b/Tests/Core/Util/SecureRandomTest.php
@@ -1,5 +1,14 @@
<?php
+/*
+ * This file is part of the Symfony package.
+ *
+ * (c) Fabien Potencier <fabien@symfony.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
namespace Symfony\Component\Security\Tests\Core\Util;
use Symfony\Component\Security\Core\Util\NullSeedProvider;
@@ -145,9 +154,14 @@ class SecureRandomTest extends \PHPUnit_Framework_TestCase
{
$secureRandoms = array();
- // openssl with fallback
+ // openssl
$secureRandom = new SecureRandom();
- $secureRandoms[] = array($secureRandom);
+ // only add if openssl is indeed present
+ if ($this->hasOpenSsl($secureRandom)) {
+ $secureRandoms[] = array($secureRandom);
+ } else {
+ $this->markTestSkipped('OpenSSL is not available');
+ }
// no-openssl with custom seed provider
$secureRandom = new SecureRandom(sys_get_temp_dir().'/_sf2.seed');
@@ -162,6 +176,19 @@ class SecureRandomTest extends \PHPUnit_Framework_TestCase
$ref = new \ReflectionProperty($secureRandom, 'useOpenSsl');
$ref->setAccessible(true);
$ref->setValue($secureRandom, false);
+ $ref->setAccessible(false);
+ }
+
+ protected function hasOpenSsl($secureRandom)
+ {
+ $ref = new \ReflectionProperty($secureRandom, 'useOpenSsl');
+ $ref->setAccessible(true);
+
+ $ret = $ref->getValue($secureRandom);
+
+ $ref->setAccessible(false);
+
+ return $ret;
}
private function getBitSequence($secureRandom, $length)
diff --git a/Tests/Core/Util/StringTest.php b/Tests/Core/Util/StringUtilsTest.php
index e5f8160..aac4139 100755
--- a/Tests/Core/Util/StringTest.php
+++ b/Tests/Core/Util/StringUtilsTest.php
@@ -1,10 +1,19 @@
<?php
+/*
+ * This file is part of the Symfony package.
+ *
+ * (c) Fabien Potencier <fabien@symfony.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
namespace Symfony\Component\Security\Tests\Core\Util;
use Symfony\Component\Security\Core\Util\StringUtils;
-class StringTest extends \PHPUnit_Framework_TestCase
+class StringUtilsTest extends \PHPUnit_Framework_TestCase
{
public function testEquals()
{