File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed
tests/system/DataConverter Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -379,6 +379,23 @@ public function testDateTimeConvertDataToDB(): void
379379 $ this ->assertSame ('2023-11-18 14:18:18 ' , $ data ['date ' ]);
380380 }
381381
382+ public function testDateTimeConvertDataToDBWithFormat (): void
383+ {
384+ $ types = [
385+ 'id ' => 'int ' ,
386+ 'date ' => 'datetime[us] ' ,
387+ ];
388+ $ converter = $ this ->createDataConverter ($ types , [], db_connect ());
389+
390+ $ phpData = [
391+ 'id ' => '1 ' ,
392+ 'date ' => Time::parse ('2009-02-15 00:00:01.123456 ' ),
393+ ];
394+ $ data = $ converter ->toDataSource ($ phpData );
395+
396+ $ this ->assertSame ('2009-02-15 00:00:01.123456 ' , $ data ['date ' ]);
397+ }
398+
382399 public function testTimestampConvertDataFromDB (): void
383400 {
384401 $ types = [
You can’t perform that action at this time.
0 commit comments