public function testBuscarCategoriaPorQuery()
 {
     //se genera una categoria para despues buscarla por su nombre
     $nombre_cat = self::RandomString(15, FALSE, FALSE, FALSE);
     $desc = self::RandomString(25, FALSE, FALSE, FALSE);
     $c = ProductosController::NuevaCategoria($nombre = $nombre_cat, $descripcion = $desc, $id_categoria_padre = null);
     $this->assertInternalType("int", $c["id_categoria"], "---- 'testNuevaCategoria' 'id_categoria' NO ES UN ENTERO");
     $res = ProductosController::BuscarCategoria($id_categoria = null, $id_categoria_padre = null, $query = $nombre_cat);
     $this->assertGreaterThanOrEqual(1, count($res['categorias']), "---- 'testBuscarProductosPorID_Categoria' SE DEBIÓ DE ENCONTRAR ALMENOS 1 RESULTADO CON nombre = " . $nombre_cat);
 }
<?php

require_once '../../../server/bootstrap.php';
$page = new GerenciaComponentPage();
$page->addComponent(new TitleComponent("Categorias de Productos"));
$page->addComponent("<div class='POS Boton' onClick='window.location=\"productos.categoria.nueva.php\"'>Crear</div>");
// Lista
$categorias = ProductosController::BuscarCategoria();
$table = new TableComponent(array('nombre_completo' => '<b>Nombre completo</b>'), $categorias['categorias']);
$table->addOnClick("id_clasificacion_producto", "(function(a){window.location = 'productos.categoria.ver.php?id='+a;})");
$page->addComponent($table);
$page->render();
Example #3
0
 protected function GenerateResponse()
 {
     try {
         $this->response = ProductosController::BuscarCategoria(isset($_GET['activa']) ? $_GET['activa'] : true, isset($_GET['query']) ? $_GET['query'] : null);
     } catch (Exception $e) {
         //Logger::error($e);
         throw new ApiException($this->error_dispatcher->invalidDatabaseOperation($e->getMessage()));
     }
 }