TransportFactoryTestCase.php 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Component\Mailer\Test;
  11. use Psr\Log\LoggerInterface;
  12. use Symfony\Component\Mailer\Transport\Dsn;
  13. use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
  14. use Symfony\Contracts\HttpClient\HttpClientInterface;
  15. /**
  16. * A test case to ease testing Transport Factory.
  17. *
  18. * @author Konstantin Myakshin <molodchick@gmail.com>
  19. *
  20. * @deprecated since Symfony 7.2, use AbstractTransportFactoryTestCase instead
  21. */
  22. abstract class TransportFactoryTestCase extends AbstractTransportFactoryTestCase
  23. {
  24. use IncompleteDsnTestTrait;
  25. protected EventDispatcherInterface $dispatcher;
  26. protected HttpClientInterface $client;
  27. protected LoggerInterface $logger;
  28. /**
  29. * @psalm-return iterable<array{0: Dsn, 1?: string|null}>
  30. */
  31. public static function unsupportedSchemeProvider(): iterable
  32. {
  33. return [];
  34. }
  35. /**
  36. * @psalm-return iterable<array{0: Dsn}>
  37. */
  38. public static function incompleteDsnProvider(): iterable
  39. {
  40. return [];
  41. }
  42. protected function getDispatcher(): EventDispatcherInterface
  43. {
  44. return $this->dispatcher ??= $this->createMock(EventDispatcherInterface::class);
  45. }
  46. protected function getClient(): HttpClientInterface
  47. {
  48. return $this->client ??= $this->createMock(HttpClientInterface::class);
  49. }
  50. protected function getLogger(): LoggerInterface
  51. {
  52. return $this->logger ??= $this->createMock(LoggerInterface::class);
  53. }
  54. }