Example #1
0
#  +----------------------------------------------------------------------+
#   $Id$
error_reporting(E_ALL);
require 'parserfunc.php';
require '../include/functions.php';
echo '<h1>Testing QA report parsing and database handling</h1>';
echo '<pre>' . "\n";
$str = file_get_contents('sample.txt');
echo 'Content length: ' . strlen($str);
if (strlen($str) == 126341) {
    echo " <font color='green'>OK</font> \n";
} else {
    echo " <font color='red'>KO (value: " . strlen($str) . "</font> \n";
}
echo "Parsing with function parse_phpmaketest() ... \n";
$array = parse_phpmaketest('5.3.7-dev', 'failed', $str);
printf("%-30s", "Result should be array: ");
if (is_array($array)) {
    echo " <font color='green'>OK</font> \n";
} else {
    echo " <font color='red'>KO</font> \n";
}
printf("%-30s", "Version extracted match: ");
if ($array['version'] == '5.3.7-dev') {
    echo " <font color='green'>OK</font> \n";
} else {
    echo " <font color='red'>KO. value extracted: " . $array['version'] . "</font> \n";
}
printf("%-30s", "Test email match: ");
if ($array['userEmail'] == '*****@*****.**') {
    echo " <font color='green'>OK</font> \n";
    }
    if (isset($_GET['status'])) {
        switch ($_GET['status']) {
            case 'failed':
                $status = "failed";
                break;
            case 'success':
                $status = "success";
                break;
            default:
                $status = "unknown";
        }
    } else {
        $status = "unknown";
    }
    if (isset($_GET['version'])) {
        $version = $_GET['version'];
    } else {
        $version = "unknown";
    }
    if (in_array($version, $QA_RELEASES['reported'])) {
        mail("*****@*****.**", "Test results for {$version} [{$status}]", base64_decode($_POST['php_test_data']), "From: noreply@php.net");
    }
    // Aggregator (http://qa.php.net/reports/)
    include 'reports/parserfunc.php';
    $array = parse_phpmaketest($version, $status, base64_decode($_POST['php_test_data']));
    insertToDb_phpmaketest($array, $QA_RELEASES);
}
?>
$Revision$