Example #1
0
 function test()
 {
     global $webroot, $settings, $flight2, $fid;
     assert_login($this);
     $stats = $this->post($webroot . "php/stats.php");
     // Uniques
     $this->assertText('"num_airports":"2"');
     $this->assertText('"num_countries":"1"');
     $this->assertText('"num_airlines":"1"');
     $this->assertText('"num_planes":"1"');
     $this->assertText('"distance":"' . $flight2["distance"] . '"');
     $this->assertText('"avg_distance":"' . $flight2["distance"]);
     // ignore localized bit at end
     $this->assertText('"avg_duration":"' . $flight2["duration"] . '"');
 }
Example #2
0
 function test()
 {
     global $webroot, $route;
     // First figure out the correct results
     $db = db_connect();
     $sql = "SELECT alid FROM airlines WHERE iata='" . $route["core_al_iata"] . "'";
     $result = mysql_query($sql, $db) or die($sql . ":" . mysql_error());
     if ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
         $alid = $row["alid"];
     }
     $sql = "SELECT COUNT(*) AS count FROM routes WHERE alid=" . $alid;
     $result = mysql_query($sql, $db) or die($sql . ":" . mysql_error());
     if ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
         $route_count = intval($row["count"]);
     }
     // Then test
     assert_login($this);
     $params = array("export" => "export", "id" => "L" . $alid);
     $csv = $this->get($webroot . "php/flights.php", $params);
     $rows = explode("\n", $csv);
     $this->assertEqual(count($rows), $route_count + 1);
 }
Example #3
0
 function test()
 {
     global $webroot, $settings, $flight2;
     assert_login($this);
     $params = array("mode" => "D");
     $top10 = $this->post($webroot . "php/top10.php", $params);
     $rows = preg_split('/\\n/', $top10);
     $this->assertTrue(sizeof($rows) == 4);
     $distance = $flight2["distance"];
     // Top 10 routes
     $routes = $rows[0];
     $this->assertPattern("/," . $flight2["src_apid"] . ",/", $routes);
     $this->assertPattern("/," . $flight2["dst_apid"] . ",{$distance}/", $routes);
     // Top 10 airports
     $airports = $rows[1];
     $this->assertPattern("/,{$distance}," . $flight2["src_apid"] . "/", $airports);
     $this->assertPattern("/,{$distance}," . $flight2["dst_apid"] . "/", $airports);
     // Top 10 airlines
     $airlines = $rows[2];
     $this->assertPattern("/,{$distance}," . $flight2["alid"] . "/", $airlines);
     // Top 10 planes
     $planes = $rows[3];
     $this->assertPattern("/" . $flight2["plane"] . ",{$distance}/", $planes);
 }
Example #4
0
<?php

require "www2-funcs.php";
login_init();
bbs_session_modify_user_mode(BBS_MODE_MAIL);
assert_login();
mailbox_header("阅读信件");
if (isset($_GET["path"])) {
    $mail_path = $_GET["path"];
    $mail_title = $_GET["title"];
} else {
    $mail_path = ".DIR";
    //default is .DIR
    $mail_title = "收件箱";
}
if (isset($_GET["start"])) {
    $start = $_GET["start"];
} else {
    $start = 999999;
}
//default*/
if (strstr($mail_path, '..')) {
    html_error_quit("读取邮件数据失败!");
}
$mail_fullpath = bbs_setmailfile($currentuser["userid"], $mail_path);
$mail_num = bbs_getmailnum2($mail_fullpath);
if ($mail_num < 0 || $mail_num > 30000) {
    html_error_quit("Too many mails!");
}
$num = 19;
if ($start > $mail_num - 19) {
Example #5
0
 function test()
 {
     global $webroot, $settings, $flight2, $fid;
     assert_login($this);
     $params = array("export" => "export");
     $msg = $this->get($webroot . "php/flights.php", $params);
     $this->assertText($flight2["src_date"] . " " . $flight2["src_time"] . ":00,");
     $this->assertText($flight2["alid"] . ",");
     $this->assertText($flight2["duration"] . ",");
     $this->assertText($flight2["distance"] . ",");
     $this->assertText($flight2["number"] . ",");
     $this->assertText($flight2["plane"] . ",");
     $this->assertText($flight2["seat"] . ",");
     $this->assertText($flight2["type"] . ",");
     $this->assertText($flight2["class"] . ",");
     $this->assertText($flight2["reason"] . ",");
     $this->assertText($flight2["registration"] . ",");
     $this->assertText($flight2["note"]);
     // may or may not be quote-wrapped
     $this->assertText($flight2["src_apid"] . ",");
     $this->assertText($flight2["dst_apid"] . ",");
     $this->assertText($flight2["alid"] . ",");
 }
Example #6
0
 function test()
 {
     global $webroot, $settings, $flight2;
     assert_login($this);
     $params = array("param" => "true");
     $map = $this->post($webroot . "php/map.php", $params);
     $rows = preg_split('/\\n/', $map);
     $this->assertTrue(sizeof($rows) == 6, "Number of rows");
     // Statistics
     $stats = preg_split('/;/', $rows[0]);
     $this->assertTrue($stats[0] == 1, "Flight count");
     $this->assertTrue(strstr($stats[1], $flight2["distance"]), "Distance");
     $this->assertTrue($stats[3] == "O", "Public");
     // own flights always full access
     $this->assertTrue($stats[4] == $settings["elite"], "Elite");
     $this->assertTrue($stats[5] == $settings["name"], "Username");
     $this->assertTrue($stats[6] == $settings["editor"], "Editor");
 }