/** * @covers \BackBee\NestedNode\Repository\NestedNodeRepository::moveAsLastChildOf */ public function testMoveAsLastChildOf() { $source = $this->repository->find('d-child2'); $target = $this->repository->find('d-child1'); $this->repository->moveAsLastChildOf($source, $target); self::$em->flush(); self::$em->clear(); $this->root_desc = $this->repository->find('d-root'); $dchild1 = $this->repository->find('d-child1'); $dsubchild1 = $this->repository->find('d-subchild1'); $dsubchild2 = $this->repository->find('d-subchild2'); $dchild2 = $this->repository->find('d-child2'); $this->assertEquals(1, $this->root_desc->getLeftnode()); $this->assertEquals(2, $dchild1->getLeftnode()); $this->assertEquals(3, $dsubchild2->getLeftnode()); $this->assertEquals(4, $dsubchild2->getRightnode()); $this->assertEquals(5, $dsubchild1->getLeftnode()); $this->assertEquals(6, $dsubchild1->getRightnode()); $this->assertEquals(7, $dchild2->getLeftnode()); $this->assertEquals(8, $dchild2->getRightnode()); $this->assertEquals(9, $dchild1->getRightnode()); $this->assertEquals(10, $this->root_desc->getRightnode()); $this->assertEquals($dchild1, $dchild2->getParent()); $this->assertEquals(2, $dchild2->getLevel()); }
/** * @covers BackBee\NestedNode\AbstractNestedNode::setLeftnode */ public function testSetLeftnode() { $this->assertEquals($this->mock, $this->mock->setLeftnode(2)); $this->assertEquals(2, $this->mock->getLeftnode()); }