cakephp-version icon indicating copy to clipboard operation
cakephp-version copied to clipboard

failed test for null datetime field

Open matteorebeschi opened this issue 3 years ago • 3 comments

This is the failing test for the datetime field as discussed in #47

matteorebeschi avatar Apr 07 '22 14:04 matteorebeschi

Great, thanks! Test looks good. Now that we have a test, if you like you can put your first fix in here. I've got some ideas on how to address it and improve the code you posted, if you don't mind me tweaking it.

jeremyharris avatar Apr 07 '22 14:04 jeremyharris

I've tried changing the convertFieldsToType to what I mentioned in the error thread, but the tests keep failing, so I'm not even sure that that's a good starting point anymore. But feel free to go ahead and tweak it if you have any ideas!

matteorebeschi avatar Apr 08 '22 09:04 matteorebeschi

Hey @matteorebeschi, I was able to look at this. I looked at your tests and I think you had the fixture set up incorrectly.

I reworked the fixture and added tests for both null support and DateTime. The tests still pass, so it can successfully version null values and DateTimes. It never serializes the data in the way the original issues shows.

So far I can't replicate the problem

  1. Are you able to tweak testDateTimeSupport or copy/paste it and recreate your scenario, that is, saving some datetime/null data and it failing to return from ->version()?
  2. Are you using a custom database Type for your datetimes?

jeremyharris avatar Apr 14 '22 14:04 jeremyharris