Esempio n. 1
0
 function generar_layout()
 {
     $selecciones = $this->controlador->get_selecciones();
     echo "<div style='background-color: white; border: 1px solid black; text-align: left; padding: 15px'>";
     try {
         //Se construye un suite por categoria que tenga test seleccionados
         foreach (toba_test_lista_casos::get_categorias() as $categoria) {
             $test = new GroupTest($categoria['nombre']);
             $hay_uno = false;
             foreach (toba_test_lista_casos::get_casos() as $caso) {
                 if ($caso['categoria'] == $categoria['id'] && in_array($caso['id'], $selecciones['casos'])) {
                     $hay_uno = true;
                     require_once $caso['archivo'];
                     $test->addTestCase(new $caso['id']($caso['nombre']));
                 }
             }
             if ($hay_uno) {
                 //--- COBERTURA DE CODIGO (OPCIONAL) ----
                 if (function_exists('xdebug_start_code_coverage')) {
                     xdebug_start_code_coverage();
                 }
                 //-------
                 $test->run(new toba_test_reporter());
                 //--- COBERTURA DE CODIGO (OPCIONAL) ----
                 $arch = 'PHPUnit2/Util/CodeCoverage/Renderer.php';
                 $existe = toba_manejador_archivos::existe_archivo_en_path($arch);
                 if (function_exists('xdebug_start_code_coverage') && $existe) {
                     require_once $arch;
                     $cubiertos = xdebug_get_code_coverage();
                     //Se limpian las referencias a simpletest y a librerias de testing en gral.
                     $archivos = array();
                     foreach (array_keys($cubiertos) as $archivo) {
                         if (!strpos($archivo, 'simpletest') && !strpos($archivo, 'PHPUnit') && !strpos($archivo, 'testing_automatico/') && !strpos($archivo, '/test_')) {
                             $archivos[$archivo] = $cubiertos[$archivo];
                         }
                     }
                     $cc = PHPUnit2_Util_CodeCoverage_Renderer::factory('HTML', array('tests' => $archivos));
                     $path_temp = toba::proyecto()->get_path_temp_www();
                     $salida = $path_temp['real'] . '/cobertura.html';
                     $cc->renderToFile($salida);
                     echo "<a href='{$path_temp['browser']}/cobertura.html' target='_blank'>Ver cobertura de código</a>";
                 }
                 //-------
             }
         }
     } catch (Exception $e) {
         if (method_exists($e, 'mensaje_web')) {
             echo ei_mensaje($e->mensaje_web(), 'error');
         } else {
             echo $e;
         }
     }
     echo '</div><br>';
     $this->dep('lista_archivos')->generar_html();
 }
Esempio n. 2
0
 function __construct()
 {
     $this->xml = new toba_vista_xml();
     //$this->fop se debe obtener desde la variable en instalacion.ini
     $fop = toba::instalacion()->get_xslfo_fop();
     $this->fop = $fop ? $fop : (toba_manejador_archivos::es_windows() ? 'fop.bat' : 'fop');
     $this->fop = toba_manejador_archivos::path_a_plataforma($this->fop);
     $prxsl = toba::proyecto()->get_path() . '/exportaciones/pdf_proyecto.xsl';
     $toxsl = toba::nucleo()->toba_dir() . '/exportaciones/pdf.xsl';
     $this->xsl_proyecto = toba_manejador_archivos::existe_archivo_en_path($prxsl) ? $prxsl : $toxsl;
     $this->xsl_proyecto = toba_manejador_archivos::path_a_plataforma($this->xsl_proyecto);
     $this->xml_proyecto = toba_manejador_archivos::path_a_plataforma(tempnam(toba::nucleo()->toba_dir() . '/temp', 'xml'));
 }
Esempio n. 3
0
 function proyecto__copiar_punto_acceso()
 {
     $dir_destino = $this->elemento->get_dir() . '/www/';
     $destino_final = toba_manejador_archivos::path_a_plataforma($dir_destino . 'servicios.php');
     $origen = toba_dir() . '/php/modelo/template_proyecto/www/servicios.php';
     if (!toba_manejador_archivos::existe_archivo_en_path($destino_final)) {
         $template = file_get_contents($origen);
         //Leo el template original
         $editor = new toba_editor_texto();
         $editor->agregar_sustitucion('|__proyecto__|', $this->elemento->get_id());
         $salida = $editor->procesar($template);
         file_put_contents($destino_final, $salida, FILE_APPEND);
     }
 }
Esempio n. 4
0
 /**
  *  Importa la personalización que está en el directorio personalización del proyecto
  * @consola_parametros Opcional: [-t] Ejecuta toda la importacion dentro de una transaccion
  */
 function opcion__importar()
 {
     $p = $this->get_proyecto();
     //Verificar que se haya ejecutado si o si la opcion de conflicto
     $archivo = $p->get_dir() . '/temp/conflictos_verificados.mrk';
     $verifico_conflictos = toba_manejador_archivos::existe_archivo_en_path($archivo);
     if (!$verifico_conflictos) {
         $this->consola->mensaje('Antes de realizar la importación debe ejecutar el comando \'conflictos\'');
         return;
     }
     $this->consola->mensaje('Importando la personalizacion...');
     $pers = new toba_personalizacion($p, $this->consola);
     //Verifico si la ejecucion se quiere hacer dentro de una transaccion.
     $param = $this->get_parametros();
     if (isset($param['-t'])) {
         $pers->set_ejecucion_con_transaccion_global();
     }
     //Aplico la personalizacion
     $pers->aplicar();
     $this->consola->mensaje('Proceso Finalizado');
     //Elimino la marca  de conflictos para que no pueda volver a ejecutarse la importacion.
     unlink($archivo);
 }
Esempio n. 5
0
 static function existe_archivo_certificado(toba_modelo_proyecto $proyecto)
 {
     $dir_inicial = $proyecto->get_dir_instalacion_proyecto();
     return toba_manejador_archivos::existe_archivo_en_path($dir_inicial . '/privada.key');
 }