Skip to content

Commit

Permalink
Add Mailer::getConfigs method
Browse files Browse the repository at this point in the history
  • Loading branch information
natanfelles committed Oct 2, 2022
1 parent fcb0729 commit 19e333d
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/Mailer.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ protected function makeConfig(array $config) : array
}

/**
* @todo Make public in version 4.0.0
*
* @param string $key
*
* @return mixed
Expand All @@ -103,6 +105,27 @@ protected function getConfig(string $key) : mixed
return $this->config[$key];
}

/**
* @return array<string,mixed>
*/
#[ArrayShape([
'host' => 'string',
'port' => 'int',
'tls' => 'bool',
'username' => 'string|null',
'password' => 'string|null',
'charset' => 'string',
'crlf' => 'string',
'connection_timeout' => 'int',
'response_timeout' => 'int',
'hostname' => 'string',
'keep_alive' => 'bool',
])]
public function getConfigs() : array
{
return $this->config;
}

public function getCrlf() : string
{
return (string) $this->getConfig('crlf');
Expand Down
7 changes: 7 additions & 0 deletions tests/Mailers/SMTPMailerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,4 +127,11 @@ public function testLogs() : void
$this->smtp->resetLogs();
self::assertEmpty($this->smtp->getLogs());
}

public function testConfigs() : void
{
foreach ($this->smtp->getConfigs() as $key => $value) {
self::assertIsString($key);
}
}
}

0 comments on commit 19e333d

Please sign in to comment.