@@ -18,7 +18,7 @@ public function itConvertsToBooleanStringIfEitherValueOrTypeIsValidElseNull(
18
18
?string $ type ,
19
19
?string $ expected = null
20
20
): void {
21
- $ this ->assertSame ( $ expected , actual: Type::toBoolByValueOrType ( $ value , $ type ) );
21
+ $ this ->assertSame ( $ expected , actual: Type::castToBoolByValueOrType ( $ value , $ type ) );
22
22
}
23
23
24
24
public static function provideBoolValueAndType (): array {
@@ -195,23 +195,23 @@ public function itReturnsValueBasedOnValueType( mixed $value, mixed $expected ):
195
195
196
196
#[Test]
197
197
#[DataProvider( 'provideValueToBeMatched ' )]
198
- public function itConvertsToBooleanType ( mixed $ value , mixed $ expected ): void {
199
- $ this ->assertSame ( true === $ expected , actual: Type::toBool ( $ value ) );
198
+ public function itConvertsToBooleanType ( mixed $ value , mixed $ expected, ? bool $ converted = null ): void {
199
+ $ this ->assertSame ( $ converted ?? $ expected , actual: Type::toBool ( $ value ) );
200
200
}
201
201
202
202
public static function provideValueToBeMatched (): array {
203
203
return array (
204
204
array ( true , true ),
205
205
array ( false , false ),
206
- array ( null , null ),
207
- array ( array (), array () ),
208
- array ( 25 , 25 ),
206
+ array ( null , null , false ),
207
+ array ( array (), array (), false ),
208
+ array ( 25 , 25 , false ),
209
209
array ( 'true ' , true ),
210
210
array ( 'false ' , false ),
211
- array ( 'array() ' , array () ),
212
- array ( fn (): int => 1 , fn (): int => 1 ),
213
- array ( 'array ' , 'array ' ),
214
- array ( 'everything-else ' , 'everything-else ' ),
211
+ array ( 'array() ' , array (), false ),
212
+ array ( fn (): int => 1 , fn (): int => 1 , false ),
213
+ array ( 'array ' , 'array ' , false ),
214
+ array ( 'everything-else ' , 'everything-else ' , false ),
215
215
);
216
216
}
217
217
}
0 commit comments