mirror of
https://github.com/nextcloud/server.git
synced 2025-02-07 18:09:45 +00:00
af6de04e9e
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
38 lines
933 B
PHP
38 lines
933 B
PHP
<?php
|
|
/**
|
|
* SPDX-FileCopyrightText: 2020 Nextcloud GmbH and Nextcloud contributors
|
|
* SPDX-License-Identifier: AGPL-3.0-or-later
|
|
*/
|
|
trait Mail {
|
|
// CommandLine trait is expected to be used in the class that uses this
|
|
// trait.
|
|
|
|
/**
|
|
* @var string
|
|
*/
|
|
private $fakeSmtpServerPid;
|
|
|
|
/**
|
|
* @AfterScenario
|
|
*/
|
|
public function killDummyMailServer() {
|
|
if (!$this->fakeSmtpServerPid) {
|
|
return;
|
|
}
|
|
|
|
exec('kill ' . $this->fakeSmtpServerPid);
|
|
|
|
$this->invokingTheCommand('config:system:delete mail_smtpport');
|
|
}
|
|
|
|
/**
|
|
* @Given /^dummy mail server is listening$/
|
|
*/
|
|
public function dummyMailServerIsListening() {
|
|
// Default smtpport (25) is restricted for regular users, so the
|
|
// FakeSMTP uses 2525 instead.
|
|
$this->invokingTheCommand('config:system:set mail_smtpport --value=2525 --type integer');
|
|
|
|
$this->fakeSmtpServerPid = exec('php features/bootstrap/FakeSMTPHelper.php >/dev/null 2>&1 & echo $!');
|
|
}
|
|
}
|