--[[ This is your "scratch pad" for developing new scripts.--]]require "lfs"function dirtree(dir) assert(dir and dir ~= "", "directory parameter is missing or empty") if string.sub(dir, -1) == "/" then dir=string.sub(dir, 1, -2) end local function yieldtree(dir) for entry in lfs.dir(dir) do if entry ~= "." and entry ~= ".." then entry=dir.."/"..entry local attr=lfs.attributes(entry) coroutine.yield(entry,attr) if attr.mode == "directory" then yieldtree(entry) end end end end return coroutine.wrap(function() yieldtree(dir) end)endlocal dir="/home/matt/Projects/HabariTrunk/tests/system/"local dlg=dialog.new("Tests -- Habari", { "_Ok", "_Cancel" } )dlg:group("tests", "none", "Select Test:")dlg:radio("tests", "phpunit_suite.php", "AllTests")for filename, attr in dirtree(dir) do if (attr.mode == "file") and string.find(filename, ".php") and not string.find(filename, ".svn") and not string.find(filename, "phpunit_suite") then local test = string.gsub(filename, "/(.*).php", function (a) return a end) test = string.gsub(test, "home/matt/Projects/HabariTrunk/tests/", "") test = string.gsub(test, "/", "_") dlg:radio("tests", test, test) endendlocal button, results = dlg:run()if ( button == 1 ) and results then local test=results['tests'] local f = io.popen("cd '/home/matt/Projects/HabariTrunk/tests';\ phpunit -d 'memory_limit=-1' -d 'error_reporting=E_ALL' --report report/ --log-xml report/out.xml " .. test) local l = f:read("*a") -- read output of command f:close() local dlg=dialog.new("PHPUnit -- Habari", { "_View Code Coverage", "_Cancel" } ) dlg:textarea("remarks", l, "Resluts: ") local button, results = dlg:run() if ( button == 1 ) and results then os.execute("firefox '/home/matt/Projects/HabariTrunk/tests/report/index.html'") endend