|
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 tests => 2; |
| 25 |
use Test::WWW::Mechanize; |
| 26 |
|
| 27 |
my $koha_conf = $ENV{KOHA_CONF}; |
| 28 |
my $xml = XMLin($koha_conf); |
| 29 |
|
| 30 |
eval{ |
| 31 |
use C4::Context; |
| 32 |
}; |
| 33 |
if ($@) { |
| 34 |
plan skip_all => "Tests skip. You must have a working Context\n"; |
| 35 |
} |
| 36 |
|
| 37 |
my $user = $ENV{KOHA_USER} || $xml->{config}->{user}; |
| 38 |
my $password = $ENV{KOHA_PASS} || $xml->{config}->{pass}; |
| 39 |
my $intranet = $ENV{KOHA_INTRANET_URL}; |
| 40 |
|
| 41 |
if (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 |
# Login |
| 51 |
$agent->get( "$intranet/cgi-bin/koha/mainpage.pl", 'Load the intranet login page' ); |
| 52 |
$agent->form_name('loginform'); |
| 53 |
$agent->field( 'password', $password ); |
| 54 |
$agent->field( 'userid', $user ); |
| 55 |
$agent->field( 'branch', '' ); |
| 56 |
$agent->click( '', 'Login to the intranet' ); |
| 57 |
$agent->get( "$intranet/cgi-bin/koha/about.pl", 'Load the about page' ); |
| 58 |
|
| 59 |
# Test about > timeline is correctly encoded |
| 60 |
my $encoded_latin_name = Encode::encode('UTF-8', 'Frédéric Demians'); |
| 61 |
my $encoded_cyrillic_name = Encode::encode('UTF-8', 'Сергій Дубик'); |
| 62 |
my $history_page = Encode::encode('UTF-8', $agent->text()); |
| 63 |
|
| 64 |
ok( $history_page =~ m/$encoded_latin_name/, "Latin characters with umlauts show correctly on the history page." ); |
| 65 |
ok( $history_page =~ m/$encoded_cyrillic_name/, "Cyrillic characters with umlauts show correctly on the history page." ); |
| 66 |
|
| 67 |
1; |