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

51 lines
1.7 KiB
PHP
Raw Normal View History

<?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();
}
}