Skip to content

Skip repository mocking in NoDocumentMockingRule - #367

Closed
TomasVotruba wants to merge 1 commit into
mainfrom
skip-repository-mocking
Closed

TomasVotruba wants to merge 1 commit into
mainfrom
skip-repository-mocking

Conversation

@TomasVotruba

Copy link
Copy Markdown
Member

NoDocumentMockingRule matches mocked classes by the \Entity\ and \Document\ namespace. Repositories live in that same namespace (e.g. App\Entity\UserRepository), so their mocks were flagged too.

Unlike entities, repositories cannot be created directly - they need an EntityManager and a database connection. Skip classes implementing Doctrine\Persistence\ObjectRepository (the base interface of both ORM and ODM repositories).

Added a test fixture mocking a repository and a stub for Doctrine\Persistence\ObjectRepository.

Repositories live in the Entity/Document namespace, so the namespace-based
check flagged repository mocks too. Repositories cannot be created directly
without a database, so skip classes implementing Doctrine ObjectRepository.
@TomasVotruba

Copy link
Copy Markdown
Member Author

Superseded by #372, which was merged to main and already skips Doctrine repositories in NoDocumentMockingRule. Closing as duplicate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant