View source
<?php
class LegalRegister extends DrupalTestCase {
function get_info() {
return array(
'name' => t('Create Account'),
'desc' => t('Register as new user and create account.'),
'group' => t('Legal'),
);
}
function setUp() {
$this
->drupalModuleEnable('legal');
$this
->drupalModuleDisable('profile');
$this
->drupalModuleDisable('nodeprofile');
parent::setUp();
}
function testRegisterSuccessful() {
$name = $this
->randomName();
$mail = "{$name}@example.com";
$edit = array(
'name' => $name,
'mail' => $mail,
'legal_accept' => 1,
);
$this
->drupalPost('user/register', $edit, 'Create new account');
$this
->assertText(t('Your password and further instructions have been sent to your e-mail address'), ' [post] Account created');
}
function testRegisterUnsuccessful() {
$name = $this
->randomName();
$mail = "{$name}@example.com";
$edit = array(
'name' => $name,
'mail' => $mail,
);
$this
->drupalPost('user/register', $edit, 'Create new account');
$this
->assertText(t('Terms & Conditions must be accepted.'), ' [post] T&C not accepted, account not created');
}
}