Show
Ignore:
Timestamp:
06/20/07 17:34:42 (17 months ago)
Author:
dom
Message:

Only linkify categories and locales if they exist (fixes #15)

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/t/51_display_node.t

    r1064 r1095  
    1313} 
    1414 
    15 plan tests => 9; 
     15plan tests => 13; 
    1616 
     17Wiki::Toolkit::Setup::SQLite::cleardb( { dbname => "t/node.db" } ); 
    1718Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } ); 
    1819my $config = OpenGuides::Config->new( 
     
    6162 
    6263unlike( $output, qr{^\QLocation: }ms, '...but not with redirect=0' ); 
     64 
     65$wiki->write_node( "Non-existent categories and locales", "foo", undef, 
     66                                { category => [ "Does not exist" ], 
     67                                  locale   => [ "Does not exist" ] } ); 
     68 
     69$output = $guide->display_node( id => 'Non-existent categories and locales', 
     70                                return_output => 1 
     71                              ); 
     72 
     73unlike( $output, qr{\Q<a href="wiki.cgi?Category_Does_Not_Exist"}, 
     74    'Category name not linked if category does not exist' ); 
     75 
     76$wiki->write_node( "Category_Does_Not_Exist", "bar", undef, undef ); 
     77 
     78$output = $guide->display_node( id => 'Non-existent categories and locales', 
     79                                return_output => 1 
     80                              ); 
     81 
     82like( $output, qr{\Q<a href="wiki.cgi?Category_Does_Not_Exist"}, 
     83    'but does when it does exist' ); 
     84 
     85unlike( $output, qr{\Q<a href="wiki.cgi?Locale_Does_Not_Exist"}, 
     86    'Locale name not linked if category does not exist' ); 
     87 
     88$wiki->write_node( "Locale_Does_Not_Exist", "wibble", undef, undef ); 
     89 
     90$output = $guide->display_node( id => 'Non-existent categories and locales', 
     91                                return_output => 1 
     92                              ); 
     93 
     94like( $output, qr{\Q<a href="wiki.cgi?Locale_Does_Not_Exist"}, 
     95    'but does when it does exist' ); 
     96 
     97