|
| 1 | +<?php |
| 2 | + |
| 3 | +/* |
| 4 | + * This file is part of the Symfony package. |
| 5 | + * |
| 6 | + * (c) Fabien Potencier <fabien@symfony.com> |
| 7 | + * |
| 8 | + * For the full copyright and license information, please view the LICENSE |
| 9 | + * file that was distributed with this source code. |
| 10 | + */ |
| 11 | + |
| 12 | +namespace Symfony\Component\Notifier\Tests\Transport; |
| 13 | + |
| 14 | +use PHPUnit\Framework\TestCase; |
| 15 | +use Symfony\Component\Notifier\Exception\UnsupportedSchemeException; |
| 16 | +use Symfony\Component\Notifier\Transport\Dsn; |
| 17 | +use Symfony\Component\Notifier\Transport\NullTransport; |
| 18 | +use Symfony\Component\Notifier\Transport\NullTransportFactory; |
| 19 | +use Symfony\Contracts\EventDispatcher\EventDispatcherInterface; |
| 20 | +use Symfony\Contracts\HttpClient\HttpClientInterface; |
| 21 | + |
| 22 | +/** |
| 23 | + * @author Jan Schädlich <jan.schaedlich@sensiolabs.de> |
| 24 | + */ |
| 25 | +class NullTransportFactoryTest extends TestCase |
| 26 | +{ |
| 27 | + /** |
| 28 | + * @var NullTransportFactory |
| 29 | + */ |
| 30 | + private $nullTransportFactory; |
| 31 | + |
| 32 | + protected function setUp(): void |
| 33 | + { |
| 34 | + $this->nullTransportFactory = new NullTransportFactory( |
| 35 | + $this->createMock(EventDispatcherInterface::class), |
| 36 | + $this->createMock(HttpClientInterface::class) |
| 37 | + ); |
| 38 | + } |
| 39 | + |
| 40 | + public function testCreateThrowsUnsupportedSchemeException() |
| 41 | + { |
| 42 | + $this->expectException(UnsupportedSchemeException::class); |
| 43 | + |
| 44 | + $this->nullTransportFactory->create(new Dsn('foo', '')); |
| 45 | + } |
| 46 | + |
| 47 | + public function testCreate() |
| 48 | + { |
| 49 | + $this->assertInstanceOf( |
| 50 | + NullTransport::class, |
| 51 | + $this->nullTransportFactory->create(new Dsn('null', '')) |
| 52 | + ); |
| 53 | + } |
| 54 | +} |
0 commit comments