If this is a test suite for dates, shouldn't all the date modules be turned on by default :)

I want to test things like repeating dates and multiple value dates, and the current suite isn't set up for any of those things. We can make that work better by turning on all the Date and Calendar modules and making the provided fields multiple value fields instead of single value fields. Then we also need some repeat date fields. I've worked some of these things up and will provide a patch later, if you agree.

Comments

dww’s picture

Hrm, I have no idea how signup is going to behave with a multi-valued date field. :( I know this might sound crazy, but I'm tempted to say that we should have another set of 15 node types where the date fields are multi-valued. Or, perhaps a configuration knob (if possible) to select if you want all your types to be single or multi valued?

Makes me think it'd be nice if there was an easier way to programatically setup these node types and field configurations, instead of having to click them all together once and export them to a .inc file. I don't suppose there are any plans for adding a date_create_cck_field($settings); function in the API, where the $settings array lets you select the key properties, e.g.:

  $settings = array(
    'field_name' => 'datestamp_tz_none',
    'label' => t('Datestamp TZ none'),
    'type' => 'datestamp',
    'timezone_handling' => 'none', 
    'widget_type' => 'date_text',
  );
  date_create_cck_field($settings);

You could also specify 'multiple' => '1' in there if you wanted, etc. Looking more closely, I guess that's sort of what content_field_instance_create() does, but there's a ton of other logic in content_copy_import_form_submit() that seems all mixed in...

Maybe I could simplify the content_types/*.inc files and rip out all the lines that just represent default values. After that, maybe those files will look more like my $settings array above, and then it'll basically be all I need. Then, it'd be easy with a little shell hacking to quickly generate other content type permutations without manually going through the CCK UI.

karens’s picture

A multi-value field that currently only has one value should behave the same as what you already have, it just makes it possible to create additional fields.

I'm not sure what signup will do with multi-value fields that have more than one value, but I think we discussed that in the signup patch (or maybe that was just when it has more than one date field). Either way, you do want to be sure signup will work correctly with multi-value fields anyway, and making that change will allow you to test it.

I agree it would be nice to have more flexibility in the way this works. For D5, this is as good as it's going to get. For D6 we have the CCK API and we can create fields with that instead of trying to use Content Copy and it should give us as much flexibility as we need. But of course you'll end up with completely different code in the two versions.

karens’s picture

Status: Active » Needs review
StatusFileSize
new7.53 KB

I've created a patch to make this totally configurable by using the API in content.crud.inc instead of Content Copy. In cckdatetest_create_content_types() you'll see that it will create every possible combination of date type, widget type, and timezone handling, and it is set up so you can comment out anything you don't want to create in your profile.

It works, but does time out if you try to do everything, so it may need some batching added in.

I also added in some things that make this (IMO) a better test bed. All the date formats are set up to display the timezone as well as date and time to make it more clear what they are. Multiple values are turned on, so if you use devel_generate to create more date nodes you can test multiple value dates. It provides a way to add repeating date fields (by uncommenting the repeating date widgets). And it adds a way to turn the Devel module query logging on.

karens’s picture

Title: Turn on other date modules » Turn on other date modules and make date values configurable
StatusFileSize
new11.32 KB

I've done some more work on this and added lines for each configurable date option so you can easily see exactly what values you can alter. It makes it easy to create profiles that will test specific configurations. This patch also includes the bugfix I posted elsewhere to move the setting of the date timezone before creating the fields.

And I added settings for the site format strings along with the site timezone.

karens’s picture

StatusFileSize
new11.41 KB

A couple of the new settings weren't working quite right, here's a re-roll of the previous patch.