aboutsummaryrefslogtreecommitdiffstats
path: root/lib/t/00_downloads.t
blob: f30f9bf51e46b5888201b265b8fee2475b0c0411 (plain)
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
<?php


require realpath(__DIR__ . '/../testmore.php');
require realpath(__DIR__ . '/../Downloads.php');

plan('no_plan');

diag('Testing prepare_download(). Countries/continents should match.');

$wsd = new Downloads();

$countries = array(
    'FR' => array('FR', 'EU'),
    'DE' => array('DE', 'EU'),
    'AU' => array('AU', 'OC')
);

foreach ($countries as $k => $v) {
    $one = $wsd->prepare_download(true, $k);

    //is($one['country'], $v[0], "countries match");
    is($one['continent'], $v[1], "continents match");
}

diag('Testing get_mirror(). Note, this depends on the actual mirrors list.');

$ccs = array(
    array('FR', 'EU'),
    array('DE', 'EU'),
    array('CN', 'AS')
);

foreach ($ccs as $cc) {
    $mir = $wsd->get_mirror($cc[0], $cc[1]);

    //is($mir['country'], $cc[0], 'country match');
    is($mir['continent'], $cc[1], 'continents match');
}