setUpDb([LoadBaseData::class]); $this->repository = $this->em->getRepository(Author::class); } public function testGetOrCreate() { $this->assertCount(1, $this->repository->findAll()); $author = $this->repository->getOrCreate('Author'); $this->repository->save($author); $this->assertCount(1, $this->repository->findAll()); $author = $this->repository->getOrCreate('Author2'); $this->repository->save($author); $this->assertCount(2, $this->repository->findAll()); } }