AesTests.php in AES encryption 8.2
File
src/Tests/AesTests.php
View source
<?php
namespace Drupal\aes\Tests;
use Drupal\simpletest\WebTestBase;
use Drupal\aes\AES;
class AesTests extends WebTestBase {
public static $modules = array(
'aes',
);
protected $strictConfigSchema = FALSE;
protected $string = 'String-to-encrypt';
protected function writeSettings(array $settings) {
$settings['config_directories'][CONFIG_ACTIVE_DIRECTORY] = (object) array(
'value' => $this->privateFilesDirectory . '/aes',
'required' => TRUE,
);
parent::writeSettings($settings);
}
protected function testAesEncryption() {
$encrypted = AES::encrypt($this->string);
$decrypted = AES::decrypt($encrypted);
$this
->assertNotEqual($encrypted, $this->string, 'String has been encrypted');
$this
->assertEqual($decrypted, $this->string, 'String has been successfully decrypted');
}
}