forked from jpatokal/openflights
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstats.php
31 lines (24 loc) · 904 Bytes
/
stats.php
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
<?php
include_once(dirname(__FILE__) . '/config.php');
//
// Test cases for php/stats.php
// NB: Assumes the test user exists and flights.php has been run, so that $flight2[] is already in DB
//
$fid = null; // global for newly-added flight
// Check Analyse stats
class CheckAnalyseStats extends WebTestCase {
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"] . '"');
}
}
?>