@@ -105,4 +105,29 @@ public static function invalidDsnProvider(): iterable
105
105
'The mailer DSN must contain a host (use "default" by default). ' ,
106
106
];
107
107
}
108
+
109
+ /**
110
+ * @dataProvider getBooleanOptionProvider
111
+ */
112
+ public function testGetBooleanOption (bool $ expected , string $ dsnString , string $ option , bool $ default )
113
+ {
114
+ $ dsn = Dsn::fromString ($ dsnString );
115
+
116
+ $ this ->assertSame ($ expected , $ dsn ->getBooleanOption ($ option , $ default ));
117
+ }
118
+
119
+ public static function getBooleanOptionProvider (): iterable
120
+ {
121
+ yield [true , 'scheme://localhost?enabled=1 ' , 'enabled ' , false ];
122
+ yield [true , 'scheme://localhost?enabled=true ' , 'enabled ' , false ];
123
+ yield [true , 'scheme://localhost?enabled=on ' , 'enabled ' , false ];
124
+ yield [true , 'scheme://localhost?enabled=yes ' , 'enabled ' , false ];
125
+ yield [false , 'scheme://localhost?enabled=0 ' , 'enabled ' , false ];
126
+ yield [false , 'scheme://localhost?enabled=false ' , 'enabled ' , false ];
127
+ yield [false , 'scheme://localhost?enabled=off ' , 'enabled ' , false ];
128
+ yield [false , 'scheme://localhost?enabled=no ' , 'enabled ' , false ];
129
+
130
+ yield [false , 'scheme://localhost ' , 'not_existant ' , false ];
131
+ yield [true , 'scheme://localhost ' , 'not_existant ' , true ];
132
+ }
108
133
}
0 commit comments