/[Frey]/trunk/t/01-frey-action.t
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/t/01-frey-action.t

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 385 by dpavlin, Mon Nov 17 15:42:27 2008 UTC revision 386 by dpavlin, Mon Nov 17 22:40:22 2008 UTC
# Line 4  use warnings; Line 4  use warnings;
4    
5  my $debug = @ARGV ? 1 : 0;  my $debug = @ARGV ? 1 : 0;
6    
7  use Test::More tests => 10;  use Test::More tests => 20;
8  use lib 'lib';  use lib 'lib';
9    
10  use Data::Dump qw/dump/;  use Data::Dump qw/dump/;
# Line 16  BEGIN { Line 16  BEGIN {
16  ok( my $o = Frey::Action->new( class => 'Frey::Feed', debug => $debug ), "new Frey::Feed" );  ok( my $o = Frey::Action->new( class => 'Frey::Feed', debug => $debug ), "new Frey::Feed" );
17    
18  ok( my $required = $o->required, 'required' );  ok( my $required = $o->required, 'required' );
19  diag dump( $required ) if $debug;  diag ref( $required ) if $debug;
20  isa_ok( $required, 'ARRAY', 'required' );  isa_ok( $required, 'ARRAY', 'required' );
21    
22  ok( my $attributes = $o->attributes, 'attributes' );  ok( my $attributes = $o->attributes, 'attributes' );
23  diag dump( $attributes ) if $debug;  diag dump( $attributes ) if $debug;
24  is_deeply( $attributes, ["uri", "feed", "title"], 'attributes' );  is_deeply( $attributes, ["uri", "feed", "title"], 'attributes' );
25    
26    ok( ! $o->params->{uri}, 'no uri' );
27    
28  ok( my $html = $o->params_form, 'params_form' );  ok( my $html = $o->params_form, 'params_form' );
29  diag $html if $debug;  diag $html if $debug;
30  like( $html, qr/<form/, 'has form' );  like( $html, qr/<form/, 'has form' );
31    
32    ok( ! $o->params->{uri}, "don't pollute params" );
33    
34  ok( $o = Frey::Action->new( class => 'Frey::ClassBrowser', debug => $debug ), "new Frey::ClassBrowser" );  ok( my $html2 = $o->params_form, 'params_form again' );
35  ok( ! $o->params_form, 'no form' );  diag "1: ",$html;
36    diag "2: ",$html2;
37    cmp_ok( $html, 'eq', $html2, 'repeated same form' );
38    
39    my $default;
40    ok( ($html2,$default) = $o->params_form, 'params_form again' );
41    diag "default = ",dump($default) if $debug;
42    ok( $html2, 'got form again' );
43    cmp_ok( $html, 'eq', $html2, 'html same' );
44    ok( $default->{uri}, 'uri has default' );
45    
46    ok( $o = Frey::Action->new( class => 'Frey::ClassBrowser', debug => $debug, params => { unneeded => 1 } ), "new Frey::ClassBrowser" );
47    ok( ($html2,$default) = $o->params_form, 'params_form' );
48    ok( ! $html2, 'no form' );
49    ok( $default->{unneeded}, 'preserve params' );

Legend:
Removed from v.385  
changed lines
  Added in v.386

  ViewVC Help
Powered by ViewVC 1.1.26