Author: dom Date: 2009-09-04 23:24:51 +0100 (Fri, 04 Sep 2009) New Revision: 1273
Modified: trunk/Changes trunk/lib/OpenGuides/Test.pm trunk/t/01_load.t trunk/t/11_utils.t trunk/t/12_macros.t trunk/t/14_recent_changes_cookies.t trunk/t/16_test_tester.t trunk/t/17_commit_node.t trunk/t/19_autocreate.t trunk/t/20_edit_form.t trunk/t/21_rdf.t trunk/t/22_feed_recent_changes.t trunk/t/23_feed_node_all_versions.t trunk/t/24_feed_node_listings.t trunk/t/25_write_geo_data.t trunk/t/26_geo_data_search_form.t trunk/t/27_geo_data_edit_form.t trunk/t/28_wgs84_coords.t trunk/t/30_search_raw.t trunk/t/31_search.t trunk/t/32_search_simple_metadata.t trunk/t/33_search_advanced_search.t trunk/t/33_search_advanced_search_utm.t trunk/t/34_search_paging.t trunk/t/35_search_two_searches.t trunk/t/36_search_order.t trunk/t/37_search_summaries.t trunk/t/38_search_params.t trunk/t/39_search_form.t trunk/t/40_search_as_feed.t trunk/t/42_edit_conflict.t trunk/t/43_preview_edits.t trunk/t/44_node_image.t trunk/t/45_home_recent_changes.t trunk/t/46_map_in_node_display.t trunk/t/47_navbar_placement.t trunk/t/48_google_analytics.t trunk/t/49_custom_header.t trunk/t/51_display_node.t trunk/t/52_display_diffs.t trunk/t/53_show_index.t trunk/t/54_redirect.t trunk/t/55_node_history.t trunk/t/56_diffs_with_macros.t trunk/t/57_random_page.t trunk/t/58_navbar_common_locales_categories.t trunk/t/59_preferences.t trunk/t/61_bug_textareas.t trunk/t/62_bug_trailing_whitespace.t trunk/t/63_bug_map_link_no_address.t trunk/t/64_bug_node_history.t trunk/t/65_bug_metadata_escape.t trunk/t/66_bug_latlong_representation.t trunk/t/67_bug_first_version.t trunk/t/68_bug_website_displayed.t trunk/t/69_bug_zero_geo.t trunk/t/70_admin_home.t trunk/t/71_missing_metadata.t trunk/t/72_node_moderation.t trunk/t/73_toggle_moderation.t trunk/t/74_ping_plugin.t trunk/t/75_revert_user.t trunk/t/76_detect_spam.t trunk/t/79_host_blacklist.t trunk/t/81_node_moderate_whitelist.t trunk/t/83_show_delete_to_admins_only.t trunk/t/84_navbar_admin.t trunk/t/85_universal_edit_link.t trunk/t/86_recent_changes.t Log: test cleanups for refreshing the test db (thanks bob) (fixes #271)
Modified: trunk/Changes =================================================================== --- trunk/Changes 2009-08-10 17:06:11 UTC (rev 1272) +++ trunk/Changes 2009-09-04 22:24:51 UTC (rev 1273) @@ -8,6 +8,7 @@ Don't display revision info for nodes that don't exist (#193) Return HTTP 404 status when displaying a node that doens't exist (#102) Add Recent Changes tests (refers to #270) + Some test cleanups (#271)
0.64 23 February 2009 Correctly specify all build_requires (#245)
Modified: trunk/lib/OpenGuides/Test.pm =================================================================== --- trunk/lib/OpenGuides/Test.pm 2009-08-10 17:06:11 UTC (rev 1272) +++ trunk/lib/OpenGuides/Test.pm 2009-09-04 22:24:51 UTC (rev 1273) @@ -1,6 +1,7 @@ package OpenGuides::Test;
use OpenGuides::Config; +use Wiki::Toolkit::Setup::SQLite;
use strict; use vars qw( $VERSION ); @@ -24,6 +25,8 @@ use OpenGuides; use OpenGuides::Test;
+ OpenGuides::Test::refresh_db(); + my $config = OpenGuides::Test->make_basic_config; $config->default_language( "nl" );
@@ -201,6 +204,20 @@ return $q; }
+=item B<refresh_db> + + Openguides::Test::refresh_db(); + +Unlink the existing SQLite database t/node.db and plucene indexes. Then create a new SQLite database t/node.db + +=cut +sub refresh_db { + unlink "t/node.db"; + unlink <t/indexes/*>; + Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } ); +} + + =back
=head1 AUTHOR
Modified: trunk/t/01_load.t =================================================================== --- trunk/t/01_load.t 2009-08-10 17:06:11 UTC (rev 1272) +++ trunk/t/01_load.t 2009-09-04 22:24:51 UTC (rev 1273) @@ -1,3 +1,4 @@ +use strict; use Test::More tests => 8;
use_ok( "OpenGuides" );
Modified: trunk/t/11_utils.t =================================================================== --- trunk/t/11_utils.t 2009-08-10 17:06:11 UTC (rev 1272) +++ trunk/t/11_utils.t 2009-09-04 22:24:51 UTC (rev 1273) @@ -2,6 +2,7 @@ use Wiki::Toolkit::Setup::SQLite; use OpenGuides::Config; use OpenGuides::Utils; +use OpenGuides::Test; use Test::More tests => 10;
eval { my $wiki = OpenGuides::Utils->make_wiki_object; }; @@ -33,10 +34,9 @@ unless $have_sqlite;
# Clear out the database from any previous runs. - unlink "t/node.db"; - unlink <t/indexes/*>; - Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } ); + OpenGuides::Test::refresh_db();
+ my $config = OpenGuides::Config->new( vars => { dbtype => "sqlite",
Modified: trunk/t/12_macros.t =================================================================== --- trunk/t/12_macros.t 2009-08-10 17:06:11 UTC (rev 1272) +++ trunk/t/12_macros.t 2009-09-04 22:24:51 UTC (rev 1273) @@ -15,9 +15,7 @@
SKIP: { # Clear out the database from any previous runs. - unlink "t/node.db"; - unlink <t/indexes/*>; - Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } ); + OpenGuides::Test::refresh_db();
my $config = OpenGuides::Test->make_basic_config; my $guide = OpenGuides->new( config => $config );
Modified: trunk/t/14_recent_changes_cookies.t =================================================================== --- trunk/t/14_recent_changes_cookies.t 2009-08-10 17:06:11 UTC (rev 1272) +++ trunk/t/14_recent_changes_cookies.t 2009-09-04 22:24:51 UTC (rev 1273) @@ -3,6 +3,7 @@ use OpenGuides::Config; use OpenGuides; use OpenGuides::CGI; +use OpenGuides::Test; use Time::Piece; use Time::Seconds; use Test::More tests => 11; @@ -62,8 +63,9 @@ SKIP: { skip "DBD::SQLite could not be used - no database to test with. ($sqlite_error)", 2 unless $have_sqlite; + OpenGuides::Test::refresh_db();
- Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } ); + my $config = OpenGuides::Config->new( vars => { dbtype => "sqlite",
Modified: trunk/t/16_test_tester.t =================================================================== --- trunk/t/16_test_tester.t 2009-08-10 17:06:11 UTC (rev 1272) +++ trunk/t/16_test_tester.t 2009-09-04 22:24:51 UTC (rev 1273) @@ -17,11 +17,10 @@
plan tests => 2;
+ # Clear out the database from any previous runs. -unlink "t/node.db"; -unlink <t/indexes/*>; + OpenGuides::Test::refresh_db();
-Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } ); my $config = OpenGuides::Test->make_basic_config; $config->site_name( "Test Site" ); my $guide = OpenGuides->new( config => $config );
Modified: trunk/t/17_commit_node.t =================================================================== --- trunk/t/17_commit_node.t 2009-08-10 17:06:11 UTC (rev 1272) +++ trunk/t/17_commit_node.t 2009-09-04 22:24:51 UTC (rev 1273) @@ -22,10 +22,8 @@ plan tests => 7;
# Clear out the database from any previous runs. -unlink "t/node.db"; -unlink <t/indexes/*>; + OpenGuides::Test::refresh_db();
-Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } ); my $config = OpenGuides::Config->new( vars => { dbtype => "sqlite",
Modified: trunk/t/19_autocreate.t =================================================================== --- trunk/t/19_autocreate.t 2009-08-10 17:06:11 UTC (rev 1272) +++ trunk/t/19_autocreate.t 2009-09-04 22:24:51 UTC (rev 1273) @@ -18,10 +18,7 @@ my $wiki = $guide->wiki;
# Clear out the database from any previous runs. -foreach my $del_node ( $wiki->list_all_nodes ) { - print "# Deleting node $del_node\n"; - $wiki->delete_node( $del_node ) or die "Can't delete $del_node"; -} + OpenGuides::Test::refresh_db();
# Write a custom template to autofill content in autocreated nodes. eval {
Modified: trunk/t/20_edit_form.t =================================================================== --- trunk/t/20_edit_form.t 2009-08-10 17:06:11 UTC (rev 1272) +++ trunk/t/20_edit_form.t 2009-09-04 22:24:51 UTC (rev 1273) @@ -18,9 +18,7 @@ plan tests => 1;
# Clear out the database from any previous runs. -unlink "t/node.db"; -unlink <t/indexes/*>; -Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } ); + OpenGuides::Test::refresh_db();
my $config = OpenGuides::Test->make_basic_config; my $guide = OpenGuides->new( config => $config );
Modified: trunk/t/21_rdf.t =================================================================== --- trunk/t/21_rdf.t 2009-08-10 17:06:11 UTC (rev 1272) +++ trunk/t/21_rdf.t 2009-09-04 22:24:51 UTC (rev 1273) @@ -1,3 +1,4 @@ +use strict; use Wiki::Toolkit::Setup::SQLite; use OpenGuides; use OpenGuides::Config; @@ -17,7 +18,10 @@
plan tests => 30;
-Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } ); +# clear out the database +OpenGuides::Test::refresh_db(); + + my $config = OpenGuides::Test->make_basic_config; $config->script_url( "http://wiki.example.com/" ); $config->script_name( "mywiki.cgi" ); @@ -33,10 +37,6 @@ my $guide = OpenGuides->new( config => $config ); my $wiki = $guide->wiki;
-# Clear out the database from any previous runs. -foreach my $del_node ( $wiki->list_all_nodes ) { - $wiki->delete_node( $del_node ) or die "Can't delete $del_node"; -}
my $rdf_writer = eval { OpenGuides::RDF->new( wiki => $wiki, config => $config );
Modified: trunk/t/22_feed_recent_changes.t =================================================================== --- trunk/t/22_feed_recent_changes.t 2009-08-10 17:06:11 UTC (rev 1272) +++ trunk/t/22_feed_recent_changes.t 2009-09-04 22:24:51 UTC (rev 1273) @@ -27,10 +27,8 @@
foreach my $feed_type (@feed_types) { # Clear out the database from any previous runs. - unlink "t/node.db"; - unlink <t/indexes/*>; + OpenGuides::Test::refresh_db();
- Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } ); my $config = OpenGuides::Test->make_basic_config; $config->script_name( "wiki.cgi" ); $config->script_url( "http://example.com/" );
Modified: trunk/t/23_feed_node_all_versions.t =================================================================== --- trunk/t/23_feed_node_all_versions.t 2009-08-10 17:06:11 UTC (rev 1272) +++ trunk/t/23_feed_node_all_versions.t 2009-09-04 22:24:51 UTC (rev 1273) @@ -4,6 +4,7 @@ use OpenGuides; use OpenGuides::Feed; use OpenGuides::Utils; +use OpenGuides::Test; use Test::More;
eval { require DBD::SQLite; }; @@ -25,10 +26,8 @@
foreach my $feed_type (@feed_types) { # Clear out the database from any previous runs. - unlink "t/node.db"; - unlink <t/indexes/*>; + OpenGuides::Test::refresh_db();
- Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } ); my $config = OpenGuides::Config->new( vars => { dbtype => "sqlite",
Modified: trunk/t/24_feed_node_listings.t =================================================================== --- trunk/t/24_feed_node_listings.t 2009-08-10 17:06:11 UTC (rev 1272) +++ trunk/t/24_feed_node_listings.t 2009-09-04 22:24:51 UTC (rev 1273) @@ -4,6 +4,7 @@ use OpenGuides; use OpenGuides::Feed; use OpenGuides::Utils; +use OpenGuides::Test; use Test::More;
eval { require DBD::SQLite; }; @@ -25,10 +26,8 @@
foreach my $feed_type (@feed_types) { # Clear out the database from any previous runs. - unlink "t/node.db"; - unlink <t/indexes/*>; + OpenGuides::Test::refresh_db();
- Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } ); my $config = OpenGuides::Config->new( vars => { dbtype => "sqlite",
Modified: trunk/t/25_write_geo_data.t =================================================================== --- trunk/t/25_write_geo_data.t 2009-08-10 17:06:11 UTC (rev 1272) +++ trunk/t/25_write_geo_data.t 2009-09-04 22:24:51 UTC (rev 1273) @@ -33,10 +33,8 @@ plan tests => 53;
# Clear out the database from any previous runs. -unlink "t/node.db"; -unlink <t/indexes/*>; + OpenGuides::Test::refresh_db();
-Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } ); my $config = OpenGuides::Config->new( vars => { dbtype => "sqlite",
Modified: trunk/t/26_geo_data_search_form.t =================================================================== --- trunk/t/26_geo_data_search_form.t 2009-08-10 17:06:11 UTC (rev 1272) +++ trunk/t/26_geo_data_search_form.t 2009-09-04 22:24:51 UTC (rev 1273) @@ -37,10 +37,8 @@ plan tests => 12;
# Clear out the database from any previous runs. -unlink "t/node.db"; -unlink <t/indexes/*>; + OpenGuides::Test::refresh_db();
-Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } ); my $config = OpenGuides::Test->make_basic_config; $config->use_plucene( 1 );
Modified: trunk/t/27_geo_data_edit_form.t =================================================================== --- trunk/t/27_geo_data_edit_form.t 2009-08-10 17:06:11 UTC (rev 1272) +++ trunk/t/27_geo_data_edit_form.t 2009-09-04 22:24:51 UTC (rev 1273) @@ -37,10 +37,8 @@ plan tests => 18;
# Clear out the database from any previous runs. -unlink "t/node.db"; -unlink <t/indexes/*>; + OpenGuides::Test::refresh_db();
-Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } ); my $config = OpenGuides::Test->make_basic_config; $config->use_plucene( 1 );
Modified: trunk/t/28_wgs84_coords.t =================================================================== --- trunk/t/28_wgs84_coords.t 2009-08-10 17:06:11 UTC (rev 1272) +++ trunk/t/28_wgs84_coords.t 2009-09-04 22:24:51 UTC (rev 1273) @@ -14,10 +14,9 @@ plan tests => 6;
# Clear out the database from any previous runs. -unlink "t/node.db"; -# And give us a new one -Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } );
+ OpenGuides::Test::refresh_db(); + # Now we can start testing my $config = OpenGuides::Test->make_basic_config; $config->force_wgs84 (1);
Modified: trunk/t/30_search_raw.t =================================================================== --- trunk/t/30_search_raw.t 2009-08-10 17:06:11 UTC (rev 1272) +++ trunk/t/30_search_raw.t 2009-09-04 22:24:51 UTC (rev 1273) @@ -13,10 +13,8 @@ plan tests => 16;
# Clear out the database from any previous runs. -unlink "t/node.db"; -unlink <t/indexes/*>; + OpenGuides::Test::refresh_db();
-Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } ); my $config = OpenGuides::Test->make_basic_config; my $guide = OpenGuides->new( config => $config ); my $search = OpenGuides::Search->new( config => $config );
Modified: trunk/t/31_search.t =================================================================== --- trunk/t/31_search.t 2009-08-10 17:06:11 UTC (rev 1272) +++ trunk/t/31_search.t 2009-09-04 22:24:51 UTC (rev 1273) @@ -13,10 +13,8 @@ plan tests => 18;
# Clear out the database from any previous runs. -unlink "t/node.db"; -unlink <t/indexes/*>; + OpenGuides::Test::refresh_db();
-Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } ); my $config = OpenGuides::Test->make_basic_config; $config->script_name( "wiki.cgi" ); $config->script_url( "http://example.com/" ); @@ -152,4 +150,4 @@ }, ); like( $output, qr/ol start="21"/, - "second page of results starts with right numbering" ); \ No newline at end of file + "second page of results starts with right numbering" );
Modified: trunk/t/32_search_simple_metadata.t =================================================================== --- trunk/t/32_search_simple_metadata.t 2009-08-10 17:06:11 UTC (rev 1272) +++ trunk/t/32_search_simple_metadata.t 2009-09-04 22:24:51 UTC (rev 1273) @@ -2,6 +2,7 @@ use Wiki::Toolkit::Setup::SQLite; use OpenGuides::Config; use OpenGuides::Search; +use OpenGuides::Test; use Test::More;
eval { require DBD::SQLite; }; @@ -14,10 +15,8 @@ plan tests => 10;
# Clear out the database from any previous runs. -unlink "t/node.db"; -unlink <t/indexes/*>; + OpenGuides::Test::refresh_db();
-Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } ); my $config = OpenGuides::Config->new( vars => { dbtype => "sqlite",
Modified: trunk/t/33_search_advanced_search.t =================================================================== --- trunk/t/33_search_advanced_search.t 2009-08-10 17:06:11 UTC (rev 1272) +++ trunk/t/33_search_advanced_search.t 2009-09-04 22:24:51 UTC (rev 1273) @@ -25,10 +25,9 @@ plan tests => 8;
# Clear out the database from any previous runs. -unlink "t/node.db"; -unlink <t/indexes/*>; -Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } );
+ OpenGuides::Test::refresh_db(); + my $config = OpenGuides::Config->new( vars => { dbtype => "sqlite",
Modified: trunk/t/33_search_advanced_search_utm.t =================================================================== --- trunk/t/33_search_advanced_search_utm.t 2009-08-10 17:06:11 UTC (rev 1272) +++ trunk/t/33_search_advanced_search_utm.t 2009-09-04 22:24:51 UTC (rev 1273) @@ -24,10 +24,9 @@ plan tests => 4;
# Clear out the database from any previous runs. -unlink "t/node.db"; -unlink <t/indexes/*>; -Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } );
+ OpenGuides::Test::refresh_db(); + my $config = OpenGuides::Config->new( vars => { dbtype => "sqlite",
Modified: trunk/t/34_search_paging.t =================================================================== --- trunk/t/34_search_paging.t 2009-08-10 17:06:11 UTC (rev 1272) +++ trunk/t/34_search_paging.t 2009-09-04 22:24:51 UTC (rev 1273) @@ -19,10 +19,9 @@ plan tests => 18;
# Clear out the database from any previous runs. -unlink "t/node.db"; -unlink <t/indexes/*>; -Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } ); + OpenGuides::Test::refresh_db();
+ my $config = OpenGuides::Test->make_basic_config; $config->use_plucene( 1 ); my $search = OpenGuides::Search->new( config => $config );
Modified: trunk/t/35_search_two_searches.t =================================================================== --- trunk/t/35_search_two_searches.t 2009-08-10 17:06:11 UTC (rev 1272) +++ trunk/t/35_search_two_searches.t 2009-09-04 22:24:51 UTC (rev 1273) @@ -2,6 +2,7 @@ use Wiki::Toolkit::Setup::SQLite; use OpenGuides::Config; use OpenGuides::Search; +use OpenGuides::Test; use Test::More;
eval { require DBD::SQLite; }; @@ -32,10 +33,8 @@ plan tests => 10;
# Clear out the database from any previous runs. -unlink "t/node.db"; -unlink <t/indexes/*>; + OpenGuides::Test::refresh_db();
-Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } ); my $config = OpenGuides::Config->new( vars => { dbtype => "sqlite",
Modified: trunk/t/36_search_order.t =================================================================== --- trunk/t/36_search_order.t 2009-08-10 17:06:11 UTC (rev 1272) +++ trunk/t/36_search_order.t 2009-09-04 22:24:51 UTC (rev 1273) @@ -2,6 +2,7 @@ use Wiki::Toolkit::Setup::SQLite; use OpenGuides::Config; use OpenGuides::Search; +use OpenGuides::Test; use Test::More;
eval { require DBD::SQLite; }; @@ -18,10 +19,8 @@ plan tests => 9;
# Clear out the database from any previous runs. -unlink "t/node.db"; -unlink <t/indexes/*>; + OpenGuides::Test::refresh_db();
-Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } ); my $config = OpenGuides::Config->new( vars => { dbtype => "sqlite",
Modified: trunk/t/37_search_summaries.t =================================================================== --- trunk/t/37_search_summaries.t 2009-08-10 17:06:11 UTC (rev 1272) +++ trunk/t/37_search_summaries.t 2009-09-04 22:24:51 UTC (rev 1273) @@ -2,6 +2,7 @@ use Wiki::Toolkit::Setup::SQLite; use OpenGuides::Config; use OpenGuides::Search; +use OpenGuides::Test; use Test::More;
eval { require DBD::SQLite; }; @@ -13,10 +14,8 @@ plan tests => 2;
# Clear out the database from any previous runs. -unlink "t/node.db"; -unlink <t/indexes/*>; + OpenGuides::Test::refresh_db();
-Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } ); my $config = OpenGuides::Config->new( vars => { dbtype => "sqlite",
Modified: trunk/t/38_search_params.t =================================================================== --- trunk/t/38_search_params.t 2009-08-10 17:06:11 UTC (rev 1272) +++ trunk/t/38_search_params.t 2009-09-04 22:24:51 UTC (rev 1273) @@ -3,6 +3,7 @@ use Wiki::Toolkit::Setup::SQLite; use OpenGuides::Config; use OpenGuides::Search; +use OpenGuides::Test; use Test::More;
eval { require DBD::SQLite; }; @@ -32,10 +33,8 @@ plan tests => 19;
# Clear out the database from any previous runs. -unlink "t/node.db"; -unlink <t/indexes/*>; + OpenGuides::Test::refresh_db();
-Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } ); my $config = OpenGuides::Config->new( vars => { dbtype => "sqlite",
Modified: trunk/t/39_search_form.t =================================================================== --- trunk/t/39_search_form.t 2009-08-10 17:06:11 UTC (rev 1272) +++ trunk/t/39_search_form.t 2009-09-04 22:24:51 UTC (rev 1273) @@ -37,10 +37,8 @@ plan tests => 27;
# Clear out the database from any previous runs. -unlink "t/node.db"; -unlink <t/indexes/*>; + OpenGuides::Test::refresh_db();
-Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } ); my $config = OpenGuides::Test->make_basic_config; $config->use_plucene( 1 );
Modified: trunk/t/40_search_as_feed.t =================================================================== --- trunk/t/40_search_as_feed.t 2009-08-10 17:06:11 UTC (rev 1272) +++ trunk/t/40_search_as_feed.t 2009-09-04 22:24:51 UTC (rev 1273) @@ -13,10 +13,8 @@ plan tests => 7;
# Clear out the database from any previous runs. -unlink "t/node.db"; -unlink <t/indexes/*>; + OpenGuides::Test::refresh_db();
-Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } ); my $config = OpenGuides::Test->make_basic_config; $config->script_name( "wiki.cgi" ); $config->script_url( "http://example.com/" ); @@ -59,4 +57,4 @@ like($output, qr/<entry>/, "Really was Atom");
@found = ($output =~ /(<entry>)/g); -is( scalar @found, 1, "found right entries in feed" ); \ No newline at end of file +is( scalar @found, 1, "found right entries in feed" );
Modified: trunk/t/42_edit_conflict.t =================================================================== --- trunk/t/42_edit_conflict.t 2009-08-10 17:06:11 UTC (rev 1272) +++ trunk/t/42_edit_conflict.t 2009-09-04 22:24:51 UTC (rev 1273) @@ -16,9 +16,9 @@ }
plan tests => 16; +# clear out database + OpenGuides::Test::refresh_db();
-Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } ); - # Make a guide that works on latitude/longitude, and allows node images. my $config = OpenGuides::Test->make_basic_config; $config->geo_handler( 3 ); @@ -27,11 +27,6 @@ my $guide = OpenGuides->new( config => $config ); my $wiki = $guide->wiki;
-# Clear out the database from any previous runs. -foreach my $del_node ( $wiki->list_all_nodes ) { - print "# Deleting node $del_node\n"; - $wiki->delete_node( $del_node ) or die "Can't delete $del_node"; -}
# Write some data.
Modified: trunk/t/43_preview_edits.t =================================================================== --- trunk/t/43_preview_edits.t 2009-08-10 17:06:11 UTC (rev 1272) +++ trunk/t/43_preview_edits.t 2009-09-04 22:24:51 UTC (rev 1273) @@ -18,9 +18,7 @@ plan tests => 1;
# Clear out the database from any previous runs. -unlink "t/node.db"; -unlink <t/indexes/*>; -Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } ); + OpenGuides::Test::refresh_db();
my $config = OpenGuides::Test->make_basic_config; my $guide = OpenGuides->new( config => $config );
Modified: trunk/t/44_node_image.t =================================================================== --- trunk/t/44_node_image.t 2009-08-10 17:06:11 UTC (rev 1272) +++ trunk/t/44_node_image.t 2009-09-04 22:24:51 UTC (rev 1273) @@ -20,9 +20,7 @@ my ( $config, $guide, $wiki );
# Clear out the database from any previous runs. -unlink "t/node.db"; -unlink <t/indexes/*>; -Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } ); + OpenGuides::Test::refresh_db();
# Make sure node image fields don't show up in edit form if config says # they shouldn't.
Modified: trunk/t/45_home_recent_changes.t =================================================================== --- trunk/t/45_home_recent_changes.t 2009-08-10 17:06:11 UTC (rev 1272) +++ trunk/t/45_home_recent_changes.t 2009-09-04 22:24:51 UTC (rev 1273) @@ -15,9 +15,7 @@ my ( $config, $guide, $wiki );
# Clear out the database from any previous runs. -unlink "t/node.db"; -unlink <t/indexes/*>; -Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } ); + OpenGuides::Test::refresh_db();
# Write some data to show up in recent changes. $config = OpenGuides::Test->make_basic_config;
Modified: trunk/t/46_map_in_node_display.t =================================================================== --- trunk/t/46_map_in_node_display.t 2009-08-10 17:06:11 UTC (rev 1272) +++ trunk/t/46_map_in_node_display.t 2009-09-04 22:24:51 UTC (rev 1273) @@ -21,9 +21,7 @@ my ( $config, $guide, $wiki, $cookie, $output );
# Clear out the database from any previous runs. -unlink "t/node.db"; -unlink <t/indexes/*>; -Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } ); + OpenGuides::Test::refresh_db();
# Make a guide. $config = OpenGuides::Test->make_basic_config;
Modified: trunk/t/47_navbar_placement.t =================================================================== --- trunk/t/47_navbar_placement.t 2009-08-10 17:06:11 UTC (rev 1272) +++ trunk/t/47_navbar_placement.t 2009-09-04 22:24:51 UTC (rev 1273) @@ -24,9 +24,7 @@ my ( $config, $guide, $wiki, $cookie, $output );
# Clear out the database from any previous runs. -unlink "t/node.db"; -unlink <t/indexes/*>; -Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } ); + OpenGuides::Test::refresh_db();
# Make a guide. $config = OpenGuides::Test->make_basic_config;
Modified: trunk/t/48_google_analytics.t =================================================================== --- trunk/t/48_google_analytics.t 2009-08-10 17:06:11 UTC (rev 1272) +++ trunk/t/48_google_analytics.t 2009-09-04 22:24:51 UTC (rev 1273) @@ -15,9 +15,7 @@ my ( $config, $guide, $wiki, $cookie, $output );
# Clear out the database from any previous runs. -unlink "t/node.db"; -unlink <t/indexes/*>; -Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } ); + OpenGuides::Test::refresh_db();
# Make a guide. $config = OpenGuides::Test->make_basic_config;
Modified: trunk/t/49_custom_header.t =================================================================== --- trunk/t/49_custom_header.t 2009-08-10 17:06:11 UTC (rev 1272) +++ trunk/t/49_custom_header.t 2009-09-04 22:24:51 UTC (rev 1273) @@ -24,10 +24,7 @@ my $wiki = $guide->wiki;
# Clear out the database from any previous runs. -foreach my $del_node ( $wiki->list_all_nodes ) { - print "# Deleting node $del_node\n"; - $wiki->delete_node( $del_node ) or die "Can't delete $del_node"; -} + OpenGuides::Test::refresh_db();
# Make sure the tmp directory exists eval {
Modified: trunk/t/51_display_node.t =================================================================== --- trunk/t/51_display_node.t 2009-08-10 17:06:11 UTC (rev 1272) +++ trunk/t/51_display_node.t 2009-09-04 22:24:51 UTC (rev 1273) @@ -15,8 +15,8 @@
plan tests => 19;
-Wiki::Toolkit::Setup::SQLite::cleardb( { dbname => "t/node.db" } ); -Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } ); + OpenGuides::Test::refresh_db(); + my $config = OpenGuides::Config->new( vars => { dbtype => "sqlite",
Modified: trunk/t/52_display_diffs.t =================================================================== --- trunk/t/52_display_diffs.t 2009-08-10 17:06:11 UTC (rev 1272) +++ trunk/t/52_display_diffs.t 2009-09-04 22:24:51 UTC (rev 1273) @@ -13,16 +13,13 @@
plan tests => 5;
-Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } ); +# Clear out the database from any previous runs. + OpenGuides::Test::refresh_db(); + my $config = OpenGuides::Test->make_basic_config; my $guide = OpenGuides->new( config => $config ); my $wiki = $guide->wiki;
-# Clear out the database from any previous runs. -foreach my $del_node ( $wiki->list_all_nodes ) { - print "# Deleting node $del_node\n"; - $wiki->delete_node( $del_node ) or die "Can't delete $del_node"; -}
$wiki->write_node( "I Like Pie", "Best pie is meat pie." ) or die "Couldn't write node";
Modified: trunk/t/53_show_index.t =================================================================== --- trunk/t/53_show_index.t 2009-08-10 17:06:11 UTC (rev 1272) +++ trunk/t/53_show_index.t 2009-09-04 22:24:51 UTC (rev 1273) @@ -13,7 +13,9 @@
plan tests => 23; # 25 when all enabled
-Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } ); +# Clear out the database from any previous runs. + OpenGuides::Test::refresh_db(); + my $config = OpenGuides::Test->make_basic_config; $config->script_name( "wiki.cgi" ); $config->script_url( "http://example.com/" ); @@ -22,11 +24,6 @@ my $wiki = $guide->wiki; isa_ok( $wiki, "Wiki::Toolkit" );
-# Clear out the database from any previous runs. -foreach my $del_node ( $wiki->list_all_nodes ) { - print "# Deleting node $del_node\n"; - $wiki->delete_node( $del_node ) or die "Can't delete $del_node"; -}
$wiki->write_node( "Test Page", "foo", undef, { category => "Alpha", latitude=>51.754349, longitude=>-1.258200 } )
Modified: trunk/t/54_redirect.t =================================================================== --- trunk/t/54_redirect.t 2009-08-10 17:06:11 UTC (rev 1272) +++ trunk/t/54_redirect.t 2009-09-04 22:24:51 UTC (rev 1273) @@ -2,6 +2,7 @@ use Wiki::Toolkit::Setup::SQLite; use OpenGuides::Config; use OpenGuides; +use OpenGuides::Test; use Test::More;
eval { require DBD::SQLite; }; @@ -13,7 +14,6 @@
plan tests => 2;
-Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } ); my $config = OpenGuides::Config->new( vars => { dbtype => "sqlite", @@ -28,13 +28,11 @@ eval { require Wiki::Toolkit::Search::Plucene; }; if ( $@ ) { $config->use_plucene ( 0 ) };
+ OpenGuides::Test::refresh_db(); + my $guide = OpenGuides->new( config => $config ); my $wiki = $guide->wiki;
-# Clear out the database from any previous runs. -foreach my $del_node ( $wiki->list_all_nodes ) { - $wiki->delete_node( $del_node ) or die "Can't delete $del_node"; -}
$wiki->write_node( "Test Page", "#REDIRECT [[Test Page 2]]" ) or die "Can't write node";
Modified: trunk/t/55_node_history.t =================================================================== --- trunk/t/55_node_history.t 2009-08-10 17:06:11 UTC (rev 1272) +++ trunk/t/55_node_history.t 2009-09-04 22:24:51 UTC (rev 1273) @@ -1,3 +1,4 @@ +use strict; use Wiki::Toolkit::Setup::SQLite; use OpenGuides; use OpenGuides::Test; @@ -12,8 +13,8 @@
plan tests => 2;
-Wiki::Toolkit::Setup::SQLite::cleardb( { dbname => "t/node.db" } ); -Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } ); + OpenGuides::Test::refresh_db(); + my $config = OpenGuides::Test->make_basic_config; $config->script_name( "mywiki.cgi" ); $config->script_url( "http://example.com/" );
Modified: trunk/t/56_diffs_with_macros.t =================================================================== --- trunk/t/56_diffs_with_macros.t 2009-08-10 17:06:11 UTC (rev 1272) +++ trunk/t/56_diffs_with_macros.t 2009-09-04 22:24:51 UTC (rev 1273) @@ -14,9 +14,7 @@ plan tests => 4;
# Clear out the database from any previous runs. -unlink "t/node.db"; -unlink <t/indexes/*>; -Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } ); + OpenGuides::Test::refresh_db();
my $config = OpenGuides::Test->make_basic_config; my $guide = OpenGuides->new( config => $config );
Modified: trunk/t/57_random_page.t =================================================================== --- trunk/t/57_random_page.t 2009-08-10 17:06:11 UTC (rev 1272) +++ trunk/t/57_random_page.t 2009-09-04 22:24:51 UTC (rev 1273) @@ -15,7 +15,8 @@ my ( $config, $guide, $wiki );
# Clear out database from previous runs, set up a guide. -refresh_db(); + OpenGuides::Test::refresh_db(); + $config = OpenGuides::Test->make_basic_config; $config->script_url( "http://www.example.com/" ); $config->script_name( "wiki.cgi" ); @@ -44,7 +45,8 @@ ok( $nodes{$node}, "...to an existing node" );
# Clear the database and write some data including categories and locales. -refresh_db(); + OpenGuides::Test::refresh_db(); + $config = OpenGuides::Test->make_basic_config; $config->script_url( "http://www.example.com/" ); $config->script_name( "wiki.cgi" ); @@ -87,7 +89,8 @@ . "(this test may sometimes pass when it shouldn't)" );
# Now make sure we can pick things up from specific categories/locales if asked -refresh_db(); + OpenGuides::Test::refresh_db(); + $config = OpenGuides::Test->make_basic_config; $guide = OpenGuides->new( config => $config );
@@ -143,11 +146,6 @@ unlike( $output, qr/Status: 302/, "don't get a redirect if we ask for category/locale with no pages in" );
-sub refresh_db { - unlink "t/node.db"; - unlink <t/indexes/*>; - Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } ); -}
sub get_node_from_output { my $node_param = shift;
Modified: trunk/t/58_navbar_common_locales_categories.t =================================================================== --- trunk/t/58_navbar_common_locales_categories.t 2009-08-10 17:06:11 UTC (rev 1272) +++ trunk/t/58_navbar_common_locales_categories.t 2009-09-04 22:24:51 UTC (rev 1273) @@ -50,9 +50,7 @@ my ( $config, $guide, $wiki, $output );
# Clear out the database from any previous runs. -unlink "t/node.db"; -unlink <t/indexes/*>; -Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } ); + OpenGuides::Test::refresh_db();
while (my ($page, $get_content) = each %pages) {
Modified: trunk/t/59_preferences.t =================================================================== --- trunk/t/59_preferences.t 2009-08-10 17:06:11 UTC (rev 1272) +++ trunk/t/59_preferences.t 2009-09-04 22:24:51 UTC (rev 1273) @@ -1,3 +1,4 @@ +use strict; use Wiki::Toolkit::Setup::SQLite; use OpenGuides; use OpenGuides::Test; @@ -24,8 +25,8 @@
plan tests => 2;
-Wiki::Toolkit::Setup::SQLite::cleardb( { dbname => "t/prefs.db" } ); -Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/prefs.db" } ); + OpenGuides::Test::refresh_db(); + my $config = OpenGuides::Test->make_basic_config; my $guide = OpenGuides->new( config => $config ); my $wiki = $guide->wiki;
Modified: trunk/t/61_bug_textareas.t =================================================================== --- trunk/t/61_bug_textareas.t 2009-08-10 17:06:11 UTC (rev 1272) +++ trunk/t/61_bug_textareas.t 2009-09-04 22:24:51 UTC (rev 1273) @@ -1,3 +1,4 @@ +use strict; use Wiki::Toolkit::Setup::SQLite; use OpenGuides::Template; use OpenGuides::Test; @@ -13,7 +14,8 @@
plan tests => 1;
-Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } ); + OpenGuides::Test::refresh_db(); + my $config = OpenGuides::Test->make_basic_config; my $wiki = OpenGuides::Utils->make_wiki_object( config => $config );
@@ -30,4 +32,4 @@ );
like( $out, qr/Barville\nFooville/, - "locales properly separated in textarea" ); \ No newline at end of file + "locales properly separated in textarea" );
Modified: trunk/t/62_bug_trailing_whitespace.t =================================================================== --- trunk/t/62_bug_trailing_whitespace.t 2009-08-10 17:06:11 UTC (rev 1272) +++ trunk/t/62_bug_trailing_whitespace.t 2009-09-04 22:24:51 UTC (rev 1273) @@ -1,3 +1,4 @@ +use strict; use Wiki::Toolkit::Setup::SQLite; use OpenGuides::Config; use OpenGuides; @@ -15,9 +16,7 @@ plan tests => 8;
# Clear out the database from any previous runs. -unlink "t/node.db"; -unlink <t/indexes/*>; -Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } ); + OpenGuides::Test::refresh_db();
my $config = OpenGuides::Test->make_basic_config; my $guide = OpenGuides->new( config => $config );
Modified: trunk/t/63_bug_map_link_no_address.t =================================================================== --- trunk/t/63_bug_map_link_no_address.t 2009-08-10 17:06:11 UTC (rev 1272) +++ trunk/t/63_bug_map_link_no_address.t 2009-09-04 22:24:51 UTC (rev 1273) @@ -1,3 +1,4 @@ +use strict; use Wiki::Toolkit::Setup::SQLite; use OpenGuides; use OpenGuides::Test; @@ -12,8 +13,8 @@
plan tests => 1;
-Wiki::Toolkit::Setup::SQLite::cleardb( { dbname => "t/node.db" } ); -Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } ); + OpenGuides::Test::refresh_db(); + my $config = OpenGuides::Test->make_basic_config; my $guide = OpenGuides->new( config => $config );
Modified: trunk/t/64_bug_node_history.t =================================================================== --- trunk/t/64_bug_node_history.t 2009-08-10 17:06:11 UTC (rev 1272) +++ trunk/t/64_bug_node_history.t 2009-09-04 22:24:51 UTC (rev 1273) @@ -1,3 +1,4 @@ +use strict; use Wiki::Toolkit::Setup::SQLite; use OpenGuides::Config; use Cwd; @@ -2,2 +3,3 @@ use OpenGuides; +use OpenGuides::Test; use Test::More; @@ -13,8 +15,8 @@
plan tests => 1;
-Wiki::Toolkit::Setup::SQLite::cleardb( { dbname => "t/node.db" } ); -Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } ); + OpenGuides::Test::refresh_db(); + my $config = OpenGuides::Config->new( vars => { dbtype => "sqlite", @@ -39,4 +41,4 @@ id => "South Croydon Station", return_output => 1, ); -unlike( $output, qr'<myfaketag>', "HTML escaped in comments" ); \ No newline at end of file +unlike( $output, qr'<myfaketag>', "HTML escaped in comments" );
Modified: trunk/t/65_bug_metadata_escape.t =================================================================== --- trunk/t/65_bug_metadata_escape.t 2009-08-10 17:06:11 UTC (rev 1272) +++ trunk/t/65_bug_metadata_escape.t 2009-09-04 22:24:51 UTC (rev 1273) @@ -1,3 +1,4 @@ +use strict; use Wiki::Toolkit::Setup::SQLite; use OpenGuides::Config; use Cwd; @@ -2,2 +3,3 @@ use OpenGuides; +use OpenGuides::Test; use Test::More; @@ -12,8 +14,8 @@
plan tests => 1;
-Wiki::Toolkit::Setup::SQLite::cleardb( { dbname => "t/node.db" } ); -Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } ); + OpenGuides::Test::refresh_db(); + my $config = OpenGuides::Config->new( vars => { dbtype => "sqlite", @@ -37,4 +39,4 @@ return_output => 1, ); unlike( $output, qr'<hr><h1>hello mum</h1><hr>', - "HTML escaped in metadata on node display" ); \ No newline at end of file + "HTML escaped in metadata on node display" );
Modified: trunk/t/66_bug_latlong_representation.t =================================================================== --- trunk/t/66_bug_latlong_representation.t 2009-08-10 17:06:11 UTC (rev 1272) +++ trunk/t/66_bug_latlong_representation.t 2009-09-04 22:24:51 UTC (rev 1273) @@ -21,10 +21,8 @@ plan tests => 4;
# Clear out the database from any previous runs. -unlink "t/node.db"; -unlink <t/indexes/*>; + OpenGuides::Test::refresh_db();
-Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } ); my $config = OpenGuides::Config->new( vars => { dbtype => "sqlite",
Modified: trunk/t/67_bug_first_version.t =================================================================== --- trunk/t/67_bug_first_version.t 2009-08-10 17:06:11 UTC (rev 1272) +++ trunk/t/67_bug_first_version.t 2009-09-04 22:24:51 UTC (rev 1273) @@ -1,3 +1,4 @@ +use strict; use Wiki::Toolkit::Setup::SQLite; use OpenGuides::Config; use OpenGuides; @@ -14,10 +15,9 @@ plan tests => 3;
# Clear out the database from any previous runs. -unlink "t/node.db"; -unlink <t/indexes/*>; -Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } ); + OpenGuides::Test::refresh_db();
+ my $config = OpenGuides::Test->make_basic_config; my $guide = OpenGuides->new( config => $config );
@@ -35,4 +35,4 @@ unlike( $output, qr|<a href=".*">diff</a>|, "no diff link displayed on node with only one version" ); unlike( $output, qr|<a href=".*">View current version.</a>|i, - "...nor view current version link" ); \ No newline at end of file + "...nor view current version link" );
Modified: trunk/t/68_bug_website_displayed.t =================================================================== --- trunk/t/68_bug_website_displayed.t 2009-08-10 17:06:11 UTC (rev 1272) +++ trunk/t/68_bug_website_displayed.t 2009-09-04 22:24:51 UTC (rev 1273) @@ -1,3 +1,4 @@ +use strict; use Wiki::Toolkit::Setup::SQLite; use OpenGuides; use OpenGuides::Test; @@ -12,8 +13,8 @@
plan tests => 2;
-Wiki::Toolkit::Setup::SQLite::cleardb( { dbname => "t/node.db" } ); -Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } ); + OpenGuides::Test::refresh_db(); + my $config = OpenGuides::Test->make_basic_config; my $guide = OpenGuides->new( config => $config );
Modified: trunk/t/69_bug_zero_geo.t =================================================================== --- trunk/t/69_bug_zero_geo.t 2009-08-10 17:06:11 UTC (rev 1272) +++ trunk/t/69_bug_zero_geo.t 2009-09-04 22:24:51 UTC (rev 1273) @@ -1,3 +1,4 @@ +use strict; use Wiki::Toolkit::Setup::SQLite; use OpenGuides::Config; use Cwd; @@ -13,8 +14,8 @@
plan tests => 6;
-Wiki::Toolkit::Setup::SQLite::cleardb( { dbname => "t/node.db" } ); -Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } ); + OpenGuides::Test::refresh_db(); + my $config = OpenGuides::Config->new( vars => { dbtype => "sqlite",
Modified: trunk/t/70_admin_home.t =================================================================== --- trunk/t/70_admin_home.t 2009-08-10 17:06:11 UTC (rev 1272) +++ trunk/t/70_admin_home.t 2009-09-04 22:24:51 UTC (rev 1273) @@ -12,7 +12,8 @@
plan tests => 12;
-Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } ); + OpenGuides::Test::refresh_db(); + my $config = OpenGuides::Test->make_basic_config; $config->script_name( "wiki.cgi" ); $config->script_url( "http://example.com/" ); @@ -21,11 +22,6 @@ my $wiki = $guide->wiki; isa_ok( $wiki, "Wiki::Toolkit" );
-# Clear out the database from any previous runs. -foreach my $del_node ( $wiki->list_all_nodes ) { - print "# Deleting node $del_node\n"; - $wiki->delete_node( $del_node ) or die "Can't delete $del_node"; -}
# Add 3 different pages, one of which with two versions
Modified: trunk/t/71_missing_metadata.t =================================================================== --- trunk/t/71_missing_metadata.t 2009-08-10 17:06:11 UTC (rev 1272) +++ trunk/t/71_missing_metadata.t 2009-09-04 22:24:51 UTC (rev 1273) @@ -12,8 +12,8 @@ }
plan tests => 26; + OpenGuides::Test::refresh_db();
-Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } ); my $config = OpenGuides::Test->make_basic_config; $config->script_name( "wiki.cgi" ); $config->script_url( "http://example.com/" ); @@ -22,11 +22,6 @@ my $wiki = $guide->wiki; isa_ok( $wiki, "Wiki::Toolkit" );
-# Clear out the database from any previous runs. -foreach my $del_node ( $wiki->list_all_nodes ) { - print "# Deleting node $del_node\n"; - $wiki->delete_node( $del_node ) or die "Can't delete $del_node"; -}
# Add 3 different pages, one of which with two versions
Modified: trunk/t/72_node_moderation.t =================================================================== --- trunk/t/72_node_moderation.t 2009-08-10 17:06:11 UTC (rev 1272) +++ trunk/t/72_node_moderation.t 2009-09-04 22:24:51 UTC (rev 1273) @@ -13,7 +13,8 @@
plan tests => 19;
-Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } ); + OpenGuides::Test::refresh_db(); + my $config = OpenGuides::Test->make_basic_config; $config->script_name( "wiki.cgi" ); $config->script_url( "http://example.com/" ); @@ -22,11 +23,6 @@ my $wiki = $guide->wiki; isa_ok( $wiki, "Wiki::Toolkit" );
-# Clear out the database from any previous runs. -foreach my $del_node ( $wiki->list_all_nodes ) { - print "# Deleting node $del_node\n"; - $wiki->delete_node( $del_node ) or die "Can't delete $del_node"; -}
# Add a page
Modified: trunk/t/73_toggle_moderation.t =================================================================== --- trunk/t/73_toggle_moderation.t 2009-08-10 17:06:11 UTC (rev 1272) +++ trunk/t/73_toggle_moderation.t 2009-09-04 22:24:51 UTC (rev 1273) @@ -13,7 +13,8 @@
plan tests => 14;
-Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } ); + OpenGuides::Test::refresh_db(); + my $config = OpenGuides::Test->make_basic_config; $config->script_name( "wiki.cgi" ); $config->script_url( "http://example.com/" ); @@ -22,11 +23,6 @@ my $wiki = $guide->wiki; isa_ok( $wiki, "Wiki::Toolkit" );
-# Clear out the database from any previous runs. -foreach my $del_node ( $wiki->list_all_nodes ) { - print "# Deleting node $del_node\n"; - $wiki->delete_node( $del_node ) or die "Can't delete $del_node"; -}
# Add 3 different pages, one of which with two versions
Modified: trunk/t/74_ping_plugin.t =================================================================== --- trunk/t/74_ping_plugin.t 2009-08-10 17:06:11 UTC (rev 1272) +++ trunk/t/74_ping_plugin.t 2009-09-04 22:24:51 UTC (rev 1273) @@ -15,7 +15,8 @@ eval { require Wiki::Toolkit::Plugin::Ping; }; my $have_ping = $@ ? 0 : 1;
-Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } ); + OpenGuides::Test::refresh_db(); + my $config = OpenGuides::Config->new( vars => { dbtype => "sqlite",
Modified: trunk/t/75_revert_user.t =================================================================== --- trunk/t/75_revert_user.t 2009-08-10 17:06:11 UTC (rev 1272) +++ trunk/t/75_revert_user.t 2009-09-04 22:24:51 UTC (rev 1273) @@ -13,7 +13,8 @@
plan tests => 23;
-Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } ); + OpenGuides::Test::refresh_db(); + my $config = OpenGuides::Test->make_basic_config; $config->script_name( "wiki.cgi" ); $config->script_url( "http://example.com/" ); @@ -22,11 +23,6 @@ my $wiki = $guide->wiki; isa_ok( $wiki, "Wiki::Toolkit" );
-# Clear out the database from any previous runs. -foreach my $del_node ( $wiki->list_all_nodes ) { - print "# Deleting node $del_node\n"; - $wiki->delete_node( $del_node ) or die "Can't delete $del_node"; -}
my %details; my %vars;
Modified: trunk/t/76_detect_spam.t =================================================================== --- trunk/t/76_detect_spam.t 2009-08-10 17:06:11 UTC (rev 1272) +++ trunk/t/76_detect_spam.t 2009-09-04 22:24:51 UTC (rev 1273) @@ -14,9 +14,7 @@ plan tests => 2;
# Clear out the database from any previous runs. -unlink "t/node.db"; -unlink <t/indexes/*>; -Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } ); + OpenGuides::Test::refresh_db();
# Set up a guide which uses a spam detector module. my $config = OpenGuides::Test->make_basic_config;
Modified: trunk/t/79_host_blacklist.t =================================================================== --- trunk/t/79_host_blacklist.t 2009-08-10 17:06:11 UTC (rev 1272) +++ trunk/t/79_host_blacklist.t 2009-09-04 22:24:51 UTC (rev 1273) @@ -14,9 +14,7 @@ plan tests => 1;
# Clear out the database from any previous runs. -unlink "t/node.db"; -unlink <t/indexes/*>; -Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } ); + OpenGuides::Test::refresh_db();
# Set up a guide which uses a spam detector module. my $config = OpenGuides::Test->make_basic_config;
Modified: trunk/t/81_node_moderate_whitelist.t =================================================================== --- trunk/t/81_node_moderate_whitelist.t 2009-08-10 17:06:11 UTC (rev 1272) +++ trunk/t/81_node_moderate_whitelist.t 2009-09-04 22:24:51 UTC (rev 1273) @@ -13,7 +13,8 @@
plan tests => 12;
-Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } ); + OpenGuides::Test::refresh_db(); + my $config = OpenGuides::Test->make_basic_config; $config->script_name( "wiki.cgi" ); $config->script_url( "http://example.com/" ); @@ -23,11 +24,6 @@ my $wiki = $guide->wiki; isa_ok( $wiki, "Wiki::Toolkit" );
-# Clear out the database from any previous runs. -foreach my $del_node ( $wiki->list_all_nodes ) { - print "# Deleting node $del_node\n"; - $wiki->delete_node( $del_node ) or die "Can't delete $del_node"; -}
# Add a page
Modified: trunk/t/83_show_delete_to_admins_only.t =================================================================== --- trunk/t/83_show_delete_to_admins_only.t 2009-08-10 17:06:11 UTC (rev 1272) +++ trunk/t/83_show_delete_to_admins_only.t 2009-09-04 22:24:51 UTC (rev 1273) @@ -49,9 +49,7 @@ my ( $config, $guide, $wiki, $output );
# Clear out the database from any previous runs. -unlink "t/node.db"; -unlink <t/indexes/*>; -Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } ); + OpenGuides::Test::refresh_db();
# Make a guide
Modified: trunk/t/84_navbar_admin.t =================================================================== --- trunk/t/84_navbar_admin.t 2009-08-10 17:06:11 UTC (rev 1272) +++ trunk/t/84_navbar_admin.t 2009-09-04 22:24:51 UTC (rev 1273) @@ -49,9 +49,7 @@ my ( $config, $guide, $wiki, $output );
# Clear out the database from any previous runs. -unlink "t/node.db"; -unlink <t/indexes/*>; -Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } ); + OpenGuides::Test::refresh_db();
# Make a guide
Modified: trunk/t/85_universal_edit_link.t =================================================================== --- trunk/t/85_universal_edit_link.t 2009-08-10 17:06:11 UTC (rev 1272) +++ trunk/t/85_universal_edit_link.t 2009-09-04 22:24:51 UTC (rev 1273) @@ -17,9 +17,7 @@ my ( $config, $guide, $wiki, $cookie, $output );
# Clear out the database from any previous runs. -unlink "t/node.db"; -unlink <t/indexes/*>; -Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } ); + OpenGuides::Test::refresh_db();
# Make a guide. $config = OpenGuides::Test->make_basic_config;
Modified: trunk/t/86_recent_changes.t =================================================================== --- trunk/t/86_recent_changes.t 2009-08-10 17:06:11 UTC (rev 1272) +++ trunk/t/86_recent_changes.t 2009-09-04 22:24:51 UTC (rev 1273) @@ -23,11 +23,9 @@
plan tests => 10;
-# Clear out the database from any previous runs. -unlink "t/node.db"; -unlink <t/indexes/*>; +OpenGuides::Test::refresh_db();
-Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } ); + my $config = OpenGuides::Config->new( vars => { dbtype => "sqlite", @@ -138,7 +136,7 @@
# set show_minor_edits to 0. -my $cookie = OpenGuides::CGI->make_prefs_cookie( + $cookie = OpenGuides::CGI->make_prefs_cookie( config => $config, username => "bob", include_geocache_link => 1,
openguides-commits@lists.openguides.org