@@ -, +, @@ ---------- -- Add tests should pass --- t/db_dependent/www/help.t | 260 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 260 insertions(+) create mode 100644 t/db_dependent/www/help.t --- a/t/db_dependent/www/help.t +++ a/t/db_dependent/www/help.t @@ -0,0 +1,260 @@ +#!/usr/bin/perl + +# This file is part of Koha. +# +# Koha is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# Koha is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Koha; if not, see . + +use Modern::Perl; + +use utf8; +use XML::Simple; +use Encode; + +use Test::More; #See plan tests => \d+ below +use Test::WWW::Mechanize; + +my $koha_conf = $ENV{KOHA_CONF}; +my $xml = XMLin($koha_conf); + +my $user = $ENV{KOHA_USER} || $xml->{config}->{user}; +my $password = $ENV{KOHA_PASS} || $xml->{config}->{pass}; +my $intranet = $ENV{KOHA_INTRANET_URL}; + + +eval{ + use C4::Context; +}; +if ($@) { + plan skip_all => "Tests skip. You must have a working Context\n"; +} +elsif (not defined $intranet) { + plan skip_all => "Tests skip. You must set env. variable KOHA_INTRANET_URL to do tests\n"; +} + + +$intranet =~ s#/$##; + +my $agent = Test::WWW::Mechanize->new( autocheck => 1 ); + +# Fake a help page +my @url_parts = ( + "about.pl", + "acqui/acqui-home.pl", + "acqui/addorderiso2709.pl", + "acqui/basket.pl", + "acqui/basketgroup.pl", + "acqui/basketheader.pl", + "acqui/booksellers.pl", + "acqui/edifactmsgs.pl", + "acqui/histsearch.pl", + "acqui/invoice.pl", + "acqui/invoices.pl", + "acqui/lateorders.pl", + "acqui/neworderbiblio.pl", + "acqui/neworderempty.pl", + "acqui/newordersubscription.pl", + "acqui/newordersuggestion.pl", + "acqui/orderreceive.pl", + "acqui/parcel.pl", + "acqui/parcels.pl", + "acqui/supplier.pl", + "acqui/uncertainprice.pl", + "acqui/z3950_search.pl", + "admin/admin-home.pl", + "admin/aqbudgetperiods.pl", + "admin/aqbudgets.pl", + "admin/aqcontract.pl", + "admin/aqplan.pl", + "admin/auth_subfields_structure.pl", + "admin/auth_tag_structure.pl", + "admin/authorised_values.pl", + "admin/authtypes.pl", + "admin/biblio_framework.pl", + "admin/branch_transfer_limits.pl", + "admin/branches.pl", + "admin/categorie.pl", + "admin/checkmarc.pl", + "admin/cities.pl", + "admin/classsources.pl", + "admin/columns_settings.pl", + "admin/currency.pl", + "admin/didyoumean.pl", + "admin/edi_accounts.pl", + "admin/edi_ean_accounts.pl", + "admin/fieldmapping.pl", + "admin/item_circulation_alerts.pl", + "admin/items_search_fields.pl", + "admin/itemtypes.pl", + "admin/koha2marclinks.pl", + "admin/marc_subfields_structure.pl", + "admin/marctagstructure.pl", + "admin/matching-rules.pl", + "admin/oai_set_mappings.pl", + "admin/oai_sets.pl", + "admin/patron-attr-types.pl", + "admin/preferences.pl", + "admin/smart-rules.pl", + "admin/systempreferences.pl", + "admin/transport-cost-matrix.pl", + "admin/z3950servers.pl", + "authorities/authorities-home.pl", + "authorities/authorities.pl", + "authorities/detail.pl", + "authorities/merge.pl", + "catalogue/detail.pl", + "catalogue/issuehistory.pl", + "catalogue/itemsearch.pl", + "catalogue/moredetail.pl", + "catalogue/search-history.pl", + "catalogue/search.pl", + "cataloguing/addbiblio.pl", + "cataloguing/addbooks.pl", + "cataloguing/additem.pl", + "cataloguing/linkitem.pl", + "cataloguing/merge.pl", + "cataloguing/moveitem.pl", + "circ/branchoverdues.pl", + "circ/branchtransfers.pl", + "circ/circulation-home.pl", + "circ/circulation.pl", + "circ/offline.pl", + "circ/on-site_checkouts.pl", + "circ/overdue.pl", + "circ/pendingreserves.pl", + "circ/renew.pl", + "circ/reserveratios.pl", + "circ/returns.pl", + "circ/selectbranchprinter.pl", + "circ/transferstoreceive.pl", + "circ/view_holdsqueue.pl", + "circ/waitingreserves.pl", + "course_reserves/add_items.pl", + "course_reserves/course-details.pl", + "course_reserves/course-reserves.pl", + "course_reserves/course.pl", + "labels/label-edit-batch.pl", + "labels/label-edit-layout.pl", + "labels/label-edit-profile.pl", + "labels/label-edit-template.pl", + "labels/label-home.pl", + "labels/label-manage.pl", + "labels/spinelabel-home.pl", + "mainpage.pl", + "members/boraccount.pl", + "members/discharge.pl", + "members/files.pl", + "members/mancredit.pl", + "members/maninvoice.pl", + "members/member-flags.pl", + "members/member-password.pl", + "members/member.pl", + "members/memberentry.pl", + "members/members-home.pl", + "members/members-update.pl", + "members/moremember.pl", + "members/notices.pl", + "members/pay.pl", + "members/paycollect.pl", + "members/purchase-suggestions.pl", + "members/readingrec.pl", + "members/routing-lists.pl", + "members/statistics.pl", + "nohelp.pl", + "offline_circ/list.pl", + "offline_circ/process_koc.pl", + "patron_lists/lists.pl", + "patroncards/edit-batch.pl", + "patroncards/edit-layout.pl", + "patroncards/edit-profile.pl", + "patroncards/edit-template.pl", + "patroncards/home.pl", + "patroncards/image-manage.pl", + "patroncards/manage.pl", + "plugins/plugins-home.pl", + "plugins/plugins-upload.pl", + "reports/acquisitions_stats.pl", + "reports/bor_issues_top.pl", + "reports/borrowers_out.pl", + "reports/borrowers_stats.pl", + "reports/cat_issues_top.pl", + "reports/catalogue_out.pl", + "reports/catalogue_stats.pl", + "reports/dictionary.pl", + "reports/guided_reports.pl", + "reports/issues_avg_stats.pl", + "reports/issues_stats.pl", + "reports/itemslost.pl", + "reports/manager.pl", + "reports/reports-home.pl", + "reports/reserves_stats.pl", + "reports/serials_stats.pl", + "reserve/request.pl", + "reviews/reviewswaiting.pl", + "rotating_collections/rotatingCollections.pl", + "serials/checkexpiration.pl", + "serials/claims.pl", + "serials/routing.pl", + "serials/serials-collection.pl", + "serials/serials-edit.pl", + "serials/serials-home.pl", + "serials/subscription-add.pl", + "serials/subscription-detail.pl", + "serials/subscription-frequencies.pl", + "serials/subscription-numberpatterns.pl", + "suggestion/suggestion.pl", + "tags/list.pl", + "tags/review.pl", + "tools/batchMod.pl", + "tools/batch_delete_records.pl", + "tools/batch_record_modification.pl", + "tools/cleanborrowers.pl", + "tools/csv-profiles.pl", + "tools/export.pl", + "tools/holidays.pl", + "tools/import_borrowers.pl", + "tools/inventory.pl", + "tools/koha-news.pl", + "tools/letter.pl", + "tools/manage-marc-import.pl", + "tools/marc_modification_templates.pl", + "tools/modborrowers.pl", + "tools/overduerules.pl", + "tools/picture-upload.pl", + "tools/quotes-upload.pl", + "tools/quotes.pl", + "tools/scheduler.pl", + "tools/stage-marc-import.pl", + "tools/tools-home.pl", + "tools/upload-cover-image.pl", + "tools/viewlog.pl", + "virtualshelves/shelves.pl" +); + +foreach my $url_part (@url_parts) { + my $test_url = "$intranet/cgi-bin/koha/$url_part"; + $agent->get_ok( "$intranet/cgi-bin/koha/help.pl?url=$test_url" ); + my $page = $agent->content(); + my $current_help_url = $page; + if ($current_help_url =~ /full documentation(.*)/) { + $current_help_url = $1; + } + if ($current_help_url =~ /href="(.*?)">(.*?)manual/) { + $current_help_url = $1; + } + $current_help_url =~ s/17.11/18.05/g; + $agent->get_ok( $current_help_url ); + diag $current_help_url; +} + +done_testing(); --