Example #1
0
    } else {
        define('PATH_SEPARATOR', ':');
    }
}
ini_set('include_path', '..' . PATH_SEPARATOR . ini_get('include_path'));
require_once 'PHPUnit.php';
require_once 'test_setup.php';
require_once 'testUtils.php';
$output = '';
foreach ($testcases as $testcase) {
    include_once $testcase . '.php';
    $output .= '<fieldset>' . "\n";
    $output .= '<legend><input type="checkbox" id="selectAll_' . $testcase . '" onclick="return checkAll(\'' . $testcase . '\');" /> <b>TestCase : ' . $testcase . '</b></legend>' . "\n";
    $testmethods[$testcase] = getTests($testcase);
    foreach ($testmethods[$testcase] as $method) {
        $output .= testCheck($testcase, $method);
    }
    $output .= "</fieldset><br />\n\n";
    $output .= "<input name=\"submit\" type=\"submit\"><br /> <br />\n\n";
}
?>
<html>
<head>
<title>MDB2 Tests</title>
<link href="tests.css" rel="stylesheet" type="text/css">
<script language="javascript" type="text/javascript">
<!--
function checkAll(testcase)
{
    var boolValue = document.getElementById('selectAll_'+testcase).checked;
    var substr_name = "testmethods[" + testcase + "]";
?>
<br>
Barcode column: <?php 
echo TICKET_COL;
?>
<br>
Scanned boolean column: <?php 
echo SCAN_COL;
?>
<br>
Strict barcode checking is: <?php 
echo !STRICT_CHECKING ? 'Disabled' : 'Enabled';
?>
<br>
<?php 
$ticket = new ticket();
$barcode = 'ZZZ111111111';
echo testCheck("Successful import", $ticket->importTickets("Testing,{$barcode}"), 3);
echo testCheck('Valid scan', $ticket->scanTicket($barcode, 'nick'), 3);
echo testCheck('Duplicate scan', $ticket->scanTicket($barcode, 'nick'), 1);
echo testCheck('Empty barcode', $ticket->scanTicket('', 'nick'), 0);
echo testCheck('Invalid barcode', $ticket->scanTicket('asdfghjkl', 'nick'), 0);
echo testCheck('Empty user', $ticket->scanTicket($barcode, ''), 2);
echo testCheck('Empty user, empty barcode', $ticket->scanTicket('', ''), 2);
$db = new database();
$db->query("DELETE FROM tbl_ticket WHERE tbl_ticket.barcode = '{$barcode}'");
$db->execute();
?>

</pre>