changes to how testactions work

This commit is contained in:
2019-09-19 12:08:16 +02:00
parent 7c009bcd96
commit 6121e31459
9 changed files with 303 additions and 231 deletions

View File

@@ -33,7 +33,7 @@ class MVCController{
if(isset($_POST['testaction'])){
$this->testaction = "./model/testactions/model_".$_POST['testaction'].".php";
$this->testaction = "./model/testactions/TA_".$_POST['testaction'].".php";
}
@@ -67,12 +67,10 @@ class MVCController{
//check if testaction is valid
if(file_exists($this->testaction)){
echo('{"output": [');
//execute testaction
include_once($this->testaction);
TestUtils::log('End of output', "OK", false);
echo("]}");
require_once($this->testaction);
$testactionClassname = "TA_".$_POST['testaction'];
$testactionInstance = new $testactionClassname();
}
}

View File

@@ -1,21 +0,0 @@
<?php
class TestUtils{
public static $log = [];
public static $status;
public static function log($output, $status = "OK",$addComma = true){
$loginput = [];
$loginput['message'] = $output;
$loginput['status'] = $status;
echo(json_encode($loginput));
if($addComma){
echo(',');
echo("\n");
}
return;
}
public static function returnLog(){
echo(json_encode(self::$log));
}
}