On 9/24/07, Carl Franks <[EMAIL PROTECTED]> wrote: > On 24/09/2007, Zbigniew Lukasiak <[EMAIL PROTECTED]> wrote: > > This thread reminds me of my other idea - how about letting the form > > to load the config from a string instead of a file? This would let > > you create some more self-containing tests. > > Can you give an example of what you're thinking of?
Sure. When I write tests I need to create two files - the test itself and the config file. For example - this is my test: my $form = HTML::FormFu->new( { stash => { schema => $schema } } ); $form->load_config_file('t/var/config.yml'); my $by_pkey = $form->get_element( { name => 'by_pkey' } ); my $options = $by_pkey->_options; is ( scalar @$options, 3, 'Number of options' ); It would be simpler if I could provide the config directly in the test: my $form = HTML::FormFu->new( { stash => { schema => $schema } } ); my $config = " --- elements: - type: MySelect name: by_pkey resultset: User search_attr: order_by: - id - type: MySelect name: name resultset: User presentation: name search_attr: order_by: - id - type: MySelect name: where resultset: User presentation: name search_attr: where: id: 3 order_by: - id " $form->load_config( $config ); Then - when writing about some bug I could just send one self containing test case - and you could just run it and see the results. -- Zbigniew Lukasiak http://brudnopis.blogspot.com/ _______________________________________________ HTML-FormFu mailing list HTML-FormFu@lists.scsys.co.uk http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu