Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-38582

Allow any component to have a test data generator

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.5
    • Fix Version/s: 2.5
    • Component/s: Unit tests
    • Labels:

      Description

      There is no reason to limit it to just blocks and mods.

        Gliffy Diagrams

          Activity

          Hide
          timhunt Tim Hunt added a comment -

          Petr, it would be great if you could take a look at this. Thanks

          Show
          timhunt Tim Hunt added a comment - Petr, it would be great if you could take a look at this. Thanks
          Hide
          timhunt Tim Hunt added a comment -

          Note that I think my new combine_defaults_and_record method makes most of the individual generator methods much nicer to read. (I had already written the quiz generator like that). We really ought to convert all the existing methods to use it.

          Show
          timhunt Tim Hunt added a comment - Note that I think my new combine_defaults_and_record method makes most of the individual generator methods much nicer to read. (I had already written the quiz generator like that). We really ought to convert all the existing methods to use it.
          Hide
          skodak Petr Skoda added a comment - - edited

          thanks for fixing the remaining minor issues, +1 for integration

          Show
          skodak Petr Skoda added a comment - - edited thanks for fixing the remaining minor issues, +1 for integration
          Hide
          timhunt Tim Hunt added a comment -

          Thanks to Petr for catching my stupid mistakes. Submitting for integration now.

          Show
          timhunt Tim Hunt added a comment - Thanks to Petr for catching my stupid mistakes. Submitting for integration now.
          Hide
          damyon Damyon Wiese added a comment -

          The main moodle.git repository has just been updated with latest weekly modifications. You may wish to rebase your PULL branches to simplify history and avoid any possible merge conflicts. This would also make integrator's life easier next week.

          Thanks!

          Show
          damyon Damyon Wiese added a comment - The main moodle.git repository has just been updated with latest weekly modifications. You may wish to rebase your PULL branches to simplify history and avoid any possible merge conflicts. This would also make integrator's life easier next week. Thanks!
          Hide
          timhunt Tim Hunt added a comment -

          Rebased, so now safe to build on for next week.

          Show
          timhunt Tim Hunt added a comment - Rebased, so now safe to build on for next week.
          Hide
          stronk7 Eloy Lafuente (stronk7) added a comment -

          Hey, Tim... could you comment here what's pending to proceed with conversion of existing generators to this? Surely will be something for 2.6... but better if we have it already defined.

          Ciao

          Show
          stronk7 Eloy Lafuente (stronk7) added a comment - Hey, Tim... could you comment here what's pending to proceed with conversion of existing generators to this? Surely will be something for 2.6... but better if we have it already defined. Ciao
          Hide
          timhunt Tim Hunt added a comment -

          What existing generators are you thinking of Eloy?

          If you mean the question ones, then I was not planning to change them, just use them. The standard generator framework is about adding data to the DB, the existing question generators generate data-structures in memory.

          https://github.com/timhunt/moodle/commit/d2fce961325680fe9e60575cd2f6d6be6b2ee0a0#diff-2 is what i am doing in another bug. In future, I may clean this up further, but any API change in the existing generators would affect all contrib types, so it has to be worth the pain caused.

          Show
          timhunt Tim Hunt added a comment - What existing generators are you thinking of Eloy? If you mean the question ones, then I was not planning to change them, just use them. The standard generator framework is about adding data to the DB, the existing question generators generate data-structures in memory. https://github.com/timhunt/moodle/commit/d2fce961325680fe9e60575cd2f6d6be6b2ee0a0#diff-2 is what i am doing in another bug. In future, I may clean this up further, but any API change in the existing generators would affect all contrib types, so it has to be worth the pain caused.
          Hide
          timhunt Tim Hunt added a comment -

          By the way, I disagree with you API-change label. The existing API has not changed. I a new API has been added in a backwards-compatible way, so I think it should only be dev-docs-required.

          Show
          timhunt Tim Hunt added a comment - By the way, I disagree with you API-change label. The existing API has not changed. I a new API has been added in a backwards-compatible way, so I think it should only be dev-docs-required.
          Hide
          stronk7 Eloy Lafuente (stronk7) added a comment -

          Wow, I'm not sure how the hell I looked yesterday to your patch, but I miss-read it completely.

          In fact what inspired my comment is that I searched for "lib.php", somehow it returned not results for current generators and I assumed it was a completely new thing.

          Then today, I've looked again and, bump, the libs are there, lol. So sorry for the noise, will re-look tho this properly along the day. Thanks!

          Show
          stronk7 Eloy Lafuente (stronk7) added a comment - Wow, I'm not sure how the hell I looked yesterday to your patch, but I miss-read it completely. In fact what inspired my comment is that I searched for "lib.php", somehow it returned not results for current generators and I assumed it was a completely new thing. Then today, I've looked again and, bump, the libs are there, lol. So sorry for the noise, will re-look tho this properly along the day. Thanks!
          Hide
          stronk7 Eloy Lafuente (stronk7) added a comment -

          Integrated, thanks!

          Show
          stronk7 Eloy Lafuente (stronk7) added a comment - Integrated, thanks!
          Hide
          stronk7 Eloy Lafuente (stronk7) added a comment -

          passed, on behalf of CI servers.

          Show
          stronk7 Eloy Lafuente (stronk7) added a comment - passed, on behalf of CI servers.
          Hide
          damyon Damyon Wiese added a comment -

          Thanks for your hard work. This issue has been integrated upstream and is now available via git (and in some hours, via mirrors and downloads).

          Show
          damyon Damyon Wiese added a comment - Thanks for your hard work. This issue has been integrated upstream and is now available via git (and in some hours, via mirrors and downloads).
          Show
          timhunt Tim Hunt added a comment - Dev docs added at http://docs.moodle.org/dev/Writing_PHPUnit_tests#Other_types_of_plugin .

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                14/May/13