- 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
98 lines
3.9 KiB
PHP
98 lines
3.9 KiB
PHP
<?php
|
|
|
|
Yii::import('application.modules.usuario.models.*');
|
|
Yii::import('application.modules.usuario.models.formularios.*');
|
|
Yii::import('application.modules.usuario.controllers.*');
|
|
|
|
class RegistroTest extends CWebTestCase {
|
|
|
|
protected $fixtures = array(
|
|
'usuarios' => 'Usuario',
|
|
'perfiles' => 'Perfil',
|
|
'campos' => 'CampoPerfil',
|
|
);
|
|
|
|
private $usuario_correcto = array(
|
|
'username' => 'pepe',
|
|
'password' => 'password',
|
|
'email' => 'darranz@rodax-software.com',
|
|
'nombre' => 'Pepe',
|
|
'apellidos' => 'Pérez',
|
|
);
|
|
|
|
protected function setUp() {
|
|
$this->getFixtureManager()->basePath = Yii::getPathOfAlias('application.tests.modules.usuario.fixtures');
|
|
parent::setUp();
|
|
$this->setBrowserUrl(TEST_BASE_URL);
|
|
}
|
|
|
|
public function testRegistroCorrecto() {
|
|
$this->open('?r=' . Yii::app()->getModule('usuario')->urlLogin);
|
|
|
|
// ensure the user is logged out
|
|
if ($this->isTextPresent('Logout'))
|
|
$this->clickAndWait('link=Logout (demo)');
|
|
|
|
|
|
// verify the sample post title exists
|
|
$this->assertTextPresent('Crear una cuenta');
|
|
$this->clickAndWait('link=Crear una cuenta');
|
|
|
|
$this->assertElementPresent('id=FormularioRegistroUsuario_username');
|
|
$this->type('id=FormularioRegistroUsuario_username', $this->usuario_correcto['username']);
|
|
|
|
$this->assertElementPresent('name=FormularioRegistroUsuario[password]');
|
|
$this->type('name=FormularioRegistroUsuario[password]', $this->usuario_correcto['password']);
|
|
|
|
$this->assertElementPresent('name=FormularioRegistroUsuario[confirmacion_password]');
|
|
$this->type('name=FormularioRegistroUsuario[confirmacion_password]', $this->usuario_correcto['password']);
|
|
|
|
$this->assertElementPresent('name=FormularioRegistroUsuario[email]');
|
|
$this->type('name=FormularioRegistroUsuario[email]', $this->usuario_correcto['email']);
|
|
|
|
$this->assertElementPresent('id=Perfil_nombre');
|
|
$this->type('id=Perfil_nombre', $this->usuario_correcto['nombre']);
|
|
|
|
$this->assertElementPresent('id=Perfil_apellidos');
|
|
$this->type('id=Perfil_apellidos', $this->usuario_correcto['apellidos']);
|
|
|
|
$this->click("css=#uniform-undefined > span");
|
|
$this->click("name=tnc");
|
|
$this->click("name=yt0");
|
|
|
|
$this->pause(6000);
|
|
|
|
$this->verifyTextPresent("Thank you for your registration. Please check your email.");
|
|
}
|
|
|
|
public function testRegistroConErrores() {
|
|
$this->open('?r=' . Yii::app()->getModule('usuario')->urlLogin);
|
|
|
|
// ensure the user is logged out
|
|
if ($this->isTextPresent('Logout'))
|
|
$this->clickAndWait('link=Logout (demo)');
|
|
|
|
// verify the sample post title exists
|
|
$this->assertTextPresent('Crear una cuenta');
|
|
$this->clickAndWait('link=Crear una cuenta');
|
|
|
|
$this->assertElementPresent('id=FormularioRegistroUsuario_username');
|
|
$this->type("id=FormularioRegistroUsuario_username", $this->usuario_correcto['username']);
|
|
$this->click("name=yt0");
|
|
$this->waitForPageToLoad("1000");
|
|
$this->assertTrue($this->isTextPresent("Contraseña no puede ser nulo."));
|
|
|
|
$this->assertElementPresent('id=FormularioRegistroUsuario_password');
|
|
$this->type("id=FormularioRegistroUsuario_password", $this->usuario_correcto['password']);
|
|
$this->click("name=yt0");
|
|
$this->waitForPageToLoad("1000");
|
|
$this->assertTrue($this->isTextPresent("Confirmación de contraseña no puede ser nulo."));
|
|
|
|
$this->type("id=FormularioRegistroUsuario_confirmacion_password", $this->usuario_correcto['password']);
|
|
$this->click("name=yt0");
|
|
$this->waitForPageToLoad("1000");
|
|
$this->assertTrue($this->isTextPresent("E-mail no puede ser nulo."));
|
|
}
|
|
|
|
}
|