getEntityManager(); $categoryRepo = self::getContainer()->get(CGroupCategoryRepository::class); $courseRepo = self::getContainer()->get(CourseRepository::class); $course = $this->createCourse('new'); $teacher = $this->createUser('teacher'); $category = (new CGroupCategory()) ->setTitle('category') ->setParent($course) ->setCreator($teacher) ->setDescription('desc') ->setSelfRegAllowed(true) ->setSelfUnregAllowed(true) ->setAnnouncementsState(true) ->setCalendarState(true) ->setChatState(true) ->setDocState(true) ->setDocumentAccess(1) ->setForumState(true) ->setWikiState(true) ->setWorkState(true) ->setGroupsPerUser(10) ->setMaxStudent(100) ; $this->assertHasNoEntityViolations($category); $em->persist($category); $em->flush(); $this->assertSame(1, $categoryRepo->count([])); $categoryRepo->delete($category); $this->assertSame(0, $categoryRepo->count([])); $this->assertSame(1, $courseRepo->count([])); } }