public function testBootstrap() { $r = SesionController::Iniciar(123, 1, true); $this->assertEquals($r["login_succesful"], true); $r = SesionController::getCurrentUser(); $this->assertEquals($r->getIdUsuario(), 1); }
protected function setUp() { $r = SesionController::Iniciar(123, 1, true); if ($r["login_succesful"] == false) { global $POS_CONFIG; $POS_CONFIG["INSTANCE_CONN"]->Execute("INSERT INTO `usuario` (`id_usuario`, `id_direccion`, `id_direccion_alterna`, `id_sucursal`, `id_rol`, `id_clasificacion_cliente`, `id_clasificacion_proveedor`, `id_moneda`, `fecha_asignacion_rol`, `nombre`, `rfc`, `curp`, `comision_ventas`, `telefono_personal1`, `telefono_personal2`, `fecha_alta`, `fecha_baja`, `activo`, `limite_credito`, `descuento`, `password`, `last_login`, `consignatario`, `salario`, `correo_electronico`, `pagina_web`, `saldo_del_ejercicio`, `ventas_a_credito`, `representante_legal`, `facturar_a_terceros`, `dia_de_pago`, `mensajeria`, `intereses_moratorios`, `denominacion_comercial`, `dias_de_credito`, `cuenta_de_mensajeria`, `dia_de_revision`, `codigo_usuario`, `dias_de_embarque`, `tiempo_entrega`, `cuenta_bancaria`, `id_tarifa_compra`, `tarifa_compra_obtenida`, `id_tarifa_venta`, `tarifa_venta_obtenida`) VALUES\n\t\t\t\t(1, NULL, NULL, NULL, 0, NULL, NULL, NULL, '2011-10-24 18:28:24', 'Administrador', NULL, NULL, NULL, NULL, NULL, '2011-10-24 18:28:34', NULL, 1, 0, NULL, '202cb962ac59075b964b07152d234b70', NULL, 0, NULL, NULL, NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '', NULL, NULL, NULL, 0, 'rol', 0, 'rol');"); $r = SesionController::Iniciar(123, 1, true); } }
protected function GenerateResponse() { try { $this->response = SesionController::Iniciar(isset($_POST['password']) ? $_POST['password'] : null, isset($_POST['usuario']) ? $_POST['usuario'] : null, isset($_POST['request_token']) ? $_POST['request_token'] : true); } catch (Exception $e) { //Logger::error($e); throw new ApiException($this->error_dispatcher->invalidDatabaseOperation($e->getMessage())); } }
public static function setUpBeforeClass() { SesionController::Iniciar(123, 1, true); self::$categoria_peso = new CategoriaUnidadMedida(array('descripcion' => 'Peso', 'activa' => true)); CategoriaUnidadMedidaDAOBase::save(self::$categoria_peso); CategoriaUnidadMedidaDAOBase::save(new CategoriaUnidadMedida(array('descripcion' => 'Tiempo', 'activa' => false))); CategoriaUnidadMedidaDAOBase::save(new CategoriaUnidadMedida(array('descripcion' => 'Distancia', 'activa' => true))); CategoriaUnidadMedidaDAOBase::save(new CategoriaUnidadMedida(array('descripcion' => 'Omo', 'activa' => false))); }
public function testDeleteAuthTokenOnLogout() { //insert a new user $sql = "Delete from `usuario` where `codigo_usuario` = 'foo';"; global $POS_CONFIG; $POS_CONFIG["INSTANCE_CONN"]->Execute($sql); $r = PersonalYagentesController::NuevoUsuario("foo", "1", "name", "password444222"); $r = SesionController::Iniciar("password444222", "foo"); //this token should be non existing when i log out $auth_token = $r["auth_token"]; $vos = SesionDAO::search(new Sesion(array("auth_token" => $auth_token))); $r = SesionController::Cerrar($auth_token); $vos = SesionDAO::search(new Sesion(array("auth_token" => $auth_token))); $this->assertEquals(sizeof($vos), 0); }
protected function setUp() { SesionController::Iniciar(123, 1, true); $this->configuracion = new Configuracion(array('descripcion' => 'productos_visibles_en_vc')); $this->json = array("nombre_producto", "descripcion"); }
public static function setUpBeforeClass() { SesionController::Iniciar(123, 1, true); }
require_once 'controller/factura.controller.php'; break; case 1300: require_once 'controller/printer.controller.php'; break; case 1400: require_once 'controller/client.controller.php'; break; case 2000: break; case 2001: print '{"success":true, "sesion": false }'; break; case 2004: //revisar login $token = SesionController::Iniciar($args["p"], $args["u"], true); echo json_encode(array("success" => $token["login_succesful"], "text" => "Credenciales invalidas")); break; case 2005: //dispatch $debug = isset($args['DEBUG']) ? "?debug" : ""; echo "<script>window.location = 'sucursal.php" . $debug . "'; </script>"; break; case 3000: $c = new stdClass(); $c->servicios = array(); foreach (ServicioDAO::getAll() as $servicio) { array_push($c->servicios, array("id_servicio" => $servicio->getIdServicio(), "nombre_servicio" => $servicio->getNombreServicio())); } echo json_encode($c); break;
protected function setUp() { SesionController::Iniciar(123, 1, true); CategoriaContactoDAO::save(new CategoriaContacto(array('id' => 1, 'nombre' => 'padre', 'descripcion' => 'Uno', 'activa' => 1))); CategoriaContactoDAO::save(new CategoriaContacto(array('id' => 2, 'id_padre' => 1, 'nombre' => 'hijo', 'descripcion' => 'Dos', 'activa' => 1))); }