@@ -108,22 +108,48 @@ public function can_handle_empty_string_from_sql(): void
108108 self ::assertNull ($ result );
109109 }
110110
111+ #[DataProvider('provideInvalidDatabaseValues ' )]
111112 #[Test]
112- public function throws_exception_for_invalid_php_value_type ( ): void
113+ public function throws_exception_when_converting_to_database_value_for_invalid_types ( mixed $ invalidValue ): void
113114 {
114115 $ this ->expectException (InvalidRangeForDatabaseException::class);
115116 $ this ->expectExceptionMessage ('Invalid type for range ' );
116117
117- $ this ->fixture ->convertToDatabaseValue (' invalid ' , $ this ->platform ); // @phpstan-ignore-line argument.type
118+ $ this ->fixture ->convertToDatabaseValue ($ invalidValue , $ this ->platform ); // @phpstan-ignore-line argument.type
118119 }
119120
121+ /**
122+ * @return array<string, array{mixed}>
123+ */
124+ public static function provideInvalidDatabaseValues (): array
125+ {
126+ return [
127+ 'string value ' => ['not_a_range ' ],
128+ 'integer value ' => [123 ],
129+ 'array value ' => [[1 , 2 , 3 ]],
130+ ];
131+ }
132+
133+ #[DataProvider('provideInvalidPHPValues ' )]
120134 #[Test]
121- public function throws_exception_for_invalid_sql_value_type ( ): void
135+ public function throws_exception_when_converting_to_php_value_for_invalid_types ( mixed $ invalidValue ): void
122136 {
123137 $ this ->expectException (InvalidRangeForPHPException::class);
124138 $ this ->expectExceptionMessage ('Invalid database value type for range conversion ' );
125139
126- $ this ->fixture ->convertToPHPValue ([1 , 2 ], $ this ->platform ); // @phpstan-ignore-line argument.type
140+ $ this ->fixture ->convertToPHPValue ($ invalidValue , $ this ->platform ); // @phpstan-ignore-line argument.type
141+ }
142+
143+ /**
144+ * @return array<string, array{mixed}>
145+ */
146+ public static function provideInvalidPHPValues (): array
147+ {
148+ return [
149+ 'integer value ' => [123 ],
150+ 'array value ' => [['invalid ' ]],
151+ 'boolean value ' => [true ],
152+ ];
127153 }
128154
129155 #[Test]
0 commit comments