N°4058 - Setup failed when added an encrypted field due to default value NULL non SODIUM compatible (#754)

* N°4058 - Setup failed when added an encrypted field due to default value NULL non SODIUM compatible

* N°4058 - Setup failed when added an encrypted field due to default value NULL non SODIUM compatible

* change log level to warning
This commit is contained in:
odain-cbd
2025-10-10 14:25:39 +02:00
committed by GitHub
parent 0fe2183369
commit 318b792b31
2 changed files with 46 additions and 2 deletions

View File

@@ -0,0 +1,36 @@
<?php
/*!
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license http://opensource.org/licenses/AGPL-3.0
*/
namespace Combodo\iTop\Test\UnitTest\Core;
use Combodo\iTop\Test\UnitTest\ItopDataTestCase;
use SodiumException;
/**
* Tests of the ormPassword class
*/
class SympleCryptTest extends ItopDataTestCase
{
public function testDecryptWithNullValue()
{
$oSimpleCrypt = new \SimpleCrypt("Sodium");
$this->assertEquals(null, $oSimpleCrypt->Decrypt("dd", null));
}
public function testDecryptWithEmptyValue()
{
$oSimpleCrypt = new \SimpleCrypt("Sodium");
$this->assertEquals('', $oSimpleCrypt->Decrypt("dd", ""));
}
public function testDecrypNonDecryptableValue()
{
$this->expectException(SodiumException::class);
$oSimpleCrypt = new \SimpleCrypt("Sodium");
$this->assertEquals('', $oSimpleCrypt->Decrypt("dd", "gabuzomeu"));
}
}