0337d704 |
1 | <?php |
2 | require_once("__init__.php"); |
3 | require_once('include/lists.inc.php'); |
4 | |
5 | class TestOfList extends UnitTestCase { |
6 | function TestOfList() { |
7 | $this->UnitTestCase('List functions'); |
8 | } |
9 | |
10 | function test_list_sort_owners() { |
11 | $l1 = Array('xavier.merlin.1998@polytechnique.org', |
12 | 'xavier.merlin.1991@polytechnique.org', |
13 | 'pierre.habouzit.2000@polytechnique.org', |
14 | 'yann.chevalier.2000@polytechnique.org', |
15 | 'foobar@baz.org'); |
16 | |
17 | $t = list_sort_owners($l1); |
18 | $this->assertIdentical($t[0][0]['l'], 'foobar@baz.org'); |
19 | |
20 | $t1991 = array_values($t[1991]); |
21 | $this->assertIdentical($t1991[0]['l'], 'xavier.merlin.1991'); |
22 | |
23 | $t1998 = array_values($t[1998]); |
24 | $this->assertIdentical($t1998[0]['l'], 'xavier.merlin.1998'); |
25 | |
26 | $t2000 = array_values($t[2000]); |
27 | $this->assertIdentical($t2000[0]['l'], 'yann.chevalier.2000'); |
28 | $this->assertIdentical($t2000[1]['l'], 'pierre.habouzit.2000'); |
29 | |
30 | $t = list_sort_owners($l1, false); |
31 | $this->assertIdentical($t[0][0]['l'], 'foobar@baz.org'); |
32 | |
33 | $tC = array_values($t['C']); |
34 | $this->assertIdentical($tC[0]['l'], 'yann.chevalier.2000'); |
35 | |
36 | $tH = array_values($t['H']); |
37 | $this->assertIdentical($tH[0]['l'], 'pierre.habouzit.2000'); |
38 | |
39 | $tM = array_values($t['M']); |
40 | $this->assertIdentical($tM[0]['l'], 'xavier.merlin.1991'); |
41 | $this->assertIdentical($tM[1]['l'], 'xavier.merlin.1998'); |
42 | } |
43 | } |
44 | |
45 | $test = &new TestOfList(); |
46 | $test->run($reporter); |
47 | ?> |