Ignore:
Timestamp:
Nov 26, 2004, 12:03:16 PM (17 years ago)
Author:
kake
Message:

Pull out common testing code into OpenGuides::Test

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/t/26_geo_data_search_form.t

    r561 r562  
    33use Config::Tiny;
    44use OpenGuides;
     5use OpenGuides::Test;
    56use Test::More;
    67
     
    5960my $guide = OpenGuides->new( config => $config );
    6061
    61 write_data(
    62             guide      => $guide,
    63             node       => "Banana Leaf",
    64             os_x       => 532125,
    65             os_y       => 165504,
    66           );
     62OpenGuides::Test->write_data(
     63                              guide => $guide,
     64                              node  => "Banana Leaf",
     65                              os_x  => 532125,
     66                              os_y  => 165504,
     67                            );
    6768
    6869# Display the node, check that the distance search form defaults to OS co-ords
     
    9394$guide = OpenGuides->new( config => $config );
    9495
    95 write_data(
    96             guide      => $guide,
    97             node       => "I Made This Place Up",
    98             osie_x    => 100000,
    99             osie_y    => 200000,
    100           );
     96OpenGuides::Test->write_data(
     97                              guide  => $guide,
     98                              node   => "I Made This Place Up",
     99                              osie_x => 100000,
     100                              osie_y => 200000,
     101                            );
    101102
    102103# Display node, check distance search form.
     
    125126$guide = OpenGuides->new( config => $config );
    126127
    127 write_data(
    128             guide      => $guide,
    129             node       => "London Aquarium",
    130             latitude   => 51.502,
    131             longitude => -0.118,
    132           );
     128OpenGuides::Test->write_data(
     129                              guide     => $guide,
     130                              node      => "London Aquarium",
     131                              latitude  => 51.502,
     132                              longitude => -0.118,
     133                            );
    133134
    134135# Display node, check distance search form.
     
    150151                             { name => "longitude", value => "-0.118" },
    151152                             "...includes input 'longitude' with correct value");
    152 
    153 
    154 
    155 sub write_data {
    156     my %args = @_;
    157    
    158     # Set up CGI parameters ready for a node write.
    159     # Most of these are in here to avoid uninitialised value warnings.
    160     my $q = CGI->new( "" );
    161     $q->param( -name => "content", -value => "foo" );
    162     $q->param( -name => "categories", -value => $args{categories} || "" );
    163     $q->param( -name => "locales", -value => "" );
    164     $q->param( -name => "phone", -value => "" );
    165     $q->param( -name => "fax", -value => "" );
    166     $q->param( -name => "website", -value => "" );
    167     $q->param( -name => "hours_text", -value => "" );
    168     $q->param( -name => "address", -value => "" );
    169     $q->param( -name => "postcode", -value => "" );
    170     $q->param( -name => "map_link", -value => "" );
    171     $q->param( -name => "os_x", -value => $args{os_x} || "" );
    172     $q->param( -name => "os_y", -value => $args{os_y} || "" );
    173     $q->param( -name => "osie_x", -value => $args{osie_x} || "" );
    174     $q->param( -name => "osie_y", -value => $args{osie_y} || "" );
    175     $q->param( -name => "latitude", -value => $args{latitude} || "" );
    176     $q->param( -name => "longitude", -value => $args{longitude} || "" );
    177     $q->param( -name => "username", -value => "Kake" );
    178     $q->param( -name => "comment", -value => "foo" );
    179     $q->param( -name => "edit_type", -value => "Normal edit" );
    180     $ENV{REMOTE_ADDR} = "127.0.0.1";
    181    
    182     $args{guide}->commit_node(
    183                                return_output => 1,
    184                                id => $args{node},
    185                                cgi_obj => $q,
    186                              );
    187 }
Note: See TracChangeset for help on using the changeset viewer.