public function setUp() { parent::setUp(); $user1 = new CmsUser(); $user1->username = "******"; $user1->name = "Benjamin"; $user1->status = "active"; $group1 = new CmsGroup(); $group1->name = "test"; $group2 = new CmsGroup(); $group2->name = "test"; $user1->addGroup($group1); $user1->addGroup($group2); $user2 = new CmsUser(); $user2->username = "******"; $user2->name = "Roman"; $user2->status = "active"; $this->dm->persist($user1); $this->dm->persist($user2); $this->dm->persist($group1); $this->dm->persist($group2); $this->dm->flush(); $this->dm->clear(); $this->user1 = $this->dm->find(get_class($user1), $user1->id); $this->user2 = $this->dm->find(get_class($user1), $user2->id); }