/**
  * @param boolean $shouldPass
  * @param string $password
  * @dataProvider providerValidatePassword
  */
 public function testValidatePassword($shouldPass, $password)
 {
     $this->controller->dictionary->set('password', $password);
     $this->controller->setProperty('validate', '');
     $this->controller->validateFields();
     $this->controller->validatePassword();
     $this->assertEquals($shouldPass, !$this->controller->validator->hasErrors());
 }
 /**
  * Attempt to run a file-based preHook and set the value of a field
  * 
  * @return void
  */
 public function testPreHooks()
 {
     $this->controller->setProperty('preHooks', $this->login->config['testsPath'] . 'Hooks/Pre/prehooktest.setvalue.php');
     $this->controller->loadPreHooks();
     $val = $this->controller->preHooks->getValue('fullname');
     $success = strcmp($val, 'TestPreValue') == 0;
     $this->assertTrue($success, 'The preHook was not fired or did not set the value of the field.');
 }
 /**
  * Attempt to run a file-based preHook and set the value of a field
  *
  * @depends testSetUserFields
  */
 public function testPostHooks()
 {
     $this->controller->setProperty('postHooks', $this->login->config['testsPath'] . 'Hooks/Post/posthooktest.register.php');
     $this->processor->setUserFields();
     $this->processor->setExtended();
     $this->processor->runPostHooks();
     $val = $this->controller->postHooks->getValue('fullname');
     $success = strcmp($val, 'John Doe') == 0;
     $this->assertTrue($success, 'The postHook was not fired or did not set the value of the field.');
     $val = $this->controller->postHooks->getValue('username');
     $success = strcmp($val, $_POST['username']) == 0;
     $this->assertTrue($success, 'The postHook did not correctly pass register.user.');
     $val = $this->controller->postHooks->getValue('email');
     $success = strcmp($val, $_POST['email']) == 0;
     $this->assertTrue($success, 'The postHook did not correctly pass register.profile.');
 }
 /**
  * Attempt to run a file-based preHook and set the value of a field
  *
  * @return void
  */
 public function testForm()
 {
     $this->controller->process();
     $exists = $this->modx->getCount('modUser', array('username' => '*****@*****.**'));
     $this->assertTrue($exists > 0);
 }
 /**
  * Attempt to run a file-based preHook and set the value of a field
  *
  * @return void
  */
 public function testForm()
 {
     $this->controller->process();
     $this->assertTrue($this->login->controller->validator->hasErrorsInField('email'));
 }