-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
EntityManager: add setRepository() method #1
Conversation
EntityManager::clear() resets all initialized repositories too
imho rejected. It only blows up the API. You have to mock the entity manager for this, and testing proxy calls is nothing you should do. Proxies are a Doctrine feature, tested by doctrine, you should only functinoally test them. |
Sorry, not D2 proxy. See: $author->getArticles() { return $this->getEntityManager() ->getRepository('ArticleRepository') ->findActiveByAuthor($this); } |
I won't merge this. Adding setRepository() serves no other purpose than for testing reasons, yet there are other solutions. You could also just mock the entity manager and have it return the repository mock. Its a bit more difficult, but thats a problem of the PHPUnit Mock complexity. |
Ok, I'll try another ways. Thanks. |
Incorrect @throws doc. in getSingleScalarResult
Goal is to have opportunity to set mocked repo.