@@ -1040,6 +1040,56 @@ public function testValidIntegerWithDefaultValue(): void
10401040 $ this ->assertTrue ($ validator ->isValid ($ attribute ));
10411041 }
10421042
1043+ public function testInvalidBigIntDefaultValueTypeStringNotNumeric (): void
1044+ {
1045+ $ validator = new Attribute (
1046+ attributes: [],
1047+ maxStringLength: 16777216 ,
1048+ maxVarcharLength: 65535 ,
1049+ maxIntLength: PHP_INT_MAX ,
1050+ );
1051+
1052+ $ attribute = new Document ([
1053+ '$id ' => ID ::custom ('counter ' ),
1054+ 'key ' => 'counter ' ,
1055+ 'type ' => Database::VAR_BIGINT ,
1056+ 'size ' => 0 ,
1057+ 'required ' => false ,
1058+ 'default ' => 'not_a_bigint ' ,
1059+ 'signed ' => true ,
1060+ 'array ' => false ,
1061+ 'filters ' => [],
1062+ ]);
1063+
1064+ $ this ->expectException (DatabaseException::class);
1065+ $ this ->expectExceptionMessage ('Default value not_a_bigint is not a valid integer string for type bigint ' );
1066+ $ validator ->isValid ($ attribute );
1067+ }
1068+
1069+ public function testValidBigIntDefaultValueTypeStringNumeric (): void
1070+ {
1071+ $ validator = new Attribute (
1072+ attributes: [],
1073+ maxStringLength: 16777216 ,
1074+ maxVarcharLength: 65535 ,
1075+ maxIntLength: PHP_INT_MAX ,
1076+ );
1077+
1078+ $ attribute = new Document ([
1079+ '$id ' => ID ::custom ('counter ' ),
1080+ 'key ' => 'counter ' ,
1081+ 'type ' => Database::VAR_BIGINT ,
1082+ 'size ' => 0 ,
1083+ 'required ' => false ,
1084+ 'default ' => '123 ' ,
1085+ 'signed ' => true ,
1086+ 'array ' => false ,
1087+ 'filters ' => [],
1088+ ]);
1089+
1090+ $ this ->assertTrue ($ validator ->isValid ($ attribute ));
1091+ }
1092+
10431093 public function testValidFloatWithDefaultValue (): void
10441094 {
10451095 $ validator = new Attribute (
0 commit comments