Doctrine 2 - ORM
  1. Doctrine 2 - ORM
  2. DDC-2657

"Call to a member function bindValue() on a non-object" error when unittesting repository

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Invalid
    • Affects Version/s: 2.3.4
    • Fix Version/s: None
    • Component/s: ORM
    • Security Level: All
    • Labels:

      Description

      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.

        Activity

        Hide
        Benjamin Eberlei added a comment -

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

        Show
        Benjamin Eberlei added a comment - The OrmTestCase and the mocks in the Doctrine Test code is not for reuse.
        Hide
        Tomáš Lembacher added a comment -

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

        Show
        Tomáš Lembacher added a comment - Is there any recommendation how to create unit tests for entity repository then?

          People

          • Assignee:
            Benjamin Eberlei
            Reporter:
            Tomáš Lembacher
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: