19 declare(strict_types=1);
32 $old_email =
'oldemmail@ilias.de';
33 $new_email =
'newemail@ilias.de';
35 $status = ChangeMailStatus::Login;
36 $token_string =
hash(
'md5',
"{$timestamp}-{$user_id}-{$old_email}-{$status->value}");
47 $this->assertEquals(
$user_id, $token1->getUserId());
48 $this->assertEquals($old_email, $token1->getCurrentEmail());
49 $this->assertEquals($new_email, $token1->getNewEmail());
50 $this->assertEquals(
$timestamp, $token1->getCreatedTimestamp());
51 $this->assertEquals($status, $token1->getStatus());
52 $this->assertEquals($token_string, $token1->getToken());
61 $this->assertEquals(
$user_id, $token2->getUserId());
62 $this->assertEquals($old_email, $token2->getCurrentEmail());
63 $this->assertEquals($new_email, $token2->getNewEmail());
64 $this->assertEquals(
$timestamp, $token2->getCreatedTimestamp());
65 $this->assertEquals($status, $token2->getStatus());
66 $this->assertEquals($token_string, $token2->getToken());
72 $old_email =
'oldemmail@ilias.de';
73 $new_email =
'newemail@ilias.de';
82 $this->assertEquals(
true, $token1->isTokenValidForCurrentStatus($this->createMock(\ilSetting::class)));
88 time() - ChangeMailStatus::VALIDITY_LOGIN - 60
91 $this->assertEquals(
false, $token2->isTokenValidForCurrentStatus($this->createMock(\ilSetting::class)));
98 ChangeMailStatus::EmailConfirmation
101 $settings_mock = $this->createMock(\ilSetting::class);
102 $settings_mock->expects($this->once())->method(
'get')->willReturn(
'0');
104 $this->assertEquals(
false, $token3->isTokenValidForCurrentStatus($settings_mock));
testIsTokenValidForCurrentStatusReturnsCorrectStatus()
const REG_HASH_LIFETIME_MIN_VALUE
testGettersReturnCorrectValues()
foreach($mandatory_scripts as $file) $timestamp