public function ConnectionTesterTest::providerHookRequirements in SMTP Authentication Support 8
Provider for testHookRequirements().
File
- tests/
src/ Kernel/ ConnectionTester/ ConnectionTesterTest.php, line 64
Class
- ConnectionTesterTest
- Tests SMTP connections.
Namespace
Drupal\Tests\smtp\Kernel\ConnectionTesterCode
public function providerHookRequirements() {
return [
[
'message' => 'SMTP on, working.',
'$smtp_on' => TRUE,
'result' => TRUE,
'exception' => '',
'expected' => [
'smtp_connection' => [
'title' => 'SMTP connection',
'value' => 'SMTP module is enabled, turned on, and connection is valid.',
'severity' => ConnectionTester::REQUIREMENT_OK,
],
],
],
[
'message' => 'SMTP on, result FALSE.',
'$smtp_on' => TRUE,
'result' => FALSE,
'exception' => '',
'expected' => [
'smtp_connection' => [
'title' => 'SMTP connection',
'value' => 'SMTP module is enabled, turned on, but SmtpConnect() returned FALSE.',
'severity' => ConnectionTester::REQUIREMENT_ERROR,
],
],
],
[
'message' => 'SMTP on, PHPMailerException.',
'$smtp_on' => TRUE,
'result' => FALSE,
'exception' => PHPMailerException::class,
'expected' => [
'smtp_connection' => [
'title' => 'SMTP connection',
'value' => 'SMTP module is enabled, turned on, but SmtpConnect() threw exception EXCEPTION MESSAGE',
'severity' => ConnectionTester::REQUIREMENT_ERROR,
],
],
],
[
'message' => 'SMTP on, Exception.',
'$smtp_on' => TRUE,
'result' => FALSE,
'exception' => \Exception::class,
'expected' => [
'smtp_connection' => [
'title' => 'SMTP connection',
'value' => 'SMTP module is enabled, turned on, but SmtpConnect() threw an unexpected exception',
'severity' => ConnectionTester::REQUIREMENT_ERROR,
],
],
],
[
'message' => 'SMTP off.',
'$smtp_on' => FALSE,
'result' => FALSE,
'exception' => '',
'expected' => [
'smtp_connection' => [
'title' => 'SMTP connection',
'value' => 'SMTP module is enabled but turned off.',
'severity' => ConnectionTester::REQUIREMENT_OK,
],
],
],
];
}