Skip to content

Commit

Permalink
more fixes for M4.4
Browse files Browse the repository at this point in the history
  • Loading branch information
TamaroWalter committed May 23, 2024
1 parent d2413a3 commit 07ec785
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 3 deletions.
3 changes: 2 additions & 1 deletion lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -885,7 +885,8 @@ function moodleoverflow_send_mails() {

// Preapare to actually send the post now. Build up the content.
$cleanname = str_replace('"', "'", strip_tags(format_string($moodleoverflow->name)));
$shortname = format_string($course->shortname, true, ['context' => context_course::instance($course->id)]);
$coursecontext = context_course::instance($course->id);
$shortname = format_string($course->shortname, true, ['context' => $coursecontext]);

// Define a header to make mails easier to track.
$emailmessageid = generate_email_messageid('moodlemoodleoverflow' . $moodleoverflow->id);
Expand Down
2 changes: 1 addition & 1 deletion tests/behat/add_moodleoverflow.feature
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Feature: Add moodleoverflow activities and discussions
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I turn editing mode on
And I add a "Moodleoverflow" activity to course "C1" section "1" and I fill the form with:
And I add a moodleoverflow to course "C1" section "1" and I fill the form with:
| Moodleoverflow name | Test moodleoverflow name |
| Description | Test forum description |
And I add a new discussion to "Test moodleoverflow name" moodleoverflow with:
Expand Down
25 changes: 25 additions & 0 deletions tests/behat/behat_mod_moodleoverflow.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,31 @@
*/
class behat_mod_moodleoverflow extends behat_base {

/**
* Adds a new moodleoverflow to the specified course and section.
*
* @Given I add a moodleoverflow to course :coursefullname section :sectionnum and I fill the form with:
* @param $courseshortname
* @param $sectionnumber
* @param $data
* @return void
*/
public function i_add_a_moodleoverflow_to_course_section_and_fill_form($courseshortname, $sectionnumber, TableNode $data) {
global $CFG;

if ($CFG->branch >= 404) {
$this->execute(
"behat_course::i_add_to_course_section_and_i_fill_the_form_with",
[$this->escape('moodleoverflow'), $this->escape($courseshortname), $this->escape($sectionnumber), $data]
);
} else {
$this->execute(
"behat_course_deprecated::i_add_to_section_and_i_fill_the_form_with",
[$this->escape('moodleoverflow'), $this->escape($sectionnumber), $data]
);
}
}

/**
* Adds a topic to the moodleoverflow specified by it's name. Useful for the Announcements and blog-style moodleoverflow.
*
Expand Down
2 changes: 1 addition & 1 deletion tests/behat/delete_file.feature
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Feature: Delete attachments
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I turn editing mode on
And I add a "Moodleoverflow" activity to course "C1" section "1" and I fill the form with:
And I add a moodleoverflow to course "C1" section "1" and I fill the form with:
| Moodleoverflow name | Test moodleoverflow name |
| Description | Test forum description |
And I add a new discussion to "Test moodleoverflow name" moodleoverflow with:
Expand Down

0 comments on commit 07ec785

Please sign in to comment.