/** * Sets up the fixture. */ public function setUp() { self::$em->clear(); self::$kernel->resetDatabase([self::$em->getClassMetaData('BackBee\\NestedNode\\Tests\\Mock\\MockNestedNode')]); $this->root = new MockNestedNode('root'); self::$em->persist($this->root); self::$em->flush($this->root); $child1 = $this->repository->insertNodeAsLastChildOf(new MockNestedNode('child1'), $this->root); self::$em->persist($child1); self::$em->flush($child1); }
/** * Initiate a new tree with node added as last child. * * @return \BackBee\NestedNode\Tests\Repository\NestedNodeRepositoryTest */ private function setRootAsc() { $this->root_asc = new MockNestedNode('a-root'); self::$em->persist($this->root_asc); self::$em->flush($this->root_asc); $child1 = $this->repository->insertNodeAsLastChildOf(new MockNestedNode('a-child1'), $this->root_asc); self::$em->flush($child1); $child2 = $this->repository->insertNodeAsLastChildOf(new MockNestedNode('a-child2'), $this->root_asc); self::$em->flush($child2); self::$em->refresh($child1); $subchild1 = $this->repository->insertNodeAsLastChildOf(new MockNestedNode('a-subchild1'), $child1); self::$em->flush($subchild1); $this->repository->insertNodeAsLastChildOf(new MockNestedNode('a-subchild2'), $child1); self::$em->flush(); self::$em->refresh($this->root_asc); self::$em->refresh($child2); self::$em->refresh($subchild1); return $this; }