2009-11-13 22:43:55 +01:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* @package sapphire
|
|
|
|
* @subpackage tests
|
|
|
|
*/
|
|
|
|
class EncryptAllPasswordsTaskTest extends SapphireTest {
|
|
|
|
function testRun() {
|
|
|
|
$m = new Member();
|
|
|
|
$m->Password = 'plain';
|
|
|
|
$m->PasswordEncryption = 'none';
|
|
|
|
$m->write();
|
|
|
|
|
|
|
|
$t = new EncryptAllPasswordsTask();
|
2010-01-13 01:51:52 +01:00
|
|
|
$t->run(null);
|
2009-11-13 22:43:55 +01:00
|
|
|
|
|
|
|
$m = DataObject::get_by_id('Member', $m->ID);
|
|
|
|
$this->assertEquals($m->PasswordEncryption, 'sha1_v2.4');
|
|
|
|
$this->assertNotEquals($m->Password, 'plain');
|
2010-02-05 02:15:31 +01:00
|
|
|
$result = $m->checkPassword('plain');
|
|
|
|
$this->assertTrue($result->valid());
|
2009-11-13 22:43:55 +01:00
|
|
|
}
|
2010-01-13 01:51:52 +01:00
|
|
|
}
|