getManager(); $repo = self::getContainer()->get(CLpRepository::class); $course = $this->createCourse('new'); $teacher = $this->createUser('teacher'); $item = (new CLp()) ->setName('lp') ->setParent($course) ->setCreator($teacher) ->setLpType(CLp::LP_TYPE) ; $this->assertHasNoEntityViolations($item); $em->persist($item); $em->flush(); $this->assertSame('lp', (string) $item); $this->assertSame(1, $repo->count([])); } }