public function setUp()
 {
     parent::setUp();
     // ################################################ Basic Details
     $user = new User();
     $user->setEmail("*****@*****.**");
     $user->setUsername("test");
     $user->setPassword("ouhosu");
     $this->em->persist($user);
     $tree = new Tree();
     $tree->setTitleAdmin('Tree');
     $tree->setPublicId('tree');
     $tree->setOwner($user);
     $this->em->persist($tree);
     $treeVersion = new TreeVersion();
     $treeVersion->setTree($tree);
     $treeVersion->setPublicId('version');
     $treeVersion->setFeatureLibraryContent(true);
     $treeVersion->setFeatureVariables(true);
     $this->em->persist($treeVersion);
     // ################################################ Variable
     $variable = new Variable();
     $variable->setTreeVersion($treeVersion);
     $variable->setName('score');
     $variable->setType('Integer');
     $this->em->persist($variable);
     // ################################################ Nodes
     $startNode = new Node();
     $startNode->setTreeVersion($treeVersion);
     $startNode->setTitle("START HERE");
     $startNode->setPublicId('start');
     $this->em->persist($startNode);
     $endNode = new Node();
     $endNode->setTreeVersion($treeVersion);
     $endNode->setTitle("END HERE");
     $endNode->setPublicId('end');
     $this->em->persist($endNode);
     // ################################################ Node option for points with variable action
     $nodeOptionPoints = new NodeOption();
     $nodeOptionPoints->setTitle("POINTS");
     $nodeOptionPoints->setTreeVersion($treeVersion);
     $nodeOptionPoints->setNode($startNode);
     $nodeOptionPoints->setDestinationNode($endNode);
     $nodeOptionPoints->setSort(10);
     $nodeOptionPoints->setPublicId('points');
     $this->em->persist($nodeOptionPoints);
     $nodeOptionPointsAction = new NodeOptionVariableAction();
     $nodeOptionPointsAction->setNodeOption($nodeOptionPoints);
     $nodeOptionPointsAction->setVariable($variable);
     $nodeOptionPointsAction->setValue(10);
     $nodeOptionPointsAction->setAction('assign');
     $this->em->persist($nodeOptionPointsAction);
     // ################################################ Node option for no points
     $nodeOptionNoPoints = new NodeOption();
     $nodeOptionNoPoints->setTitle("NO POINTS");
     $nodeOptionNoPoints->setTreeVersion($treeVersion);
     $nodeOptionNoPoints->setNode($startNode);
     $nodeOptionNoPoints->setDestinationNode($endNode);
     $nodeOptionNoPoints->setPublicId('nopoints');
     $nodeOptionNoPoints->setSort(100);
     $this->em->persist($nodeOptionNoPoints);
     // ################################################ Library Content for points
     $libraryContentPoints = new LibraryContent();
     $libraryContentPoints->setTreeVersion($treeVersion);
     $libraryContentPoints->setBodyText('POINTS');
     $this->em->persist($libraryContentPoints);
     $nodeHasLibraryContentPoints = new NodeHasLibraryContent();
     $nodeHasLibraryContentPoints->setSort(0);
     $nodeHasLibraryContentPoints->setNode($endNode);
     $nodeHasLibraryContentPoints->setLibraryContent($libraryContentPoints);
     $this->em->persist($nodeHasLibraryContentPoints);
     $nodeHasLibraryContentPointsIfVariable = new NodeHasLibraryContentIfVariable();
     $nodeHasLibraryContentPointsIfVariable->setPublicId('points');
     $nodeHasLibraryContentPointsIfVariable->setLibraryContent($libraryContentPoints);
     $nodeHasLibraryContentPointsIfVariable->setNode($endNode);
     $nodeHasLibraryContentPointsIfVariable->setVariable($variable);
     $nodeHasLibraryContentPointsIfVariable->setAction('>');
     $nodeHasLibraryContentPointsIfVariable->setValue(0);
     $this->em->persist($nodeHasLibraryContentPointsIfVariable);
     // ################################################ Library Content for NO points
     $libraryContentNoPoints = new LibraryContent();
     $libraryContentNoPoints->setTreeVersion($treeVersion);
     $libraryContentNoPoints->setBodyText('NO POINTS');
     $this->em->persist($libraryContentNoPoints);
     $nodeHasLibraryContentNoPoints = new NodeHasLibraryContent();
     $nodeHasLibraryContentNoPoints->setSort(0);
     $nodeHasLibraryContentNoPoints->setNode($endNode);
     $nodeHasLibraryContentNoPoints->setLibraryContent($libraryContentNoPoints);
     $this->em->persist($nodeHasLibraryContentNoPoints);
     $nodeHasLibraryContentNoPointsIfVariable = new NodeHasLibraryContentIfVariable();
     $nodeHasLibraryContentNoPointsIfVariable->setPublicId('nopoints');
     $nodeHasLibraryContentNoPointsIfVariable->setLibraryContent($libraryContentNoPoints);
     $nodeHasLibraryContentNoPointsIfVariable->setNode($endNode);
     $nodeHasLibraryContentNoPointsIfVariable->setVariable($variable);
     $nodeHasLibraryContentNoPointsIfVariable->setAction('==');
     $nodeHasLibraryContentNoPointsIfVariable->setValue(0);
     $this->em->persist($nodeHasLibraryContentNoPointsIfVariable);
     // ################################################ MISC
     $treeVersionPublished = new TreeVersionPublished();
     $treeVersionPublished->setTreeVersion($treeVersion);
     $treeVersionPublished->setPublishedBy($user);
     $this->em->flush();
     $tvsn = new TreeVersionStartingNode();
     $tvsn->setNode($startNode);
     $tvsn->setTreeVersion($treeVersion);
     $this->em->persist($tvsn);
     $published = new TreeVersionPublished();
     $published->setTreeVersion($treeVersion);
     $this->em->persist($published);
     $this->em->flush();
 }