Subversion-Projekte lars-tiefland.php_share

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
1 lars 1
<?php
2
//
3
//  $Id: getPath.php,v 1.2 2004/12/21 17:06:02 dufuz Exp $
4
//
5
 
6
require_once 'UnitTest.php';
7
 
8
class tests_getPath extends UnitTest
9
{
10
    // check if we get the right ID, for the given path
11
    function test_MemoryDBnested()
12
    {
13
        $tree =& $this->getMemoryDBnested();
14
        $this->_testPath($tree);
15
    }
16
 
17
    function test_MemoryMDBnested()
18
    {
19
        $tree =& $this->getMemoryMDBnested();
20
        $this->_testPath($tree);
21
    }
22
 
23
    // do this for XML
24
 
25
    // do this for Filesystem
26
 
27
    // do this for DBsimple
28
 
29
    // do this for DynamicDBnested
30
    function test_DynamicDBnested()
31
    {
32
        $tree =& $this->getDynamicDBnested();
33
        $this->_testPath($tree);
34
    }
35
 
36
    function test_DynamicMDBnested()
37
    {
38
        $tree =& $this->getDynamicMDBnested();
39
        $this->_testPath($tree);
40
    }
41
 
42
    function _testPath(&$tree)
43
    {
44
//        $id = $tree->getIdByPath('/Root/child 2/child 2_2');
45
        $id = 5;
46
        $path = $tree->getPath($id);
47
 
48
        $this->assertEquals(3, sizeof($path));
49
        $this->assertEquals('Root', $path[0]['name']);
50
        $this->assertEquals('child 2', $path[1]['name']);
51
        $this->assertEquals('child 2_2', $path[2]['name']);
52
    }
53
 
54
 
55
}
56
 
57
?>