3434use Yiisoft \Db \Schema \Column \StructuredLazyColumn ;
3535use Yiisoft \Db \Schema \Data \LazyArray ;
3636use Yiisoft \Db \Schema \Data \JsonLazyArray ;
37+ use Yiisoft \Db \Schema \Data \StringableStream ;
3738use Yiisoft \Db \Schema \Data \StructuredLazyArray ;
3839use Yiisoft \Db \Tests \Support \IntEnum ;
3940use Yiisoft \Db \Tests \Support \Stringable ;
4041use Yiisoft \Db \Tests \Support \StringEnum ;
4142
43+ use function fclose ;
4244use function fopen ;
4345
4446class ColumnProvider
@@ -147,10 +149,12 @@ public static function dbTypecastColumns(): array
147149 ['1 ' , true ],
148150 ['0 ' , false ],
149151 [new Param ("\x10\x11\x12" , PDO ::PARAM_LOB ), "\x10\x11\x12" ],
150- ['1 ' , IntEnum::ONE ],
151- ['one ' , StringEnum::ONE ],
152- ['string ' , new Stringable ('string ' )],
152+ [new Param ( '1 ' , PDO :: PARAM_LOB ) , IntEnum::ONE ],
153+ [new Param ( 'one ' , PDO :: PARAM_LOB ) , StringEnum::ONE ],
154+ [new Param ( 'string ' , PDO :: PARAM_LOB ) , new Stringable ('string ' )],
153155 [$ resource = fopen ('php://memory ' , 'rb ' ), $ resource ],
156+ [new Param ($ resource = fopen ('php://memory ' , 'rb ' ), PDO ::PARAM_LOB ), new StringableStream ($ resource )],
157+ [new Param ("\x10\x11\x12" , PDO ::PARAM_LOB ), new StringableStream ("\x10\x11\x12" )],
154158 [$ expression = new Expression ('expression ' ), $ expression ],
155159 ],
156160 ],
@@ -473,6 +477,9 @@ public static function dbTypecastColumns(): array
473477
474478 public static function dbTypecastColumnsWithException (): array
475479 {
480+ $ resource = fopen ('php://memory ' , 'rb ' );
481+ fclose ($ resource );
482+
476483 return [
477484 'integer array ' => [new IntegerColumn (), []],
478485 'integer resource ' => [new IntegerColumn (), fopen ('php://memory ' , 'r ' )],
@@ -485,6 +492,7 @@ public static function dbTypecastColumnsWithException(): array
485492 'double stdClass ' => [new DoubleColumn (), new stdClass ()],
486493 'string array ' => [new StringColumn (), []],
487494 'string stdClass ' => [new StringColumn (), new stdClass ()],
495+ 'binary closed ' => [new BinaryColumn (), $ resource ],
488496 'binary array ' => [new BinaryColumn (), []],
489497 'binary stdClass ' => [new BinaryColumn (), new stdClass ()],
490498 'datetime array ' => [new DateTimeColumn (), []],
@@ -539,7 +547,7 @@ public static function phpTypecastColumns(): array
539547 [null , null ],
540548 ['' , '' ],
541549 ["\x10\x11\x12" , "\x10\x11\x12" ],
542- [$ resource = fopen ('php://memory ' , 'rb ' ), $ resource ],
550+ [new StringableStream ( $ resource = fopen ('php://memory ' , 'rb ' ) ), $ resource ],
543551 ],
544552 ],
545553 'bit ' => [
0 commit comments