コード例 #1
0
 public function testMove()
 {
     $nestedset = new NestedSet_Model();
     $db = Zend_Db::factory('Pdo_Sqlite', array('dbname' => 'tests/test.db'));
     $nestedset->setDb($db);
     $nestedset->setTableName('nested');
     $nestedset->add('foo');
     $nestedset->add('bar');
     $result = $nestedset->move(2, 1);
     $this->assertTrue($result);
     $expected_result = '[{"id":"1","name":"foo","lft":"1","rgt":"4","depth":"0","children":[{"id":"2","name":"bar","lft":"2","rgt":"3","depth":"1","children":[]}]}]';
     $this->assertEquals($nestedset->toJson(), $expected_result);
 }