Doctrine 1
  1. Doctrine 1
  2. DC-73

TestCase framework normally uses identityMap for records created in prepareData() what can cause side effects

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: 1.1.4
    • Fix Version/s: 1.2.0-BETA1
    • Component/s: None
    • Labels:
      None

      Description

      All new records are stored in the identityMap during insertion. This default behavior takes place also while executing test cases.

      In other words every record created in the prepareData() method gets to the identityMap. Afterwards, in a test method, it is silently retrived from identityMap instead of (expected!) quering from sqlite.

      IMHO a testing environment should be as pure as possible and no such side effects are acceptable.

      I'm including a test case and patch for Doctrine_UnitTestCase. After putting the patch, I have found that 2 test cases causes fail: 1449 and 736. In the first test IMHO there is a problem in a content test - I'm including appropriate fix.
      It seems that the second test, in fact, have never been passing. I think that positive result was caused by the side effect of identityMap.

      1. DC73-full.patch
        1 kB
        Jacek Dębowczyk
      2. DC73TestCase.php
        2 kB
        Jacek Dębowczyk

        Activity

        Hide
        Jonathan H. Wage added a comment -

        This breaks the 1.2 test suite. Can you retry your patch?

        Show
        Jonathan H. Wage added a comment - This breaks the 1.2 test suite. Can you retry your patch?
        Hide
        Jacek Dębowczyk added a comment -

        Yes, the patch breaks 2 test cases: 1449 and 736.
        I explained it above in the ticket description.

        Show
        Jacek Dębowczyk added a comment - Yes, the patch breaks 2 test cases: 1449 and 736. I explained it above in the ticket description.
        Hide
        Jonathan H. Wage added a comment -

        Does your patch fix those 2 failing test cases now?

        Show
        Jonathan H. Wage added a comment - Does your patch fix those 2 failing test cases now?
        Hide
        Jacek Dębowczyk added a comment -

        Ok, now I'm including a patch that also fixes both test cases and causes all 1.2 tests passes.

        Show
        Jacek Dębowczyk added a comment - Ok, now I'm including a patch that also fixes both test cases and causes all 1.2 tests passes.

          People

          • Assignee:
            Jonathan H. Wage
            Reporter:
            Jacek Dębowczyk
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: