|
Line 0
Link Here
|
| 0 |
- |
1 |
#!/usr/bin/perl |
|
|
2 |
|
| 3 |
# This file is part of Koha. |
| 4 |
# |
| 5 |
# Koha is free software; you can redistribute it and/or modify it |
| 6 |
# under the terms of the GNU General Public License as published by |
| 7 |
# the Free Software Foundation; either version 3 of the License, or |
| 8 |
# (at your option) any later version. |
| 9 |
# |
| 10 |
# Koha is distributed in the hope that it will be useful, but |
| 11 |
# WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 |
# GNU General Public License for more details. |
| 14 |
# |
| 15 |
# You should have received a copy of the GNU General Public License |
| 16 |
# along with Koha; if not, see <http://www.gnu.org/licenses>. |
| 17 |
|
| 18 |
use Modern::Perl; |
| 19 |
|
| 20 |
use utf8; |
| 21 |
use XML::Simple; |
| 22 |
use Encode; |
| 23 |
|
| 24 |
use Test::More; #See plan tests => \d+ below |
| 25 |
use Test::WWW::Mechanize; |
| 26 |
|
| 27 |
my $koha_conf = $ENV{KOHA_CONF}; |
| 28 |
my $xml = XMLin($koha_conf); |
| 29 |
|
| 30 |
my $user = $ENV{KOHA_USER} || $xml->{config}->{user}; |
| 31 |
my $password = $ENV{KOHA_PASS} || $xml->{config}->{pass}; |
| 32 |
my $intranet = $ENV{KOHA_INTRANET_URL}; |
| 33 |
|
| 34 |
|
| 35 |
eval{ |
| 36 |
use C4::Context; |
| 37 |
}; |
| 38 |
if ($@) { |
| 39 |
plan skip_all => "Tests skip. You must have a working Context\n"; |
| 40 |
} |
| 41 |
elsif (not defined $intranet) { |
| 42 |
plan skip_all => "Tests skip. You must set env. variable KOHA_INTRANET_URL to do tests\n"; |
| 43 |
} |
| 44 |
|
| 45 |
|
| 46 |
$intranet =~ s#/$##; |
| 47 |
|
| 48 |
my $agent = Test::WWW::Mechanize->new( autocheck => 1 ); |
| 49 |
|
| 50 |
# Fake a help page |
| 51 |
my @url_parts = ( |
| 52 |
"about.pl", |
| 53 |
"acqui/acqui-home.pl", |
| 54 |
"acqui/addorderiso2709.pl", |
| 55 |
"acqui/basket.pl", |
| 56 |
"acqui/basketgroup.pl", |
| 57 |
"acqui/basketheader.pl", |
| 58 |
"acqui/booksellers.pl", |
| 59 |
"acqui/edifactmsgs.pl", |
| 60 |
"acqui/histsearch.pl", |
| 61 |
"acqui/invoice.pl", |
| 62 |
"acqui/invoices.pl", |
| 63 |
"acqui/lateorders.pl", |
| 64 |
"acqui/neworderbiblio.pl", |
| 65 |
"acqui/neworderempty.pl", |
| 66 |
"acqui/newordersubscription.pl", |
| 67 |
"acqui/newordersuggestion.pl", |
| 68 |
"acqui/orderreceive.pl", |
| 69 |
"acqui/parcel.pl", |
| 70 |
"acqui/parcels.pl", |
| 71 |
"acqui/supplier.pl", |
| 72 |
"acqui/uncertainprice.pl", |
| 73 |
"acqui/z3950_search.pl", |
| 74 |
"admin/admin-home.pl", |
| 75 |
"admin/aqbudgetperiods.pl", |
| 76 |
"admin/aqbudgets.pl", |
| 77 |
"admin/aqcontract.pl", |
| 78 |
"admin/aqplan.pl", |
| 79 |
"admin/auth_subfields_structure.pl", |
| 80 |
"admin/auth_tag_structure.pl", |
| 81 |
"admin/authorised_values.pl", |
| 82 |
"admin/authtypes.pl", |
| 83 |
"admin/biblio_framework.pl", |
| 84 |
"admin/branch_transfer_limits.pl", |
| 85 |
"admin/branches.pl", |
| 86 |
"admin/categorie.pl", |
| 87 |
"admin/checkmarc.pl", |
| 88 |
"admin/cities.pl", |
| 89 |
"admin/classsources.pl", |
| 90 |
"admin/columns_settings.pl", |
| 91 |
"admin/currency.pl", |
| 92 |
"admin/didyoumean.pl", |
| 93 |
"admin/edi_accounts.pl", |
| 94 |
"admin/edi_ean_accounts.pl", |
| 95 |
"admin/fieldmapping.pl", |
| 96 |
"admin/item_circulation_alerts.pl", |
| 97 |
"admin/items_search_fields.pl", |
| 98 |
"admin/itemtypes.pl", |
| 99 |
"admin/koha2marclinks.pl", |
| 100 |
"admin/marc_subfields_structure.pl", |
| 101 |
"admin/marctagstructure.pl", |
| 102 |
"admin/matching-rules.pl", |
| 103 |
"admin/oai_set_mappings.pl", |
| 104 |
"admin/oai_sets.pl", |
| 105 |
"admin/patron-attr-types.pl", |
| 106 |
"admin/preferences.pl", |
| 107 |
"admin/smart-rules.pl", |
| 108 |
"admin/systempreferences.pl", |
| 109 |
"admin/transport-cost-matrix.pl", |
| 110 |
"admin/z3950servers.pl", |
| 111 |
"authorities/authorities-home.pl", |
| 112 |
"authorities/authorities.pl", |
| 113 |
"authorities/detail.pl", |
| 114 |
"authorities/merge.pl", |
| 115 |
"catalogue/detail.pl", |
| 116 |
"catalogue/issuehistory.pl", |
| 117 |
"catalogue/itemsearch.pl", |
| 118 |
"catalogue/moredetail.pl", |
| 119 |
"catalogue/search-history.pl", |
| 120 |
"catalogue/search.pl", |
| 121 |
"cataloguing/addbiblio.pl", |
| 122 |
"cataloguing/addbooks.pl", |
| 123 |
"cataloguing/additem.pl", |
| 124 |
"cataloguing/linkitem.pl", |
| 125 |
"cataloguing/merge.pl", |
| 126 |
"cataloguing/moveitem.pl", |
| 127 |
"circ/branchoverdues.pl", |
| 128 |
"circ/branchtransfers.pl", |
| 129 |
"circ/circulation-home.pl", |
| 130 |
"circ/circulation.pl", |
| 131 |
"circ/offline.pl", |
| 132 |
"circ/on-site_checkouts.pl", |
| 133 |
"circ/overdue.pl", |
| 134 |
"circ/pendingreserves.pl", |
| 135 |
"circ/renew.pl", |
| 136 |
"circ/reserveratios.pl", |
| 137 |
"circ/returns.pl", |
| 138 |
"circ/selectbranchprinter.pl", |
| 139 |
"circ/transferstoreceive.pl", |
| 140 |
"circ/view_holdsqueue.pl", |
| 141 |
"circ/waitingreserves.pl", |
| 142 |
"course_reserves/add_items.pl", |
| 143 |
"course_reserves/course-details.pl", |
| 144 |
"course_reserves/course-reserves.pl", |
| 145 |
"course_reserves/course.pl", |
| 146 |
"labels/label-edit-batch.pl", |
| 147 |
"labels/label-edit-layout.pl", |
| 148 |
"labels/label-edit-profile.pl", |
| 149 |
"labels/label-edit-template.pl", |
| 150 |
"labels/label-home.pl", |
| 151 |
"labels/label-manage.pl", |
| 152 |
"labels/spinelabel-home.pl", |
| 153 |
"mainpage.pl", |
| 154 |
"members/boraccount.pl", |
| 155 |
"members/discharge.pl", |
| 156 |
"members/files.pl", |
| 157 |
"members/mancredit.pl", |
| 158 |
"members/maninvoice.pl", |
| 159 |
"members/member-flags.pl", |
| 160 |
"members/member-password.pl", |
| 161 |
"members/member.pl", |
| 162 |
"members/memberentry.pl", |
| 163 |
"members/members-home.pl", |
| 164 |
"members/members-update.pl", |
| 165 |
"members/moremember.pl", |
| 166 |
"members/notices.pl", |
| 167 |
"members/pay.pl", |
| 168 |
"members/paycollect.pl", |
| 169 |
"members/purchase-suggestions.pl", |
| 170 |
"members/readingrec.pl", |
| 171 |
"members/routing-lists.pl", |
| 172 |
"members/statistics.pl", |
| 173 |
"nohelp.pl", |
| 174 |
"offline_circ/list.pl", |
| 175 |
"offline_circ/process_koc.pl", |
| 176 |
"patron_lists/lists.pl", |
| 177 |
"patroncards/edit-batch.pl", |
| 178 |
"patroncards/edit-layout.pl", |
| 179 |
"patroncards/edit-profile.pl", |
| 180 |
"patroncards/edit-template.pl", |
| 181 |
"patroncards/home.pl", |
| 182 |
"patroncards/image-manage.pl", |
| 183 |
"patroncards/manage.pl", |
| 184 |
"plugins/plugins-home.pl", |
| 185 |
"plugins/plugins-upload.pl", |
| 186 |
"reports/acquisitions_stats.pl", |
| 187 |
"reports/bor_issues_top.pl", |
| 188 |
"reports/borrowers_out.pl", |
| 189 |
"reports/borrowers_stats.pl", |
| 190 |
"reports/cat_issues_top.pl", |
| 191 |
"reports/catalogue_out.pl", |
| 192 |
"reports/catalogue_stats.pl", |
| 193 |
"reports/dictionary.pl", |
| 194 |
"reports/guided_reports.pl", |
| 195 |
"reports/issues_avg_stats.pl", |
| 196 |
"reports/issues_stats.pl", |
| 197 |
"reports/itemslost.pl", |
| 198 |
"reports/manager.pl", |
| 199 |
"reports/reports-home.pl", |
| 200 |
"reports/reserves_stats.pl", |
| 201 |
"reports/serials_stats.pl", |
| 202 |
"reserve/request.pl", |
| 203 |
"reviews/reviewswaiting.pl", |
| 204 |
"rotating_collections/rotatingCollections.pl", |
| 205 |
"serials/checkexpiration.pl", |
| 206 |
"serials/claims.pl", |
| 207 |
"serials/routing.pl", |
| 208 |
"serials/serials-collection.pl", |
| 209 |
"serials/serials-edit.pl", |
| 210 |
"serials/serials-home.pl", |
| 211 |
"serials/subscription-add.pl", |
| 212 |
"serials/subscription-detail.pl", |
| 213 |
"serials/subscription-frequencies.pl", |
| 214 |
"serials/subscription-numberpatterns.pl", |
| 215 |
"suggestion/suggestion.pl", |
| 216 |
"tags/list.pl", |
| 217 |
"tags/review.pl", |
| 218 |
"tools/batchMod.pl", |
| 219 |
"tools/batch_delete_records.pl", |
| 220 |
"tools/batch_record_modification.pl", |
| 221 |
"tools/cleanborrowers.pl", |
| 222 |
"tools/csv-profiles.pl", |
| 223 |
"tools/export.pl", |
| 224 |
"tools/holidays.pl", |
| 225 |
"tools/import_borrowers.pl", |
| 226 |
"tools/inventory.pl", |
| 227 |
"tools/koha-news.pl", |
| 228 |
"tools/letter.pl", |
| 229 |
"tools/manage-marc-import.pl", |
| 230 |
"tools/marc_modification_templates.pl", |
| 231 |
"tools/modborrowers.pl", |
| 232 |
"tools/overduerules.pl", |
| 233 |
"tools/picture-upload.pl", |
| 234 |
"tools/quotes-upload.pl", |
| 235 |
"tools/quotes.pl", |
| 236 |
"tools/scheduler.pl", |
| 237 |
"tools/stage-marc-import.pl", |
| 238 |
"tools/tools-home.pl", |
| 239 |
"tools/upload-cover-image.pl", |
| 240 |
"tools/viewlog.pl", |
| 241 |
"virtualshelves/shelves.pl" |
| 242 |
); |
| 243 |
|
| 244 |
foreach my $url_part (@url_parts) { |
| 245 |
my $test_url = "$intranet/cgi-bin/koha/$url_part"; |
| 246 |
$agent->get_ok( "$intranet/cgi-bin/koha/help.pl?url=$test_url" ); |
| 247 |
my $page = $agent->content(); |
| 248 |
my $current_help_url = $page; |
| 249 |
if ($current_help_url =~ /full documentation(.*)/) { |
| 250 |
$current_help_url = $1; |
| 251 |
} |
| 252 |
if ($current_help_url =~ /href="(.*?)">(.*?)manual/) { |
| 253 |
$current_help_url = $1; |
| 254 |
} |
| 255 |
$current_help_url =~ s/17.11/18.05/g; |
| 256 |
$agent->get_ok( $current_help_url ); |
| 257 |
diag $current_help_url; |
| 258 |
} |
| 259 |
|
| 260 |
done_testing(); |