/[webpac2]/Webpacus2/t/00-action-Search.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 /Webpacus2/t/00-action-Search.t

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

revision 930 by dpavlin, Wed Oct 31 10:34:38 2007 UTC revision 963 by dpavlin, Fri Nov 2 12:59:39 2007 UTC
# Line 8  A (very) basic test harness for the Sear Line 8  A (very) basic test harness for the Sear
8    
9  =cut  =cut
10    
11  use Jifty::Test tests => 1;  use Jifty::Test tests => 17;
12    
13    my $debug = 1;
14    
15    use Data::Dump qw/dump/;
16    
17  # Make sure we can load the action  # Make sure we can load the action
18  use_ok('Webpacus::Action::Search');  use_ok('Webpacus::Action::Search');
19    
20    # Grab a system user
21    my $system_user = Webpacus::CurrentUser->superuser;
22    ok($system_user, "Found a system user");
23    
24    {
25            use Log::Log4perl::Level;
26            Jifty->web->log->level( $DEBUG );
27    }
28    
29    my $search = Jifty::Test->web->new_action(
30        class        => 'Search',
31        moniker      => 'search',
32        current_user => $system_user,
33        arguments    => {}
34    );
35    
36    isa_ok($search, 'Webpacus::Action::Search');
37    
38    my %args = %{$search->arguments};
39    
40    ok($args{$_}, "arguments has $_") foreach ( 'field', 'query' );
41    
42    $search->argument_values({ feild => '', query => 'a' });
43    $search->run;
44    
45    my $results = $search->result->content('results');
46    
47    isa_ok($results, 'Webpacus::Search::Results');
48    cmp_ok($results->count, '>=', 1, 'count');
49    
50    diag "found ", $results->count, " results";
51    
52    ok( my $ds = $results->next, 'next' );
53    isa_ok($ds, 'Webpacus::Action::DS' );
54    
55    foreach my $f ( qw/database input id TitleProper/ ) {
56    
57            ok( my $d = $ds->display( $f ), 'display' );
58            diag "display: ",dump($d) if $debug;
59    
60    }
61    

Legend:
Removed from v.930  
changed lines
  Added in v.963

  ViewVC Help
Powered by ViewVC 1.1.26