controller = new RegistroController('registro'); $user = new FormularioRegistroUsuario; $user->username = 'no whitespaces allowed'; $this->assertFalse($user->validate()); $user->username = 'allowed'; $user->password = 'notthesame'; $user->password = 'emasehtton'; $this->assertFalse($user->validate()); $user->setAttributes(array( 'username' => 'A_Testuser', 'password' => 'hiddenpassword1', 'confirmacion_password' => 'hiddenpassword1', )); $this->assertTrue($user->validate()); /*$profile = new YumRegistrationForm; $profile->setAttributes(array( 'firstname' => 'My first Name !"§$%&/()=', 'lastname' => 'My last Name !"§$%&/()=', 'password' => 'hiddenpassword1', 'confirmacion_password' => 'hiddenpassword1', )); $profile->setAttributes($user->getAttributes()); $this->assertTrue($profile->validate());*/ // it is good that $_POST is bloated here because we want to test if // only safe Attributes are being assigned: $_POST['FormularioRegistroUsuario'] = $user->getAttributes(); //$_POST['YumProfile'] = $profile->getAttributes(); } }