public function testTipoBuscarYDesactivar() { $r = AlmacenesController::BuscarTipo(); $this->assertInternalType("int", $r["numero_de_resultados"]); $this->assertEquals($r["numero_de_resultados"], count($r["resultados"])); if ($r["numero_de_resultados"] == 0) { return; } foreach ($r["resultados"] as $tipo) { $tipo = $tipo; if ($tipo["descripcion"] == "1dee80c7d5ab2c1c90aa8d2f7dd47256") { //ya existe este tipo para testing, hay que desactivarlo Logger::testerLog("Ya encontre el repetido, procedo a desactivar"); $d = AlmacenesController::DesactivarTipo($tipo["id_tipo_almacen"]); } } //volvamos a buscar y esperemos que ya no exista $r = AlmacenesController::BuscarTipo(); $found = false; foreach ($r["resultados"] as $tipo) { $tipo = $tipo; if ($tipo["descripcion"] == "1dee80c7d5ab2c1c90aa8d2f7dd47256") { //ya existe este tipo para testing, hay que desactivarlo $found = true; } } $this->assertFalse($found); }
protected function GenerateResponse() { try { $this->response = AlmacenesController::BuscarTipo(isset($_GET['activo']) ? $_GET['activo'] : null, isset($_GET['limit']) ? $_GET['limit'] : null, isset($_GET['query']) ? $_GET['query'] : null, isset($_GET['start']) ? $_GET['start'] : null); } catch (Exception $e) { //Logger::error($e); throw new ApiException($this->error_dispatcher->invalidDatabaseOperation($e->getMessage())); } }
<?php define("BYPASS_INSTANCE_CHECK", false); require_once "../../../server/bootstrap.php"; $page = new GerenciaComponentPage(); //titulos $page->addComponent(new TitleComponent("Tipos de almacen")); $a = AlmacenesController::BuscarTipo(); $tabla = new TableComponent(array("descripcion" => "Descripcion"), $a["resultados"]); $tabla->addOnClick("id_tipo_almacen", "(function(a){window.location = 'sucursales.tipo_almacen.ver.php?tid='+a;})"); $page->addComponent($tabla); //render the page $page->render();