/[Frey]/branches/zimbardo/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

Contents of /branches/zimbardo/t/01-Frey-Action.t

Parent Directory Parent Directory | Revision Log Revision Log


Revision 928 - (show annotations)
Mon Jan 5 23:14:07 2009 UTC (15 years, 3 months ago) by dpavlin
Original Path: trunk/t/01-Frey-Action.t
File MIME type: application/x-troff
File size: 1914 byte(s)
fix required params
1 #!/usr/bin/perl
2 use strict;
3 use warnings;
4
5 my $debug = @ARGV ? 1 : 0;
6
7 use Test::More tests => 26;
8 use lib 'lib';
9
10 use Data::Dump qw/dump/;
11
12 BEGIN {
13 use_ok('Frey::Action');
14 }
15
16 ok( my $o = Frey::Action->new( class => 'Frey::Feed', debug => $debug ), "new Frey::Feed" );
17
18 ok( my $required = $o->required, 'required' );
19 diag ref( $required ) if $debug;
20 isa_ok( $required, 'ARRAY', 'required' );
21
22 ok( my $attributes = $o->attributes, 'attributes' );
23 diag dump( $attributes ) if $debug;
24 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' );
29 diag $html if $debug;
30 like( $html, qr/<form/, 'has form' );
31 unlike( $html, qr/HASH/, 'no HASH' );
32
33 ok( ! $o->params->{uri}, "don't pollute params" );
34
35 ok( my $html2 = $o->params_form, 'params_form again' );
36 diag "1: ",$html;
37 diag "2: ",$html2;
38 cmp_ok( $html, 'eq', $html2, 'repeated same form' );
39
40 my $default;
41 ok( ($html2,$default) = $o->params_form, 'params_form again' );
42 diag "default = ",dump($default) if $debug;
43 ok( $html2, 'got form again' );
44 cmp_ok( $html, 'eq', $html2, 'html same' );
45 ok( $default->{uri}, 'uri has default' );
46
47 ok( $o = Frey::Action->new( class => 'Frey::Class::Browser', debug => $debug, params => { unneeded => 1 } ), "new Frey::Class::Browser" );
48 ok( ($html2,$default) = $o->params_form, 'params_form' );
49 ok( ! $html2, 'no form' );
50 ok( $default->{unneeded}, 'preserve params' );
51
52 ok( $o = Frey::Action->new( class => 'Frey::Introspect', debug => $debug ), "new Frey::Introspect" );
53 ok( $html = $o->params_form, 'params_form' );
54 diag $html if $debug;
55 like( $html, qr/class/, 'required form field class' );
56
57 ok( $o = Frey::Action->new( class => 'Frey::Introspect', params => { request_url => '/', class => 'Frey' }, debug => $debug ), "new Frey::Introspect" );
58 ok( ! $o->params_form, 'params_form empty' );
59 diag $o->params_form if $o->params_form;
60

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.26