Jakobo / snaptest

PHP5 Unit Testing Framework

This URL has Read+Write access

snaptest / snaptest_webcore.php
100644 55 lines (41 sloc) 1.146 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<?php
 
// snaptest web core initialization
 
// requires PHP 5.2+
if (version_compare(phpversion(), '5.0.0') < 0) {
    echo "\n";
    echo "SnapTest requires a PHP version >= 5.0.0\n";
    exit;
}
 
define('SNAPTEST_CLI_INTERFACE', FALSE);
 
require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'constants.php';
 
$options = Snap_Request::getLongOptions(array(
    'mode' => 'index',
    'key' => '',
));
 
if (SNAP_WI_KEY) {
    if ($options['key'] != SNAP_WI_KEY) {
        echo "\n";
        echo "SnapTest Web Interface: Key Mismatch\n";
        exit;
    }
}
 
Snap_Request::setURLBase(SNAP_WI_URL_PATH);
 
switch ($options['mode']) {
    case 'index':
        include SNAPTEST_WEBFILES . 'index.php';
        exit;
    
    case 'resource':
        include SNAPTEST_WEBFILES . 'resource.php';
        exit;
    
    case 'getfiles':
        include SNAPTEST_WEBFILES . 'getfiles.php';
        exit;
    
    case 'loadtests':
        include SNAPTEST_WEBFILES . 'loadtests.php';
        exit;
    
    case 'runtest':
        include SNAPTEST_WEBFILES . 'runtest.php';
        exit;
    
    default:
        die('not supported');
}