Changeset 1063


Ignore:
Timestamp:
Jun 10, 2007, 6:31:17 PM (14 years ago)
Author:
Dagfinn Ilmari Mannsåker
Message:

Convert t/21_rdf.t to use OpenGuides::Test->write_data and extend this as needed

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/OpenGuides/Test.pm

    r992 r1063  
    166166  my $q = OpenGuides::Test->make_cgi_object;
    167167
    168 You can supply values for the following keys: C<content>,
    169 C<categories>, C<locales>, C<os_x>, C<os_y>, C<osie_x>, C<osie_y>,
    170 C<latitude>, C<longitude>, C<summary>, C<node_image>, C<node_image_licence>,
    171 C<node_image_copyright>, C<node_image_url>, C<username>, C<comment>,
    172 C<edit_type>.  You should supply them exactly as they would come from a CGI
    173 form, eg lines in a textarea are separated by C<\r\n>.
     168You can supply values for the following keys: C<content>, C<categories>,
     169C<locales>, C<node_image>, C<node_image_licence>,
     170C<node_image_copyright>, C<node_image_url>, C<phone>, C<fax>,
     171C<website>, C<hours_text>, C<address>, C<postcode>, C<map_link>,
     172C<os_x>, C<os_y>, C<osie_x>, C<osie_y>, C<latitude>, C<longitude>,
     173C<summary>, C<username>, C<comment>, C<edit_type>.  You should supply
     174them exactly as they would come from a CGI form, eg lines in a textarea
     175are separated by C<\r\n>.
    174176
    175177=cut
     
    181183    # Most of these are in here to avoid uninitialised value warnings.
    182184    my $q = CGI->new( "" );
    183     $q->param( -name => "content", -value => $args{content} || "foo" );
    184     $q->param( -name => "categories", -value => $args{categories} || "" );
    185     $q->param( -name => "locales", -value => $args{locales} || "" );
    186     $q->param( -name => "node_image", -value => $args{node_image} || "" );
    187     $q->param( -name => "node_image_licence",
    188                -value => $args{node_image_licence} || "" );
    189     $q->param( -name => "node_image_copyright",
    190                -value => $args{node_image_copyright} || "" );
    191     $q->param( -name => "node_image_url",
    192                -value => $args{node_image_url} || "" );
    193     $q->param( -name => "phone", -value => "" );
    194     $q->param( -name => "fax", -value => "" );
    195     $q->param( -name => "website", -value => "" );
    196     $q->param( -name => "hours_text", -value => "" );
    197     $q->param( -name => "address", -value => "" );
    198     $q->param( -name => "postcode", -value => "" );
    199     $q->param( -name => "map_link", -value => "" );
    200     $q->param( -name => "os_x", -value => $args{os_x} || "" );
    201     $q->param( -name => "os_y", -value => $args{os_y} || "" );
    202     $q->param( -name => "osie_x", -value => $args{osie_x} || "" );
    203     $q->param( -name => "osie_y", -value => $args{osie_y} || "" );
    204     $q->param( -name => "latitude", -value => $args{latitude} || "" );
    205     $q->param( -name => "longitude", -value => $args{longitude} || "" );
    206     $q->param( -name => "summary", -value => $args{summary} || "" );
    207     $q->param( -name => "username", -value => $args{username} || "TestUser" );
    208     $q->param( -name => "comment", -value => $args{comment} || "A comment." );
    209     $q->param( -name => "edit_type",
    210                -value => $args{edit_type} || "Normal edit" );
     185    $args{content} ||= "foo";
     186    $args{edit_type} ||= "Normal edit";
     187    for my $param ( qw( content categories locales node_image node_image_licence
     188                        node_image_copyright node_image_url phone fax website
     189                        hours_text address postcode map_link os_x os_y osie_x osie_y
     190                        latitude longitude summary username comment edit_type
     191                      )
     192                  ) {
     193        $q->param( -name => $param, -value => $args{$param} || "" );
     194    }
    211195    $ENV{REMOTE_ADDR} = "127.0.0.1";
    212196
  • trunk/t/21_rdf.t

    r1060 r1063  
    3030
    3131
    32 my $wiki = OpenGuides::Utils->make_wiki_object( config => $config );
     32my $guide = OpenGuides->new( config => $config );
     33my $wiki = $guide->wiki;
    3334
    3435# Clear out the database from any previous runs.
     
    4445
    4546# Test the data for a node that exists.
    46 $wiki->write_node( "Calthorpe Arms",
    47     "CAMRA-approved pub near King's Cross",
    48     undef,
    49     {
     47OpenGuides::Test->write_data(
     48        guide              => $guide,
     49        node               => "Calthorpe Arms",
     50        content            => "CAMRA-approved pub near King's Cross",
    5051        comment            => "Stub page, please update!",
    5152        username           => "Kake",
    5253        postcode           => "WC1X 8JR",
    53         locale             => [ "Bloomsbury", "St Pancras" ],
     54        locales            => "Bloomsbury\r\nSt Pancras",
    5455        phone              => "test phone number",
    5556        website            => "test website",
    56         opening_hours_text => "test hours",
     57        hours_text        => "test hours",
    5758        latitude           => "51.524193",
    5859        longitude          => "-0.114436",
    5960        summary            => "a nice pub",
    60     }
    6161);
    6262
     
    106106$config->default_city( "" );
    107107$config->default_country( "" );
    108 my $guide = OpenGuides->new( config => $config );
     108$guide = OpenGuides->new( config => $config );
    109109OpenGuides::Test->write_data(
    110110                                guide => $guide,
Note: See TracChangeset for help on using the changeset viewer.