mirror of
https://github.com/roundcube/roundcubemail.git
synced 2026-03-09 17:46:51 +01:00
* Fix "method_argument_space" * Fix "control_structure_continuation_position" * Fix "new_with_parentheses" * Fix "blank_line_before_statement" * Fix "visibility_required" * Fix some "array_indentation" * Fix some "array_indentation" - unify all "rcube::raise_error" calls * rm useless eslint ignores and add rules counts * sort eslint ignores * fix eslint ignores grammar * Revert "Fix "blank_line_before_statement"" * fix CS 3.46.0
38 lines
1.0 KiB
PHP
38 lines
1.0 KiB
PHP
<?php
|
|
|
|
class Enigma_EnigmaEngine extends PHPUnit\Framework\TestCase
|
|
{
|
|
public static function setUpBeforeClass(): void
|
|
{
|
|
include_once __DIR__ . '/../enigma.php';
|
|
include_once __DIR__ . '/../lib/enigma_engine.php';
|
|
}
|
|
|
|
/**
|
|
* Test password_handler()
|
|
*/
|
|
public function test_password_handler()
|
|
{
|
|
$rcube = rcube::get_instance();
|
|
$plugin = new enigma($rcube->plugins);
|
|
$engine = new enigma_engine($plugin);
|
|
|
|
unset($_SESSION['enigma_pass']);
|
|
|
|
$engine->password_handler();
|
|
|
|
$this->assertTrue(!array_key_exists('enigma_pass', $_SESSION));
|
|
$this->assertSame([], $engine->get_passwords());
|
|
|
|
$_POST = ['_keyid' => 'abc', '_passwd' => '123<a>456'];
|
|
|
|
$time = time();
|
|
$engine->password_handler();
|
|
|
|
$store = unserialize($rcube->decrypt($_SESSION['enigma_pass']));
|
|
|
|
$this->assertSame(['123<a>456', $time], $store['ABC']);
|
|
$this->assertSame(['ABC' => '123<a>456'], $engine->get_passwords());
|
|
}
|
|
}
|