Moodle
  1. Moodle
  2. MDL-38582

Allow any component to have a test data generator

    Details

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

      Description

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

        Activity

        Hide
        Tim Hunt added a comment -

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

        Show
        Tim Hunt added a comment - Petr, it would be great if you could take a look at this. Thanks
        Hide
        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
        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
        Petr Škoda added a comment - - edited

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

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

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

        Show
        Tim Hunt added a comment - Thanks to Petr for catching my stupid mistakes. Submitting for integration now.
        Hide
        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 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
        Tim Hunt added a comment -

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

        Show
        Tim Hunt added a comment - Rebased, so now safe to build on for next week.
        Hide
        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
        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
        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
        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
        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
        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
        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
        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
        Eloy Lafuente (stronk7) added a comment -

        Integrated, thanks!

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

        passed, on behalf of CI servers.

        Show
        Eloy Lafuente (stronk7) added a comment - passed, on behalf of CI servers.
        Hide
        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 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
        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: