This repository has been archived on 2024-12-01. You can view files and clone it, but cannot push or open issues or pull requests.
factuges_web/www/protected/modules/usuario2/tests/unit/RegistrationTest.php
david e93adbdd4e - Importación inicial
- Registro, activación y entrada de usuarios


git-svn-id: https://192.168.0.254/svn/Rodax.factuges_web/trunk@2 e455b18d-f7fe-5245-9c43-e2c35af70a32
2013-06-13 16:04:48 +00:00

51 lines
1.7 KiB
PHP

<?php
// This unit test tests, if the Registration and Activation process provided
// by Yum works
Yii::import('application.modules.usuario.models.*');
Yii::import('application.modules.usuario.models.formularios.*');
Yii::import('application.modules.usuario.controllers.*');
class RegistrationTest extends CDbTestCase {
public $fixtures = array();
public function testRegistration() {
Yii::app()->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 !"§$%&/()=<?php die() ?>',
'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();
}
}