1515use Symfony \Component \Notifier \Exception \InvalidArgumentException ;
1616use Symfony \Component \Notifier \Transport \Dsn ;
1717
18- class DsnTest extends TestCase
18+ final class DsnTest extends TestCase
1919{
2020 /**
2121 * @dataProvider fromStringProvider
2222 */
23- public function testFromString (string $ string , Dsn $ expectedDsn ): void
23+ public function testFromString (string $ string , Dsn $ expectedDsn )
2424 {
2525 $ actualDsn = Dsn::fromString ($ string );
2626
@@ -42,6 +42,26 @@ public function fromStringProvider(): iterable
4242 new Dsn ('scheme ' , 'localhost ' , null , null , null , [], null ),
4343 ];
4444
45+ yield 'simple dsn including @ sign, but no user/password/token ' => [
46+ 'scheme://@localhost ' ,
47+ new Dsn ('scheme ' , 'localhost ' , null , null ),
48+ ];
49+
50+ yield 'simple dsn including : sign and @ sign, but no user/password/token ' => [
51+ 'scheme://:@localhost ' ,
52+ new Dsn ('scheme ' , 'localhost ' , null , null ),
53+ ];
54+
55+ yield 'simple dsn including user, : sign and @ sign, but no password ' => [
56+ 'scheme://user1:@localhost ' ,
57+ new Dsn ('scheme ' , 'localhost ' , 'user1 ' , null ),
58+ ];
59+
60+ yield 'simple dsn including : sign, password, and @ sign, but no user ' => [
61+ 'scheme://:pass@localhost ' ,
62+ new Dsn ('scheme ' , 'localhost ' , null , 'pass ' ),
63+ ];
64+
4565 yield 'dsn with user and pass ' => [
4666 'scheme://u$er:pa$s@localhost ' ,
4767 new Dsn ('scheme ' , 'localhost ' , 'u$er ' , 'pa$s ' , null , [], null ),
@@ -66,7 +86,7 @@ public function fromStringProvider(): iterable
6686 /**
6787 * @dataProvider invalidDsnProvider
6888 */
69- public function testInvalidDsn (string $ dsn , string $ exceptionMessage ): void
89+ public function testInvalidDsn (string $ dsn , string $ exceptionMessage )
7090 {
7191 $ this ->expectException (InvalidArgumentException::class);
7292 $ this ->expectExceptionMessage ($ exceptionMessage );
@@ -91,7 +111,7 @@ public function invalidDsnProvider(): iterable
91111 ];
92112 }
93113
94- public function testGetOption (): void
114+ public function testGetOption ()
95115 {
96116 $ options = ['with_value ' => 'some value ' , 'nullable ' => null ];
97117 $ dsn = new Dsn ('scheme ' , 'localhost ' , 'u$er ' , 'pa$s ' , '8000 ' , $ options , '/channel ' );
0 commit comments