Details

    • Type: Sub-task Sub-task
    • Status: Development in progress
    • Priority: Minor Minor
    • Resolution: Unresolved
    • Affects Version/s: 2.0, 2.3.2
    • Fix Version/s: DEV backlog
    • Component/s: Portfolio API
    • Labels:
    • Affected Branches:
      MOODLE_20_STABLE, MOODLE_23_STABLE
    • Rank:
      15450

      Description

      Create Unit tests for portfolio API

        Issue Links

          Activity

          Nicolas Connault created issue -
          Nicolas Connault made changes -
          Field Original Value New Value
          Status Open [ 1 ] In Progress [ 3 ]
          Penny Leach made changes -
          Link This issue has a non-specific relationship to MDL-16120 [ MDL-16120 ]
          Hide
          Penny Leach added a comment -

          things i can think of we need to test

          portfolio plugins
          ----------------------

          • prepare_package returns true
          • send_package returns true

          callers
          ----------

          • sha1 is consistent from the start to finish (i notice that some places seem to be affected by prepare_package calling functions that pass by reference and modify things)
          • prepare_package returns true

          general
          -----------

          • objects get constructed without errors happening
          • can we test forms? there are three forms that are generated (admin config, user config and export config (combined portfolio and caller form elements) - and the form handling code relies on get_{$type}_allowed_config or something when it passes the values back to either the caller or plugin. that would be good to test
          • I am thinking we need to change some places to throw exceptions. there are todos everywhere for this - I didn't do it at the time because petr and i couldn't agree on exception handling. in particular constructors should throw exceptions. We need whatever catches exceptions related to portfolios to call portfolio_exporter::raise_error to clear out the session and tempdata, which means passing the exporter object to the exception constructor.
          Show
          Penny Leach added a comment - things i can think of we need to test portfolio plugins ---------------------- prepare_package returns true send_package returns true callers ---------- sha1 is consistent from the start to finish (i notice that some places seem to be affected by prepare_package calling functions that pass by reference and modify things) prepare_package returns true general ----------- objects get constructed without errors happening can we test forms? there are three forms that are generated (admin config, user config and export config (combined portfolio and caller form elements) - and the form handling code relies on get_{$type}_allowed_config or something when it passes the values back to either the caller or plugin. that would be good to test I am thinking we need to change some places to throw exceptions. there are todos everywhere for this - I didn't do it at the time because petr and i couldn't agree on exception handling. in particular constructors should throw exceptions. We need whatever catches exceptions related to portfolios to call portfolio_exporter::raise_error to clear out the session and tempdata, which means passing the exporter object to the exception constructor.
          Hide
          Penny Leach added a comment -

          Nico - the one I really think is important to have is:

          callers
          ----------

          • sha1 is consistent from the start to finish (i notice that some places seem to be affected by prepare_package calling functions that pass by reference and modify things)

          as that's going to keep biting people as they add portfolio export buttons to pages in moodle (I can see this happening far more rapidly than people writing new plugins)

          Show
          Penny Leach added a comment - Nico - the one I really think is important to have is: callers ---------- sha1 is consistent from the start to finish (i notice that some places seem to be affected by prepare_package calling functions that pass by reference and modify things) as that's going to keep biting people as they add portfolio export buttons to pages in moodle (I can see this happening far more rapidly than people writing new plugins)
          Hide
          Penny Leach added a comment -

          nico can you comment on this bug when you resolved the issues we talked about this morning:

          1. unit tests dying with no php error (and no buffer flush to see how far it got)
          2. being able to run all portfolio related tests from one directory (you talked about linking or something)

          i got distracted by MDL-16360 today but am back to testing on monday.

          Show
          Penny Leach added a comment - nico can you comment on this bug when you resolved the issues we talked about this morning: 1. unit tests dying with no php error (and no buffer flush to see how far it got) 2. being able to run all portfolio related tests from one directory (you talked about linking or something) i got distracted by MDL-16360 today but am back to testing on monday.
          Hide
          Penny Leach added a comment -

          problems:

          1. the glossary tests seems to be silently dying. i wonder if it's in an infinite loop. it's hard to debug.
          2. main portfoliotest has: require_once($CFG->dirroot . '/mod/forum/simpletest/test_forum_portfolio_callers.php'); which doesn't exist. The following might be a better approach:

          // Load tests for various modules
          require_once($CFG>dirroot . '/mod/forum/simpletest/test_forum_portfolio_callers.php');
          require_once($CFG>dirroot . '/mod/glossary/simpletest/test_glossary_portfolio_callers.php');
          require_once($CFG>dirroot . '/mod/assignment/simpletest/test_assignment_portfolio_callers.php');
          +foreach (get_list_of_plugins('mod') as $module) {
          + $modtest = $CFG->dirroot . '/mod/' . $module . '/simpletest/test_' . $module . '_portfolio_callers.php';
          + if (file_exists($modtest))

          { + require_once($modtest); + }

          +}

          Show
          Penny Leach added a comment - problems: 1. the glossary tests seems to be silently dying. i wonder if it's in an infinite loop. it's hard to debug. 2. main portfoliotest has: require_once($CFG->dirroot . '/mod/forum/simpletest/test_forum_portfolio_callers.php'); which doesn't exist. The following might be a better approach: // Load tests for various modules require_once($CFG >dirroot . '/mod/forum/simpletest/test_forum_portfolio_callers.php'); require_once($CFG >dirroot . '/mod/glossary/simpletest/test_glossary_portfolio_callers.php'); require_once($CFG >dirroot . '/mod/assignment/simpletest/test_assignment_portfolio_callers.php'); +foreach (get_list_of_plugins('mod') as $module) { + $modtest = $CFG->dirroot . '/mod/' . $module . '/simpletest/test_' . $module . '_portfolio_callers.php'; + if (file_exists($modtest)) { + require_once($modtest); + } +}
          Martin Dougiamas made changes -
          Assignee Nicolas Connault [ nicolasconnault ] moodle.com [ moodle.com ]
          Martin Dougiamas made changes -
          Workflow jira [ 27466 ] MDL Workflow [ 47563 ]
          Martin Dougiamas made changes -
          Workflow MDL Workflow [ 47563 ] MDL Full Workflow [ 76640 ]
          Dan Poltawski made changes -
          Summary Create Unit test framework Create Unit tests for portfolio API
          Fix Version/s DEV backlog [ 10464 ]
          Priority Major [ 3 ] Minor [ 4 ]
          Description Create Unit tests for portfolio API
          Labels triaged
          Affects Version/s 2.3.2 [ 12353 ]

            People

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

              Dates

              • Created:
                Updated: