/[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

Annotation of /Webpacus2/t/00-action-Search.t

Parent Directory Parent Directory | Revision Log Revision Log


Revision 963 - (hide annotations)
Fri Nov 2 12:59:39 2007 UTC (16 years, 7 months ago) by dpavlin
File MIME type: application/x-troff
File size: 1242 byte(s)
 r1469@llin:  dpavlin | 2007-11-02 13:59:39 +0100
 rewrote results handling in Template::Declare... Now individual hits
 are returned as Webpacus::Search::DS which is data_structure from
 normalization but with accessors to get it's values

1 dpavlin 930 #!/usr/bin/env perl
2     use warnings;
3     use strict;
4    
5     =head1 DESCRIPTION
6    
7     A (very) basic test harness for the Search action.
8    
9     =cut
10    
11 dpavlin 954 use Jifty::Test tests => 17;
12 dpavlin 930
13 dpavlin 963 my $debug = 1;
14    
15 dpavlin 954 use Data::Dump qw/dump/;
16    
17 dpavlin 930 # Make sure we can load the action
18     use_ok('Webpacus::Action::Search');
19    
20 dpavlin 952 # 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 dpavlin 954
52 dpavlin 963 ok( my $ds = $results->next, 'next' );
53     isa_ok($ds, 'Webpacus::Action::DS' );
54 dpavlin 954
55     foreach my $f ( qw/database input id TitleProper/ ) {
56    
57 dpavlin 963 ok( my $d = $ds->display( $f ), 'display' );
58     diag "display: ",dump($d) if $debug;
59 dpavlin 954
60     }
61    

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.26