File: belongs_to_localize_label.t

package info (click to toggle)
libhtml-formfu-model-dbic-perl 0.06000-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 1,252 kB
  • ctags: 147
  • sloc: perl: 2,112; makefile: 2
file content (36 lines) | stat: -rw-r--r-- 677 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
use strict;
use warnings;
use Test::More tests => 3;

use HTML::FormFu;
use lib 't/lib';
use DBICTestLib 'new_schema';
use MySchema;
my $form = HTML::FormFu->new;

$form->load_config_file('t/options_from_model/belongs_to_localize_label.yml');

my $schema = new_schema();

$form->stash->{schema} = $schema;

my $type_rs  = $schema->resultset('Type');

{

    # types
    $type_rs->delete;
    $type_rs->create( { type => 'label_foo' } );
    $type_rs->create( { type => 'label_bar' } );
}

$form->process;

{
    my $option = $form->get_field('type')->options;
    
    ok( @$option == 2 );
    
    is( $option->[0]->{label}, 'Foo' );
    is( $option->[1]->{label}, 'Bar' );
}