2009-11-06 03:23:13 +01:00
|
|
|
<?php
|
|
|
|
/**
|
2012-04-12 08:02:46 +02:00
|
|
|
* @package framework
|
2009-11-06 03:23:13 +01:00
|
|
|
* @subpackage tests
|
|
|
|
*/
|
|
|
|
class EncryptAllPasswordsTaskTest extends SapphireTest {
|
|
|
|
function testRun() {
|
|
|
|
$m = new Member();
|
|
|
|
$m->Password = 'plain';
|
|
|
|
$m->PasswordEncryption = 'none';
|
|
|
|
$m->write();
|
|
|
|
|
|
|
|
$t = new EncryptAllPasswordsTask();
|
2010-04-12 05:27:27 +02:00
|
|
|
$t->run(null);
|
2009-11-06 03:23:13 +01:00
|
|
|
|
|
|
|
$m = DataObject::get_by_id('Member', $m->ID);
|
|
|
|
$this->assertEquals($m->PasswordEncryption, 'sha1_v2.4');
|
|
|
|
$this->assertNotEquals($m->Password, 'plain');
|
2010-02-23 05:05:34 +01:00
|
|
|
$result = $m->checkPassword('plain');
|
|
|
|
$this->assertTrue($result->valid());
|
2009-11-06 03:23:13 +01:00
|
|
|
}
|
2010-04-12 05:27:27 +02:00
|
|
|
}
|