[html-formfu] Writing Catalyst - FormFu tests

Ascii King tech at swattermatter.com
Thu Jul 30 19:58:35 GMT 2009


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 fi=
lename`
> and then create the patch file with `svn diff > patchfile`
>
> Good luck!
> Carl
>   =

-------------- next part --------------
A non-text attachment was scrubbed...
Name: nested_repeatable_write.t
Type: application/x-troff
Size: 1969 bytes
Desc: not available
Url : http://lists.scsys.co.uk/pipermail/html-formfu/attachments/20090730/2=
faee2f0/nested_repeatable_write.t
-------------- next part --------------
---
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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: DBICTestLib.pm
Type: text/x-perl
Size: 2783 bytes
Desc: not available
Url : http://lists.scsys.co.uk/pipermail/html-formfu/attachments/20090730/2=
faee2f0/DBICTestLib.pm
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Schedule.pm
Type: text/x-perl
Size: 646 bytes
Desc: not available
Url : http://lists.scsys.co.uk/pipermail/html-formfu/attachments/20090730/2=
faee2f0/Schedule.pm
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Task.pm
Type: text/x-perl
Size: 527 bytes
Desc: not available
Url : http://lists.scsys.co.uk/pipermail/html-formfu/attachments/20090730/2=
faee2f0/Task.pm


More information about the HTML-FormFu mailing list