示例#1
0
 /**
  * test that node() doesn't dig deeper than it should.
  *
  * @return void
  */
 public function testNodeWithDuplicatePathSegments()
 {
     $Aco = new DbAcoTest();
     $nodes = $Aco->node('ROOT/Users');
     $this->assertEquals($nodes[0]['DbAcoTest']['parent_id'], 1, 'Parent id does not point at ROOT. %s');
 }
示例#2
0
 /**
  * testNode method
  *
  * @access public
  * @return void
  */
 function testNode()
 {
     $Aco = new DbAcoTest();
     $result = Set::extract($Aco->node('Controller1'), '{n}.DbAcoTest.id');
     $expected = array(2, 1);
     $this->assertEqual($result, $expected);
     $result = Set::extract($Aco->node('Controller1/action1'), '{n}.DbAcoTest.id');
     $expected = array(3, 2, 1);
     $this->assertEqual($result, $expected);
     $result = Set::extract($Aco->node('Controller2/action1'), '{n}.DbAcoTest.id');
     $expected = array(7, 6, 1);
     $this->assertEqual($result, $expected);
     $result = Set::extract($Aco->node('Controller1/action2'), '{n}.DbAcoTest.id');
     $expected = array(5, 2, 1);
     $this->assertEqual($result, $expected);
     $result = Set::extract($Aco->node('Controller1/action1/record1'), '{n}.DbAcoTest.id');
     $expected = array(4, 3, 2, 1);
     $this->assertEqual($result, $expected);
     $result = Set::extract($Aco->node('Controller2/action1/record1'), '{n}.DbAcoTest.id');
     $expected = array(8, 7, 6, 1);
     $this->assertEqual($result, $expected);
     $result = Set::extract($Aco->node('Controller2/action3'), '{n}.DbAcoTest.id');
     $this->assertFalse($result);
     $result = Set::extract($Aco->node('Controller2/action3/record5'), '{n}.DbAcoTest.id');
     $this->assertFalse($result);
     $result = $Aco->node('');
     $this->assertEqual($result, null);
 }