Debian Codegraph @

lib/3rdParty/composer/symfony/translation/Test/IncompleteDsnTestTrait.php

raw symbols SCIP
1 <?php
2
3 /*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <[email protected]>
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\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 * @return iterable<array{0: string, 1?: string|null}>
22 */
23 abstract public static function incompleteDsnProvider(): iterable;
24
25 /**
26 * @dataProvider incompleteDsnProvider
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 }