diff options
author | Fabien Potencier <fabien.potencier@gmail.com> | 2012-10-28 07:37:44 +0100 |
---|---|---|
committer | Fabien Potencier <fabien.potencier@gmail.com> | 2012-10-28 08:06:38 +0100 |
commit | cd11bd304daebd23b42566a1bbc8ec3a543e3c8d (patch) | |
tree | 7cecc59079b6398380332b26fcadfc007aa6d0de | |
parent | c0ea4df9110557a2453b434d979d1c6d90d998c2 (diff) | |
download | symfony-security-cd11bd304daebd23b42566a1bbc8ec3a543e3c8d.zip symfony-security-cd11bd304daebd23b42566a1bbc8ec3a543e3c8d.tar.gz symfony-security-cd11bd304daebd23b42566a1bbc8ec3a543e3c8d.tar.bz2 |
fixed tests when OpenSsl is not enabled in PHP, renamed a missnamed test, added missing license doc blocks
-rw-r--r-- | Tests/Core/Util/ClassUtilsTest.php | 9 | ||||
-rwxr-xr-x | Tests/Core/Util/SecureRandomTest.php | 31 | ||||
-rwxr-xr-x | Tests/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() { |