Example #1
0
<?php

echo "inResponse={data:\"Data For Passed Test\"}\n";
echo GetJSForTreatingValidatingResult("1", $theTest, "inResponse");
Example #2
0
            // we recursively search for the tests in sub dir
            if ($theHandle = opendir($inTestPath)) {
                while (false !== ($entry = readdir($theHandle))) {
                    if (!is_dir("{$inTestPath}/{$entry}")) {
                        continue;
                    }
                    // echo "trace: ScanTestDirs / directory found: $entry<br>\n";
                    $theResult = array_merge($theResult, ScanTestDirs("{$inTestPath}/{$entry}"));
                }
            }
        }
    }
    // echo "trace: ScanTestDirs / return: ".json_encode($theResult)."<br>\n";
    return $theResult;
}
$theRealTests = array();
foreach ($inListOfLaunchedTest as &$theTest) {
    $theRealTests = array_merge($theRealTests, ScanTestDirs($theTest));
}
// for each real test, we send an ajax request to this test
foreach ($theRealTests as &$theTest) {
    if (is_file("{$theTest}/test_js.php")) {
        require "{$theTest}/test_js.php";
    } else {
        echo "  \$http({\n\t    method: 'POST',\n  \t    headers: {'Content-Type': 'application/x-www-form-urlencoded'},\n            url: '{$theTest}/test.php',\t\n\t\tdata: \$.param({inMode: '{$inMode}'})\n\t  }).then(function successCallback(inResponse) {";
        echo GetJSForTreatingValidatingResult("(response.data == \"PASS\")", $theTest, "inResponse");
    }
}
?>

function CreateTestApiCall($inUrl, $inVerb, $inAdditionalData, $inResponseVarName, $inTestResultVarName, $inTestName, $inTestCode)
{
    echo GetNgForCallingApi($inUrl, $inVerb, $inAdditionalData, $inResponseVarName, $inTestCode . GetJSForTreatingValidatingResult($inTestResultVarName, $inTestName, $inResponseVarName));
}