fix tests

This commit is contained in:
Dennis Eichhorn 2023-09-22 01:42:19 +00:00
parent 662651236e
commit 650789ba16
4 changed files with 17 additions and 6 deletions

View File

@ -193,7 +193,9 @@ final class EncryptionHelper
continue;
}
$ciphertext = \mb_substr($buffer, \SODIUM_CRYPTO_SECRETBOX_NONCEBYTES, null, '8bit');
// $ciphertext = \mb_substr($buffer, \SODIUM_CRYPTO_SECRETBOX_NONCEBYTES, null, '8bit'); Not required due to previous nonce fread
$ciphertext = $buffer;
$plaintext = \sodium_crypto_secretbox_open($ciphertext, $nonce, $secretKey);
if ($plaintext === false) {

View File

@ -92,8 +92,18 @@ final class PhpCode
*/
public static function hasUnicode(string $source) : bool
{
return ((bool) \preg_match("/[\x01-\x7f]/", $source))
|| ((bool) \preg_match("/(0|\\\)x([a-fA-F0-9]){2}/", $source));
$length = \mb_strlen($source, 'UTF-8');
for ($i = 0; $i < $length; ++$i) {
$char = \mb_substr($source, $i, 1, 'UTF-8');
$codePoint = \ord($char);
if ($codePoint > 127) {
return true;
}
}
return false;
}
/**

View File

@ -104,8 +104,6 @@ class SpreadsheetDatabaseMapper implements IODatabaseMapper
$cells[] = $workSheet->getCell(StringUtils::intToAlphabet($j) . $line)->getCalculatedValue();
}
\var_dump($cells);
++$line;
$query->values(...$cells);

View File

@ -15,6 +15,7 @@ declare(strict_types=1);
namespace phpOMS\tests\Router;
use phpOMS\Account\Account;
use phpOMS\Account\NullAccount;
use phpOMS\Account\PermissionAbstract;
use phpOMS\Account\PermissionType;
use phpOMS\Router\RouteVerb;
@ -134,7 +135,7 @@ final class SocketRouterTest extends \PHPUnit\Framework\TestCase
PermissionType::READ
) extends PermissionAbstract {};
$account = new Account();
$account = new NullAccount(1);
$account->addPermission($perm);
self::assertEquals(