adding test case for #4043

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@6499 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
AD7six 2008-03-01 19:12:25 +00:00
parent 0b4e8e63ac
commit 2918b68877

View file

@ -79,7 +79,7 @@ class NumberTreeCase extends CakeTestCase {
}
parent::tearDown();
}
function testInitialize() {
$this->NumberTree = & new NumberTree();
$this->NumberTree->__initialize(2, 2);
@ -617,6 +617,24 @@ class NumberTreeCase extends CakeTestCase {
$this->assertIdentical($result, $expected);
}
function testMoveToRootAndMoveUp(){
$this->NumberTree = & new NumberTree();
$this->NumberTree->__initialize(1, 1);
$data = $this->NumberTree->find(array('NumberTree.name' => '1.1'), array('id'));
$this->NumberTree->id = $data['NumberTree']['id'];
$this->NumberTree->save(array('parent_id' => null));
$result = $this->NumberTree->verify();
$this->assertIdentical($result, true);
$this->NumberTree->moveup();
$result = $this->NumberTree->findAll(null, array('name'), 'NumberTree.lft ASC');
$expected = array(array('NumberTree' => array('name' => '1.1')),
array('NumberTree' => array('name' => '1. Root')));
$this->assertIdentical($result, $expected);
}
function testDelete() {
$this->NumberTree = & new NumberTree();
$this->NumberTree->__initialize(2, 2);