Bug 21606: [sql_modes] Fix matching rules insert
[koha.git] / t / db_dependent / www / history.t
blobce79516dddc09422e92770ecd951abc9e1f4fb48
1 #!/usr/bin/perl
3 # This file is part of Koha.
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.
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.
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>.
18 use Modern::Perl;
20 use utf8;
21 use XML::Simple;
22 use Encode;
24 use Test::More; #See plan tests => \d+ below
25 use Test::WWW::Mechanize;
27 my $koha_conf = $ENV{KOHA_CONF};
28 my $xml = XMLin($koha_conf);
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};
35 eval{
36 use C4::Context;
38 if ($@) {
39 plan skip_all => "Tests skip. You must have a working Context\n";
41 elsif (not defined $intranet) {
42 plan skip_all => "Tests skip. You must set env. variable KOHA_INTRANET_URL to do tests\n";
44 else {
45 plan tests => 4;
49 $intranet =~ s#/$##;
51 my $agent = Test::WWW::Mechanize->new( autocheck => 1 );
53 # Login
54 $agent->get_ok( "$intranet/cgi-bin/koha/mainpage.pl", 'Load the intranet login page' );
55 $agent->form_name('loginform');
56 $agent->field( 'password', $password );
57 $agent->field( 'userid', $user );
58 $agent->field( 'branch', '' );
59 $agent->click( '', 'Login to the intranet' );
60 $agent->get_ok( "$intranet/cgi-bin/koha/about.pl", 'Load the about page' );
62 # Test about > timeline is correctly encoded
63 my $encoded_latin_name = Encode::encode('UTF-8', 'Frédéric Demians');
64 my $encoded_cyrillic_name = Encode::encode('UTF-8', 'Сергій Дубик');
65 my $history_page = Encode::encode('UTF-8', $agent->text());
67 like( $history_page, qr/$encoded_latin_name/, "Latin characters with umlauts show correctly on the history page." );
68 like( $history_page, qr/$encoded_cyrillic_name/, "Cyrillic characters with umlauts show correctly on the history page." );