changes to how testactions work
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user