[html-formfu] Writing Catalyst - FormFu tests
Carl Franks
fireartist at gmail.com
Fri Aug 7 13:05:18 GMT 2009
Hi Ascii,
I've fixed HTML-FormFu - it wasn't handling counter names / values
properly in nested repeatables.
It now takes $self->counter_name,
and then searches up the parent hierarchy for a field matching that name,
it then uses that field's nested_name() to retrieve the correct count-value.
I'll test and apply your files once the svn build is unbroken :)
Cheers,
Carl
2009/7/30 Ascii King <tech at swattermatter.com>:
> OK. So, three months later I have the test files done that will test the
> ability to write to a repeatable nested within another repeatable in
> HTML-FormFu-Model-DBIC. I am a little afraid to commit these to the
> trunk(?), though because I don't want to mess up everything.
>
> I have attached the test files and the files I have altered. I have also
> documented my changes.
>
> The tests create the following relationship
> Master -> has_many -> Schedule
> Schedule -> has_many -> Task
>
> It then creates a record in Master and two associated records in Schedule.
> It then creates two records in Task that are both associated with the
> second record in Schedule.
> It then tries to use the form to change the records.
>
> It successfully changes the first associated record in Task. (Test 5)
> It fails to change the second associated record in Task. (Test 7)
>
> What can I do to get this fixed? I'm willing to help, but I'm not a strong
> programmer.
>
>
> Carl Franks wrote:
>>
>> Yes - that's a good example.
>>
>> You'll need to checkout the entire distribution with
>> svn co
>> http://html-formfu.googlecode.com/svn/trunk/HTML-FormFu-Model-DBIC
>>
>> The test schema is described in t/lib/MySchema/
>> If there's no suitable repeatable->repeatable relationships - if you
>> create any new tables, then as well as updating the schema, you'll
>> also need to update new_db() in t/lib/DBICTestLib.pm which is called
>> by each test file to create the sqlite database.
>>
>> Rather than `make test`, I prefer using `prove` to run the test files,
>> as it lets you run an individual test file.
>> You'll need to install Test-Harness to get `prove`.
>> prove -l t/update/has_many_repeatable.t
>>
>> To create a patch file, you'll need to add any new files with `svn add
>> filename`
>> and then create the patch file with `svn diff > patchfile`
>>
>> Good luck!
>> Carl
>>
>
> ---
> auto_fieldset: 1
>
> elements:
> - type: Hidden
> name: id
>
> - type: Hidden
> name: sched_count
>
> - type: Repeatable
> nested_name: schedules
> counter_name: sched_count
> elements:
>
> - type: Hidden
> name: id
>
> - type: Text
> name: note
>
> - type: Hidden
> name: count
>
> - type: Repeatable
> nested_name: tasks
> counter_name: count
>
> elements:
> - type: Hidden
> name: id
>
> - type: Text
> name: detail
>
> - type: Submit
> name: submit
>
>
> _______________________________________________
> HTML-FormFu mailing list
> HTML-FormFu at lists.scsys.co.uk
> http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu
>
More information about the HTML-FormFu
mailing list