get('doctrine.orm.default_entity_manager'); $this->userSourceDirectorService = new UserSourceDirectorService($entityManager, $security); } public function testGuestUser(): void { $user = $this->userSourceDirectorService->getUser(); $this->assertInstanceOf(User::class, $user); $this->assertInstanceOf(SourceInterface::class, $user->getSource()); } }