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

Bad code in many 'should not' rules in behat_general.php

XMLWordPrintable

    • MOODLE_27_STABLE, MOODLE_28_STABLE
    • MOODLE_27_STABLE, MOODLE_28_STABLE
    • Hide

      This really needs to be tested together with MDL-49445

      1. Pull the latest MDL-40990 code.
      2. Edit mod/quiz/tests/behat/editing_require_previous.feature, the scenario "Question dependency cannot apply to quizzes where the questions are shuffled so UI is hidden" that starts around like 120
      3. Change shufflequestions to 0, so the test should fail.
      4. Run that senario, and verify that Behat reports the failure

      (Until I had fixed this, and #MDL-49445, it would not fail.)

      Show
      This really needs to be tested together with MDL-49445 Pull the latest MDL-40990 code. Edit mod/quiz/tests/behat/editing_require_previous.feature, the scenario "Question dependency cannot apply to quizzes where the questions are shuffled so UI is hidden" that starts around like 120 Change shufflequestions to 0, so the test should fail. Run that senario, and verify that Behat reports the failure (Until I had fixed this, and # MDL-49445 , it would not fail.)

      There is lots of code like

              try {
                  $this->row_column_of_table_should_contain($row, $column, $table, $value);
                  // Throw exception if found.
                  throw new ExpectationException(
                      '"' . $column . '" with value "' . $value . '" is present in "' . $row . '"  row for table "' . $table . '"',
                      $this->getSession()
                  );
              } catch (ElementNotFoundException $e) {
                  // Table row/column doesn't contain this value. Nothing to do.
                  return;
              }
      

      This does not work as intended, because the thrown exceptoin is immediately caught again.

      Actually, that one is OK, since the two exceptoin types are different, but other ones were wrong, and the pattern is dangerous, in case anyone changes the exception types in future. I will fix them all, even the ones that are not broken.

            timhunt Tim Hunt
            timhunt Tim Hunt
            Rajesh Taneja Rajesh Taneja
            David Monllaó David Monllaó
            Adrian Greeve Adrian Greeve
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.