public function testMoveSampleMenuToNewRoot()
 {
     $newRoot = new TestMenuItem("newRoot", $this->getMock('Knp\\Menu\\FactoryInterface'));
     $newRoot->addChild($this->menu);
     $this->assertEquals(1, $this->menu->getLevel());
     $this->assertEquals(2, $this->pt1->getLevel());
     $this->assertSame($newRoot, $this->menu->getRoot());
     $this->assertSame($newRoot, $this->pt1->getRoot());
     $this->assertFalse($this->menu->isRoot());
     $this->assertTrue($newRoot->isRoot());
     $this->assertSame($newRoot, $this->menu->getParent());
 }
예제 #2
0
 public function testMoveSampleMenuToNewRoot()
 {
     extract($this->getSampleTree());
     $newRoot = new TestMenuItem("newRoot");
     $newRoot->addChild($menu);
     $this->assertEquals(1, $menu->getLevel());
     $this->assertEquals(2, $pt1->getLevel());
     $this->assertEquals($newRoot, $menu->getRoot());
     $this->assertEquals($newRoot, $pt1->getRoot());
     $this->assertFalse($menu->isRoot());
     $this->assertTrue($newRoot->isRoot());
     $this->assertEquals($newRoot, $menu->getParent());
 }