| 1 |
<?php |
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
namespace Symfony\Component\Translation\Test; |
| 13 |
|
| 14 |
use PHPUnit\Framework\Attributes\DataProvider; |
| 15 |
use Symfony\Component\Translation\Exception\IncompleteDsnException; |
| 16 |
use Symfony\Component\Translation\Provider\Dsn; |
| 17 |
|
| 18 |
trait IncompleteDsnTestTrait |
| 19 |
{ |
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
abstract public static function incompleteDsnProvider(): iterable; |
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
#[DataProvider('incompleteDsnProvider')] |
| 29 |
public function testIncompleteDsnException(string $dsn, ?string $message = null) |
| 30 |
{ |
| 31 |
$factory = $this->createFactory(); |
| 32 |
|
| 33 |
$dsn = new Dsn($dsn); |
| 34 |
|
| 35 |
$this->expectException(IncompleteDsnException::class); |
| 36 |
if (null !== $message) { |
| 37 |
$this->expectExceptionMessage($message); |
| 38 |
} |
| 39 |
|
| 40 |
$factory->create($dsn); |
| 41 |
} |
| 42 |
} |