DDC-2657: "Call to a member function bindValue() on a non-object" error when unittesting repository #3334

Closed
opened 2026-01-22 14:18:10 +01:00 by admin · 3 comments
Owner

Originally created by @doctrinebot on GitHub (Sep 6, 2013).

Originally assigned to: @beberlei on GitHub.

Jira issue originally created by user arron:

When trying to test repository, after creating all mocks wit the help of OrmTestCase, I run into error "Call to a member function bindValue() on a non-object". It is caused by empty method prepare() in DriverConnectionMock. This method returns nothing and introducing NULL value on which bindValue() method is called later. Possible solution is to return new instance of StatementMock() class from prepare() method.

Originally created by @doctrinebot on GitHub (Sep 6, 2013). Originally assigned to: @beberlei on GitHub. Jira issue originally created by user arron: When trying to test repository, after creating all mocks wit the help of OrmTestCase, I run into error "Call to a member function bindValue() on a non-object". It is caused by empty method prepare() in DriverConnectionMock. This method returns nothing and introducing NULL value on which bindValue() method is called later. Possible solution is to return new instance of StatementMock() class from prepare() method.
admin added the Bug label 2026-01-22 14:18:10 +01:00
admin closed this issue 2026-01-22 14:18:11 +01:00
Author
Owner

@doctrinebot commented on GitHub (Sep 8, 2013):

Comment created by @beberlei:

The OrmTestCase and the mocks in the Doctrine Test code is not for reuse.

@doctrinebot commented on GitHub (Sep 8, 2013): Comment created by @beberlei: The OrmTestCase and the mocks in the Doctrine Test code is not for reuse.
Author
Owner

@doctrinebot commented on GitHub (Sep 8, 2013):

Issue was closed with resolution "Invalid"

@doctrinebot commented on GitHub (Sep 8, 2013): Issue was closed with resolution "Invalid"
Author
Owner

@doctrinebot commented on GitHub (Sep 8, 2013):

Comment created by arron:

Is there any recommendation how to create unit tests for entity repository then?

@doctrinebot commented on GitHub (Sep 8, 2013): Comment created by arron: Is there any recommendation how to create unit tests for entity repository then?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#3334