mirror of
https://github.com/moodle/moodle.git
synced 2025-01-17 21:49:15 +01:00
MDL-80207 tool_messageinbound: Fix Behat failure
This commit is contained in:
parent
93b3eff237
commit
c27fc14649
@ -155,7 +155,7 @@ class manager {
|
|||||||
// Ensure that mailboxes exist.
|
// Ensure that mailboxes exist.
|
||||||
$this->ensure_mailboxes_exist();
|
$this->ensure_mailboxes_exist();
|
||||||
// Select mailbox.
|
// Select mailbox.
|
||||||
$this->client->select(mailbox: $mailbox);
|
$this->select_mailbox(mailbox: $mailbox);
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
throw new \moodle_exception('imapconnectfailure', 'tool_messageinbound', '', null, 'Could not connect to IMAP server.');
|
throw new \moodle_exception('imapconnectfailure', 'tool_messageinbound', '', null, 'Could not connect to IMAP server.');
|
||||||
@ -331,9 +331,11 @@ class manager {
|
|||||||
*/
|
*/
|
||||||
public function tidy_old_messages(): bool {
|
public function tidy_old_messages(): bool {
|
||||||
// Grab the new IMAP client.
|
// Grab the new IMAP client.
|
||||||
if (!$this->get_imap_client(mailbox: $this->get_confirmation_folder())) {
|
if (!$this->get_imap_client()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
// Switch to the confirmation folder.
|
||||||
|
$this->select_mailbox(mailbox: $this->get_confirmation_folder());
|
||||||
|
|
||||||
// Open the mailbox.
|
// Open the mailbox.
|
||||||
mtrace("Searching for messages older than 24 hours in the '" .
|
mtrace("Searching for messages older than 24 hours in the '" .
|
||||||
@ -1332,6 +1334,17 @@ class manager {
|
|||||||
return $messagedata->sequence;
|
return $messagedata->sequence;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Switch mailbox.
|
||||||
|
*
|
||||||
|
* @param string $mailbox The mailbox to switch to.
|
||||||
|
*/
|
||||||
|
protected function select_mailbox(
|
||||||
|
string $mailbox,
|
||||||
|
): void {
|
||||||
|
$this->client->select(mailbox: $mailbox);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* We use Roundcube Framework to receive the emails.
|
* We use Roundcube Framework to receive the emails.
|
||||||
* This method will load the required dependencies.
|
* This method will load the required dependencies.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user