mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-02-10 05:58:42 +00:00
fix tests
This commit is contained in:
parent
662651236e
commit
650789ba16
|
|
@ -193,7 +193,9 @@ final class EncryptionHelper
|
||||||
continue;
|
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);
|
$plaintext = \sodium_crypto_secretbox_open($ciphertext, $nonce, $secretKey);
|
||||||
|
|
||||||
if ($plaintext === false) {
|
if ($plaintext === false) {
|
||||||
|
|
|
||||||
|
|
@ -92,8 +92,18 @@ final class PhpCode
|
||||||
*/
|
*/
|
||||||
public static function hasUnicode(string $source) : bool
|
public static function hasUnicode(string $source) : bool
|
||||||
{
|
{
|
||||||
return ((bool) \preg_match("/[\x01-\x7f]/", $source))
|
$length = \mb_strlen($source, 'UTF-8');
|
||||||
|| ((bool) \preg_match("/(0|\\\)x([a-fA-F0-9]){2}/", $source));
|
|
||||||
|
for ($i = 0; $i < $length; ++$i) {
|
||||||
|
$char = \mb_substr($source, $i, 1, 'UTF-8');
|
||||||
|
$codePoint = \ord($char);
|
||||||
|
|
||||||
|
if ($codePoint > 127) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -104,8 +104,6 @@ class SpreadsheetDatabaseMapper implements IODatabaseMapper
|
||||||
$cells[] = $workSheet->getCell(StringUtils::intToAlphabet($j) . $line)->getCalculatedValue();
|
$cells[] = $workSheet->getCell(StringUtils::intToAlphabet($j) . $line)->getCalculatedValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
\var_dump($cells);
|
|
||||||
|
|
||||||
++$line;
|
++$line;
|
||||||
|
|
||||||
$query->values(...$cells);
|
$query->values(...$cells);
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@ declare(strict_types=1);
|
||||||
namespace phpOMS\tests\Router;
|
namespace phpOMS\tests\Router;
|
||||||
|
|
||||||
use phpOMS\Account\Account;
|
use phpOMS\Account\Account;
|
||||||
|
use phpOMS\Account\NullAccount;
|
||||||
use phpOMS\Account\PermissionAbstract;
|
use phpOMS\Account\PermissionAbstract;
|
||||||
use phpOMS\Account\PermissionType;
|
use phpOMS\Account\PermissionType;
|
||||||
use phpOMS\Router\RouteVerb;
|
use phpOMS\Router\RouteVerb;
|
||||||
|
|
@ -134,7 +135,7 @@ final class SocketRouterTest extends \PHPUnit\Framework\TestCase
|
||||||
PermissionType::READ
|
PermissionType::READ
|
||||||
) extends PermissionAbstract {};
|
) extends PermissionAbstract {};
|
||||||
|
|
||||||
$account = new Account();
|
$account = new NullAccount(1);
|
||||||
$account->addPermission($perm);
|
$account->addPermission($perm);
|
||||||
|
|
||||||
self::assertEquals(
|
self::assertEquals(
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user