[1] | 1 | <?php |
---|
| 2 | /// FIXME: Tests not implemented. |
---|
| 3 | return; |
---|
| 4 | |
---|
| 5 | /** |
---|
[88] | 6 | * PHPUnit test case for Hierarchy |
---|
[42] | 7 | * |
---|
| 8 | * The method skeletons below need to be filled in with |
---|
| 9 | * real data so that the tests will run correctly. Replace |
---|
| 10 | * all EXPECTED_VAL and PARAM strings with real data. |
---|
| 11 | * |
---|
[1] | 12 | * Created with PHPUnit_Skeleton on 2005-08-09 |
---|
| 13 | */ |
---|
| 14 | require_once 'PHPUnit.php'; |
---|
[88] | 15 | class HierarchyTest extends PHPUnit_TestCase { |
---|
[1] | 16 | |
---|
[88] | 17 | var $Hierarchy; |
---|
[1] | 18 | |
---|
[88] | 19 | function HierarchyTest($name) |
---|
[1] | 20 | { |
---|
| 21 | $this->PHPUnit_TestCase($name); |
---|
| 22 | } |
---|
| 23 | |
---|
| 24 | function setUp() |
---|
| 25 | { |
---|
| 26 | require dirname(__FILE__) . '/_config.inc.php'; |
---|
[88] | 27 | require_once '../lib/Hierarchy.inc.php'; |
---|
| 28 | $this->Hierarchy =& new Hierarchy(PARAM); |
---|
[1] | 29 | } |
---|
| 30 | |
---|
| 31 | function tearDown() |
---|
| 32 | { |
---|
[88] | 33 | unset($this->Hierarchy); |
---|
[1] | 34 | } |
---|
| 35 | |
---|
| 36 | function test_currentnode() |
---|
| 37 | { |
---|
[88] | 38 | $result = $this->Hierarchy->currentnode(PARAM); |
---|
[1] | 39 | $expected = EXPECTED_VAL; |
---|
| 40 | $this->assertEquals($expected, $result); |
---|
| 41 | } |
---|
| 42 | |
---|
| 43 | function test_tostringid() |
---|
| 44 | { |
---|
[88] | 45 | $result = $this->Hierarchy->tostringid(PARAM); |
---|
[1] | 46 | $expected = EXPECTED_VAL; |
---|
| 47 | $this->assertEquals($expected, $result); |
---|
| 48 | } |
---|
| 49 | |
---|
| 50 | function test_toarrayid() |
---|
| 51 | { |
---|
[88] | 52 | $result = $this->Hierarchy->toarrayid(PARAM); |
---|
[1] | 53 | $expected = EXPECTED_VAL; |
---|
| 54 | $this->assertEquals($expected, $result); |
---|
| 55 | } |
---|
| 56 | |
---|
| 57 | function test_insertnode() |
---|
| 58 | { |
---|
[88] | 59 | $result = $this->Hierarchy->insertnode(PARAM); |
---|
[1] | 60 | $expected = EXPECTED_VAL; |
---|
| 61 | $this->assertEquals($expected, $result); |
---|
| 62 | } |
---|
| 63 | |
---|
| 64 | function test_deletenode() |
---|
| 65 | { |
---|
[88] | 66 | $result = $this->Hierarchy->deletenode(PARAM); |
---|
[1] | 67 | $expected = EXPECTED_VAL; |
---|
| 68 | $this->assertEquals($expected, $result); |
---|
| 69 | } |
---|
| 70 | |
---|
| 71 | function test_movenode() |
---|
| 72 | { |
---|
[88] | 73 | $result = $this->Hierarchy->movenode(PARAM); |
---|
[1] | 74 | $expected = EXPECTED_VAL; |
---|
| 75 | $this->assertEquals($expected, $result); |
---|
| 76 | } |
---|
| 77 | |
---|
| 78 | function test_getparents() |
---|
| 79 | { |
---|
[88] | 80 | $result = $this->Hierarchy->getparents(PARAM); |
---|
[1] | 81 | $expected = EXPECTED_VAL; |
---|
| 82 | $this->assertEquals($expected, $result); |
---|
| 83 | } |
---|
| 84 | |
---|
| 85 | function test_getnode() |
---|
| 86 | { |
---|
[88] | 87 | $result = $this->Hierarchy->getnode(PARAM); |
---|
[1] | 88 | $expected = EXPECTED_VAL; |
---|
| 89 | $this->assertEquals($expected, $result); |
---|
| 90 | } |
---|
| 91 | |
---|
| 92 | function test_getchildren() |
---|
| 93 | { |
---|
[88] | 94 | $result = $this->Hierarchy->getchildren(PARAM); |
---|
[1] | 95 | $expected = EXPECTED_VAL; |
---|
| 96 | $this->assertEquals($expected, $result); |
---|
| 97 | } |
---|
| 98 | |
---|
| 99 | function test_getnumberchildren() |
---|
| 100 | { |
---|
[88] | 101 | $result = $this->Hierarchy->getnumberchildren(PARAM); |
---|
[1] | 102 | $expected = EXPECTED_VAL; |
---|
| 103 | $this->assertEquals($expected, $result); |
---|
| 104 | } |
---|
| 105 | |
---|
| 106 | function test_isleaf() |
---|
| 107 | { |
---|
[88] | 108 | $result = $this->Hierarchy->isleaf(PARAM); |
---|
[1] | 109 | $expected = EXPECTED_VAL; |
---|
| 110 | $this->assertEquals($expected, $result); |
---|
| 111 | } |
---|
| 112 | |
---|
| 113 | function test_isancestor() |
---|
| 114 | { |
---|
[88] | 115 | $result = $this->Hierarchy->isancestor(PARAM); |
---|
[1] | 116 | $expected = EXPECTED_VAL; |
---|
| 117 | $this->assertEquals($expected, $result); |
---|
| 118 | } |
---|
| 119 | |
---|
| 120 | function test_getallancestors() |
---|
| 121 | { |
---|
[88] | 122 | $result = $this->Hierarchy->getallancestors(PARAM); |
---|
[1] | 123 | $expected = EXPECTED_VAL; |
---|
| 124 | $this->assertEquals($expected, $result); |
---|
| 125 | } |
---|
| 126 | |
---|
| 127 | function test_nodeexists() |
---|
| 128 | { |
---|
[88] | 129 | $result = $this->Hierarchy->nodeexists(PARAM); |
---|
[1] | 130 | $expected = EXPECTED_VAL; |
---|
| 131 | $this->assertEquals($expected, $result); |
---|
| 132 | } |
---|
| 133 | |
---|
| 134 | function test_getnodelist() |
---|
| 135 | { |
---|
[88] | 136 | $result = $this->Hierarchy->getnodelist(PARAM); |
---|
[1] | 137 | $expected = EXPECTED_VAL; |
---|
| 138 | $this->assertEquals($expected, $result); |
---|
| 139 | } |
---|
| 140 | |
---|
| 141 | function test_rebuildsubnodeqty() |
---|
| 142 | { |
---|
[88] | 143 | $result = $this->Hierarchy->rebuildsubnodeqty(PARAM); |
---|
[1] | 144 | $expected = EXPECTED_VAL; |
---|
| 145 | $this->assertEquals($expected, $result); |
---|
| 146 | } |
---|
| 147 | |
---|
| 148 | function test_setsubnodeqtytoparents() |
---|
| 149 | { |
---|
[88] | 150 | $result = $this->Hierarchy->setsubnodeqtytoparents(PARAM); |
---|
[1] | 151 | $expected = EXPECTED_VAL; |
---|
| 152 | $this->assertEquals($expected, $result); |
---|
| 153 | } |
---|
| 154 | |
---|
| 155 | } |
---|
| 156 | // Running the test. |
---|
[88] | 157 | $suite = new PHPUnit_TestSuite('HierarchyTest'); |
---|
[1] | 158 | $result = PHPUnit::run($suite); |
---|
| 159 | echo $result->toString(); |
---|
| 160 | ?> |
---|