| 1 |
lars |
1 |
<?php
|
|
|
2 |
//
|
|
|
3 |
// $Id: move.php,v 1.2 2004/12/21 17:06:02 dufuz Exp $
|
|
|
4 |
//
|
|
|
5 |
|
|
|
6 |
require_once 'UnitTest.php';
|
|
|
7 |
|
|
|
8 |
class tests_move 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 |
$ret = $tree->move(5, 1);
|
|
|
15 |
$tree->setup();
|
|
|
16 |
|
|
|
17 |
// be sure true is returned
|
|
|
18 |
$this->assertTrue($ret);
|
|
|
19 |
// and check if the move succeeded, by checking the new parentId
|
|
|
20 |
$this->assertEquals(1,$tree->getParentId(5));
|
|
|
21 |
}
|
|
|
22 |
|
|
|
23 |
function test_MemoryMDBnested()
|
|
|
24 |
{
|
|
|
25 |
$tree = $this->getMemoryMDBnested();
|
|
|
26 |
$ret = $tree->move(5, 1);
|
|
|
27 |
$tree->setup();
|
|
|
28 |
|
|
|
29 |
// be sure true is returned
|
|
|
30 |
$this->assertTrue($ret);
|
|
|
31 |
// and check if the move succeeded, by checking the new parentId
|
|
|
32 |
$this->assertEquals(1, $tree->getParentId(5));
|
|
|
33 |
}
|
|
|
34 |
|
|
|
35 |
function test_MemoryDBnestedNoAction()
|
|
|
36 |
{
|
|
|
37 |
$tree = $this->getMemoryDBnested();
|
|
|
38 |
// $id = $tree->getIdByPath('/Root/child 2/child 2_2');
|
|
|
39 |
$parentId = $tree->getParentId(5);
|
|
|
40 |
$ret = $tree->move(5, 5);
|
|
|
41 |
$tree->setup();
|
|
|
42 |
// be sure true is returned
|
|
|
43 |
$this->assertTrue($ret);
|
|
|
44 |
$this->assertEquals($parentId, $tree->getParentId(5));
|
|
|
45 |
}
|
|
|
46 |
|
|
|
47 |
function test_MemoryMDBnestedNoAction()
|
|
|
48 |
{
|
|
|
49 |
$tree = $this->getMemoryMDBnested();
|
|
|
50 |
// $id = $tree->getIdByPath('/Root/child 2/child 2_2');
|
|
|
51 |
$parentId = $tree->getParentId(5);
|
|
|
52 |
$ret = $tree->move(5, 5);
|
|
|
53 |
$tree->setup();
|
|
|
54 |
// be sure true is returned
|
|
|
55 |
$this->assertTrue($ret);
|
|
|
56 |
$this->assertEquals($parentId, $tree->getParentId(5));
|
|
|
57 |
}
|
|
|
58 |
|
|
|
59 |
// do this for XML
|
|
|
60 |
|
|
|
61 |
// do this for Filesystem
|
|
|
62 |
|
|
|
63 |
// do this for DBsimple
|
|
|
64 |
|
|
|
65 |
// do this for DynamicDBnested
|
|
|
66 |
function test_DynamicDBnested()
|
|
|
67 |
{
|
|
|
68 |
$tree =& $this->getDynamicDBnested();
|
|
|
69 |
$ret = $tree->move(5, 1);
|
|
|
70 |
|
|
|
71 |
// be sure true is returned
|
|
|
72 |
$this->assertTrue($ret);
|
|
|
73 |
// and check if the move succeeded, by checking the new parentId
|
|
|
74 |
$this->assertEquals(1, $tree->getParentId(5));
|
|
|
75 |
}
|
|
|
76 |
|
|
|
77 |
function test_DynamicMDBnested()
|
|
|
78 |
{
|
|
|
79 |
$tree =& $this->getDynamicDBnested();
|
|
|
80 |
$ret = $tree->move(5, 1);
|
|
|
81 |
|
|
|
82 |
// be sure true is returned
|
|
|
83 |
$this->assertTrue($ret);
|
|
|
84 |
// and check if the move succeeded, by checking the new parentId
|
|
|
85 |
$this->assertEquals(1, $tree->getParentId(5));
|
|
|
86 |
}
|
|
|
87 |
|
|
|
88 |
function test_DynamicDBnestedNoAction()
|
|
|
89 |
{
|
|
|
90 |
$tree =& $this->getDynamicDBnested();
|
|
|
91 |
// $id = $tree->getIdByPath('/Root/child 2/child 2_2');
|
|
|
92 |
$parentId = $tree->getParentId(5);
|
|
|
93 |
$ret = $tree->move(5, 5);
|
|
|
94 |
// be sure true is returned
|
|
|
95 |
$this->assertTrue($ret);
|
|
|
96 |
$this->assertEquals($parentId, $tree->getParentId(5));
|
|
|
97 |
}
|
|
|
98 |
|
|
|
99 |
function test_DynamicMDBnestedNoAction()
|
|
|
100 |
{
|
|
|
101 |
$tree =& $this->getDynamicMDBnested();
|
|
|
102 |
// $id = $tree->getIdByPath('/Root/child 2/child 2_2');
|
|
|
103 |
$parentId = $tree->getParentId(5);
|
|
|
104 |
$ret = $tree->move(5, 5);
|
|
|
105 |
// be sure true is returned
|
|
|
106 |
$this->assertTrue($ret);
|
|
|
107 |
$this->assertEquals($parentId, $tree->getParentId(5));
|
|
|
108 |
}
|
|
|
109 |
}
|
|
|
110 |
|
|
|
111 |
?>
|