substr($raiz,strrpos($raiz, DIRECTORY_SEPARATOR)+1), 'raiz'=> $raiz, 'tipo'=> $tipo, ); } /** * invoca a phpunit */ function phpunit($clase, $inc, $ruta) { // opciones utiles de phpunit: --verbose, --debug // tipos de ejecución // 1: funciona cambiando algo // 2: probar funcionamiento como iba en cit $tipo = 1; if ($tipo == 1) exec("phpunit --bootstrap $inc $clase $ruta", $out); elseif ($tipo == 2) exec("phpunit $clase $inc", $out); else throw new Exception("Tipo de ejecución desconocida"); print implode("\n",$out); } /** * Programa principal * */ if ($argc != 2) { die($uso); } $resource_name=$argv[1]; $resource_parts = pathinfo($resource_name); $clase = $resource_parts['filename']; $info = info_ruta($resource_name); $prj = $info['prj']; chdir($info['raiz']); switch ($info['tipo']) { case 1: echo "--- test de la clase '$clase' de prj '$prj' --- "; phpunit($clase, 'igep/tests/test_incprj.php', "tests/$clase.php"); break; case 2: echo '--- test de gvHIDRA --- '; phpunit('test_gvhidra', 'igep/tests/test_gvhidra.php','igep/tests/test_gvhidra.php'); break; case 4: echo "--- test de la clase '$clase' de gvHIDRA --- "; phpunit($clase, 'igep/tests/test_inc.php',"igep/tests/$clase.php"); break; case 3: echo "--- test de prj '$prj' --- "; phpunit('test_prj', 'igep/tests/test_prj.php','igep/tests/test_prj.php'); break; case 5: echo "--- test de prj '$prj' + gvHIDRA --- "; phpunit('test_all', 'igep/tests/test_all.php','igep/tests/test_all.php'); break; } ?>