- 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
78 lines
2.6 KiB
PHP
78 lines
2.6 KiB
PHP
<?php
|
|
|
|
Yii::import('application.modules.usuario.models.*');
|
|
Yii::import('application.modules.usuario.models.formularios.*');
|
|
Yii::import('application.modules.usuario.controllers.*');
|
|
|
|
class ActivacionTest 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 testActivacionCorrecta() {
|
|
|
|
$key = 'eaf2a42cadde86331f821bda9b85ead3';
|
|
$email = 'sin_activar@localhost.local';
|
|
|
|
$this->open('?r=' . Yii::app()->getModule('usuario')->urlActivar . '&key=' . $key . '&email=' . $email);
|
|
|
|
$this->pause(4000);
|
|
|
|
$this->verifyTextPresent("Gracias por registrarse en FactuGES. Su cuenta ha sido confirmada.");
|
|
}
|
|
|
|
public function testActivacionUsuarioYaActivado() {
|
|
|
|
$key = 'eaf2a42cadde86331f821bda9b85ead3';
|
|
$email = 'activado@localhost.local';
|
|
|
|
$this->open('?r=' . Yii::app()->getModule('usuario')->urlActivar . '&key=' . $key . '&email=' . $email);
|
|
|
|
$this->pause(4000);
|
|
|
|
$this->verifyTextPresent("No se ha realizado ningún cambio. La cuenta ya estaba activada.");
|
|
}
|
|
|
|
public function testActivacionUsuarioBloqueado() {
|
|
|
|
$key = 'eaf2a42cadde86331f821bda9b85ead3';
|
|
$email = 'bloqueado@localhost.local';
|
|
|
|
$this->open('?r=' . Yii::app()->getModule('usuario')->urlActivar . '&key=' . $key . '&email=' . $email);
|
|
|
|
$this->pause(4000);
|
|
|
|
$this->verifyTextPresent("La cuenta ha sido bloqueada. Contacte con el administrador del sitio para obtener más información.");
|
|
}
|
|
|
|
public function testActivacionUsuarioBorrado() {
|
|
|
|
$key = 'eaf2a42cadde86331f821bda9b85ead3';
|
|
$email = 'borrado@localhost.local';
|
|
|
|
$this->open('?r=' . Yii::app()->getModule('usuario')->urlActivar . '&key=' . $key . '&email=' . $email);
|
|
|
|
$this->pause(4000);
|
|
|
|
$this->verifyTextPresent("Gracias por registrarse en FactuGES. Su cuenta ha sido confirmada.");
|
|
}
|
|
|
|
}
|