Files
iTop/tests/php-unit-tests/unitary-tests/core/SympleCryptTest.php
odain-cbd 318b792b31 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
2025-10-10 14:25:39 +02:00

37 lines
874 B
PHP

<?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"));
}
}