/** * Test new user email notifications. */ public function test_version1importnewuseremailgenerate() { global $CFG; // This is needed by the required files. require_once dirname(__FILE__) . '/other/rlip_importplugin_version1_fakeemail.php'; $importplugin = new rlip_importplugin_version1_fakeemail(); $templatetext = '<p>Hi %%fullname%%, your account has been created! It has the following information Sitename: %%sitename%% Login Link: %%loginlink%% Username: %%username%% Password: %%password%% Idnumber: %%idnumber%% First Name: %%firstname%% Last Name: %%lastname%% Full Name: %%fullname%% Email Address: %%email%%</p>'; $user = new stdClass(); $user->username = '******'; $user->cleartextpassword = '******'; $user->idnumber = 'testidnumber'; $user->firstname = 'testfirstname'; $user->lastname = 'testlastname'; $user->email = '*****@*****.**'; $actualtext = $importplugin->newuseremail_generate($templatetext, $user); $expectedtext = '<p>Hi testfirstname testlastname, your account has been created! It has the following information Sitename: PHPUnit test site Login Link: http://www.example.com/moodle/login/index.php Username: testusername Password: cleartextpassword Idnumber: testidnumber First Name: testfirstname Last Name: testlastname Full Name: testfirstname testlastname Email Address: testemail@example.com</p>'; $this->assertEquals($expectedtext, $actualtext); }