| 1 |
lars |
1 |
<?php
|
|
|
2 |
//
|
|
|
3 |
// $Id: remove.php,v 1.3.2.1 2007/06/01 23:05:38 dufuz Exp $
|
|
|
4 |
//
|
|
|
5 |
|
|
|
6 |
require_once 'UnitTest.php';
|
|
|
7 |
|
|
|
8 |
class tests_remove extends UnitTest
|
|
|
9 |
{
|
|
|
10 |
/*
|
|
|
11 |
function test_MemoryDBnested()
|
|
|
12 |
{
|
|
|
13 |
$tree = $this->getMemoryDBnested();
|
|
|
14 |
$ret=$tree->remove(5);
|
|
|
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 |
//problem here is that memory returns another return value for a not existing element ... shit
|
|
|
21 |
$this->assertEquals(x, $tree->getElement(5));
|
|
|
22 |
}
|
|
|
23 |
*/
|
|
|
24 |
|
|
|
25 |
function test_MemoryDBnestedNoAction()
|
|
|
26 |
{
|
|
|
27 |
$tree = $this->getMemoryDBnested();
|
|
|
28 |
// $id = $tree->getIdByPath('/Root/child 2/child 2_2');
|
|
|
29 |
$parentId = $tree->getParentId(5);
|
|
|
30 |
$ret = $tree->move(5, 5);
|
|
|
31 |
$tree->setup();
|
|
|
32 |
// be sure true is returned
|
|
|
33 |
$this->assertTrue($ret);
|
|
|
34 |
$this->assertEquals($parentId, $tree->getParentId(5));
|
|
|
35 |
}
|
|
|
36 |
|
|
|
37 |
function test_MemoryMDBnestedNoAction()
|
|
|
38 |
{
|
|
|
39 |
$tree = $this->getMemoryMDBnested();
|
|
|
40 |
// $id = $tree->getIdByPath('/Root/child 2/child 2_2');
|
|
|
41 |
$parentId = $tree->getParentId(5);
|
|
|
42 |
$ret = $tree->move(5, 5);
|
|
|
43 |
$tree->setup();
|
|
|
44 |
// be sure true is returned
|
|
|
45 |
$this->assertTrue($ret);
|
|
|
46 |
$this->assertEquals($parentId, $tree->getParentId(5));
|
|
|
47 |
}
|
|
|
48 |
|
|
|
49 |
// do this for XML
|
|
|
50 |
|
|
|
51 |
// do this for Filesystem
|
|
|
52 |
|
|
|
53 |
// do this for DBsimple
|
|
|
54 |
|
|
|
55 |
// do this for DynamicDBnested
|
|
|
56 |
function test_DynamicDBnested()
|
|
|
57 |
{
|
|
|
58 |
$tree =& $this->getDynamicDBnested();
|
|
|
59 |
$ret = $tree->remove(5);
|
|
|
60 |
|
|
|
61 |
// be sure true is returned
|
|
|
62 |
$this->assertTrue($ret);
|
|
|
63 |
// and check if the element doesnt exist anymore ... this is not 100% sure, since the
|
|
|
64 |
// returned error message is a string :-(
|
|
|
65 |
$this->assertTrue(Tree::isError($tree->getElement(5)));
|
|
|
66 |
}
|
|
|
67 |
|
|
|
68 |
function test_DynamicMDBnested()
|
|
|
69 |
{
|
|
|
70 |
$tree =& $this->getDynamicMDBnested();
|
|
|
71 |
$ret = $tree->remove(5);
|
|
|
72 |
|
|
|
73 |
// be sure true is returned
|
|
|
74 |
$this->assertTrue($ret);
|
|
|
75 |
// and check if the element doesnt exist anymore ... this is not 100% sure, sicne the
|
|
|
76 |
// returned error message is a string :-(
|
|
|
77 |
$this->assertTrue(Tree::isError($tree->getElement(5)));
|
|
|
78 |
}
|
|
|
79 |
}
|
|
|
80 |
|
|
|
81 |
?>
|