MailManagerTest.php 926 B

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. namespace Illuminate\Tests\Mail;
  3. use InvalidArgumentException;
  4. use Orchestra\Testbench\TestCase;
  5. class MailManagerTest extends TestCase
  6. {
  7. /**
  8. * @dataProvider emptyTransportConfigDataProvider
  9. */
  10. public function testEmptyTransportConfig($transport)
  11. {
  12. $this->app['config']->set('mail.mailers.custom_smtp', [
  13. 'transport' => $transport,
  14. 'host' => null,
  15. 'port' => null,
  16. 'encryption' => null,
  17. 'username' => null,
  18. 'password' => null,
  19. 'timeout' => null,
  20. ]);
  21. $this->expectException(InvalidArgumentException::class);
  22. $this->expectExceptionMessage("Unsupported mail transport [{$transport}]");
  23. $this->app['mail.manager']->mailer('custom_smtp');
  24. }
  25. public function emptyTransportConfigDataProvider()
  26. {
  27. return [
  28. [null], [''], [' '],
  29. ];
  30. }
  31. }