From 2bd301d1fe47b0d775c28da7723f55aed9f515d0 Mon Sep 17 00:00:00 2001 From: Carsten Brandt Date: Thu, 8 Sep 2016 00:02:52 +0200 Subject: [PATCH] fix test for PHP 7.1, expect deprecation message for mcrypt_create_iv() --- tests/framework/base/SecurityTest.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/framework/base/SecurityTest.php b/tests/framework/base/SecurityTest.php index f20ffc9..3e85922 100644 --- a/tests/framework/base/SecurityTest.php +++ b/tests/framework/base/SecurityTest.php @@ -935,6 +935,11 @@ TEXT; if (DIRECTORY_SEPARATOR === '\\' && $functions['random_bytes'] === false && $functions['openssl_random_pseudo_bytes'] === false && $functions['mcrypt_create_iv'] === false ) { $this->setExpectedException('yii\base\Exception', 'Unable to generate a random key'); } + // Function mcrypt_create_iv() is deprecated since PHP 7.1 + if (version_compare(PHP_VERSION, '7.1.0', '>=') && $functions['random_bytes'] === false && $functions['mcrypt_create_iv'] === true) { + $this->setExpectedException('yii\base\ErrorException', 'Function mcrypt_create_iv() is deprecated'); + } + static::$functions = $functions; // test various string lengths