]> git.mxchange.org Git - friendica.git/blobdiff - tests/src/Util/CryptoTest.php
Merge remote-tracking branch 'upstream/2021.06-rc' into http-input-data
[friendica.git] / tests / src / Util / CryptoTest.php
index 1a25e171953a052362e19c0f93ab3ca3ab7e7916..16770ff6491e3e76534d4a531ed1c502cd899ca5 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * @copyright Copyright (C) 2020, Friendica
+ * @copyright Copyright (C) 2010-2021, the Friendica project
  *
  * @license GNU AGPL version 3 or any later version
  *
@@ -19,6 +19,8 @@
  *
  * This is in the same namespace as Crypto for mocking 'rand' and 'random_init'
  */
+
+/// @todo Use right namespace - needs alternative way of mocking random_int()
 namespace Friendica\Util;
 
 use phpseclib\Crypt\RSA;
@@ -27,6 +29,15 @@ use PHPUnit\Framework\TestCase;
 
 class CryptoTest extends TestCase
 {
+       public static function tearDownAfterClass(): void
+       {
+               // Reset mocking
+               global $phpMock;
+               $phpMock = [];
+
+               parent::tearDownAfterClass();
+       }
+
        /**
         * Replaces random_int results with given mocks
         *
@@ -120,7 +131,6 @@ function random_int($min, $max)
 {
        global $phpMock;
        if (isset($phpMock['random_int'])) {
-               $result = call_user_func_array($phpMock['random_int'], func_get_args());
-               return $result;
+               return call_user_func_array($phpMock['random_int'], func_get_args());
        }
 }