public function testShiftLevel() { $section1 = $this->repository->find('section1'); $section2 = $this->repository->find('section2'); $page1 = $this->repository->find('page1'); $page2 = $this->repository->find('page2'); $page3 = $this->repository->find('page3'); $this->assertEquals($this->repository, $this->invokeMethod($this->repository, 'shiftLevel', array($page3, 1, true))); self::$em->refresh($page3); $this->assertEquals(1, $page3->getLevel()); $this->assertEquals($this->repository, $this->invokeMethod($this->repository, 'shiftLevel', array($page3, 1, false))); self::$em->refresh($page3); $this->assertEquals(2, $page3->getLevel()); $this->invokeMethod($this->repository, 'shiftLevel', array($this->root, 2)); foreach ($this->repository->findAll() as $node) { self::$em->refresh($node); } $this->assertEquals(2, $this->root->getLevel()); $this->assertEquals(3, $section1->getLevel()); $this->assertEquals(3, $section2->getLevel()); $this->assertEquals(4, $page1->getLevel()); $this->assertEquals(4, $page2->getLevel()); $this->assertEquals(4, $page3->getLevel()); $this->invokeMethod($this->repository, 'shiftLevel', array($this->root, -2, true)); foreach ($this->repository->findAll() as $node) { self::$em->refresh($node); } $this->assertEquals(2, $this->root->getLevel()); $this->assertEquals(1, $section1->getLevel()); $this->assertEquals(1, $section2->getLevel()); $this->assertEquals(2, $page1->getLevel()); $this->assertEquals(2, $page2->getLevel()); $this->assertEquals(2, $page3->getLevel()); }