getEntityManager(); $glossaryRepo = self::getContainer()->get(CGlossaryRepository::class); $courseRepo = self::getContainer()->get(CourseRepository::class); $course = $this->createCourse('new'); $teacher = $this->createUser('teacher'); $glossary = (new CGlossary()) ->setName('glossary') ->setDescription('desc') ->setDisplayOrder(1) ->setParent($course) ->setCreator($teacher) ->addCourseLink($course) ; $this->assertHasNoEntityViolations($glossary); $em->persist($glossary); $em->flush(); $this->assertSame('glossary', (string) $glossary); $this->assertSame($glossary->getResourceIdentifier(), $glossary->getIid()); $router = $this->getContainer()->get(RouterInterface::class); $link = $glossaryRepo->getLink($glossary, $router); $this->assertSame($link, '/main/glossary/index.php?glossary_id='.$glossary->getIid()); $this->assertSame(1, $glossaryRepo->count([])); $courseRepo->delete($course); $this->assertSame(0, $courseRepo->count([])); $this->assertSame(0, $glossaryRepo->count([])); } }