minor #33463 [Mailer] Fix an error message (fabpot)

This PR was merged into the 4.4 branch.

Discussion
----------

[Mailer] Fix an error message

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | yes
| New feature?  | no <!-- please update src/**/CHANGELOG.md files -->
| BC breaks?    | no     <!-- see https://symfony.com/bc -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tests pass?   | yes    <!-- please add some, will be required by reviewers -->
| Fixed tickets | n/a
| License       | MIT
| Doc PR        | n/a

Now  that the host is not the name anymore, the error message when not having a host is wrong.

Commits
-------

60bb1c0ddc [Mailer] Fix an error message
This commit is contained in:
Fabien Potencier 2019-09-05 10:11:06 +02:00
commit 7a9c5da1de
2 changed files with 4 additions and 4 deletions

View File

@ -77,12 +77,12 @@ class DsnTest extends TestCase
yield [
'//sendmail',
'The "//sendmail" mailer DSN must contain a transport scheme.',
'The "//sendmail" mailer DSN must contain a scheme.',
];
yield [
'file:///some/path',
'The "file:///some/path" mailer DSN must contain a mailer name.',
'The "file:///some/path" mailer DSN must contain a host (use "default" by default).',
];
}
}

View File

@ -42,11 +42,11 @@ final class Dsn
}
if (!isset($parsedDsn['scheme'])) {
throw new InvalidArgumentException(sprintf('The "%s" mailer DSN must contain a transport scheme.', $dsn));
throw new InvalidArgumentException(sprintf('The "%s" mailer DSN must contain a scheme.', $dsn));
}
if (!isset($parsedDsn['host'])) {
throw new InvalidArgumentException(sprintf('The "%s" mailer DSN must contain a mailer name.', $dsn));
throw new InvalidArgumentException(sprintf('The "%s" mailer DSN must contain a host (use "default" by default).', $dsn));
}
$user = isset($parsedDsn['user']) ? urldecode($parsedDsn['user']) : null;