15
15
use Symfony \Component \Notifier \Exception \InvalidArgumentException ;
16
16
use Symfony \Component \Notifier \Transport \Dsn ;
17
17
18
- class DsnTest extends TestCase
18
+ final class DsnTest extends TestCase
19
19
{
20
20
/**
21
21
* @dataProvider fromStringProvider
22
22
*/
23
- public function testFromString (string $ string , Dsn $ expectedDsn ): void
23
+ public function testFromString (string $ string , Dsn $ expectedDsn )
24
24
{
25
25
$ actualDsn = Dsn::fromString ($ string );
26
26
@@ -42,6 +42,26 @@ public function fromStringProvider(): iterable
42
42
new Dsn ('scheme ' , 'localhost ' , null , null , null , [], null ),
43
43
];
44
44
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
+
45
65
yield 'dsn with user and pass ' => [
46
66
'scheme://u$er:pa$s@localhost ' ,
47
67
new Dsn ('scheme ' , 'localhost ' , 'u$er ' , 'pa$s ' , null , [], null ),
@@ -66,7 +86,7 @@ public function fromStringProvider(): iterable
66
86
/**
67
87
* @dataProvider invalidDsnProvider
68
88
*/
69
- public function testInvalidDsn (string $ dsn , string $ exceptionMessage ): void
89
+ public function testInvalidDsn (string $ dsn , string $ exceptionMessage )
70
90
{
71
91
$ this ->expectException (InvalidArgumentException::class);
72
92
$ this ->expectExceptionMessage ($ exceptionMessage );
@@ -91,7 +111,7 @@ public function invalidDsnProvider(): iterable
91
111
];
92
112
}
93
113
94
- public function testGetOption (): void
114
+ public function testGetOption ()
95
115
{
96
116
$ options = ['with_value ' => 'some value ' , 'nullable ' => null ];
97
117
$ dsn = new Dsn ('scheme ' , 'localhost ' , 'u$er ' , 'pa$s ' , '8000 ' , $ options , '/channel ' );
0 commit comments