View | Details | Raw Unified | Return to bug 10363
Collapse All | Expand All

(-)a/t/db_dependent/www/auth_values_input_www.t (-16 / +16 lines)
Lines 48-53 if (not defined $intranet) { Link Here
48
    plan skip_all => "Tests skip. You must set env. variable KOHA_INTRANET_URL to do tests\n";
48
    plan skip_all => "Tests skip. You must set env. variable KOHA_INTRANET_URL to do tests\n";
49
}
49
}
50
50
51
my $dbh = C4::Context->dbh;
51
52
52
$intranet =~ s#/$##;
53
$intranet =~ s#/$##;
53
54
Lines 69-74 $agent->get_ok( "$intranet/cgi-bin/koha/mainpage.pl", 'load main page' ); Link Here
69
#--------------------------------------------------- Test with corean and greek chars
70
#--------------------------------------------------- Test with corean and greek chars
70
71
71
$category = '学協会μμ';
72
$category = '学協会μμ';
73
$dbh->do(q|DELETE FROM authorised_values WHERE category = ?|, undef, $category);
72
74
73
$agent->get_ok( "$intranet/cgi-bin/koha/admin/authorised_values.pl", 'Connect to Authorized values page' );
75
$agent->get_ok( "$intranet/cgi-bin/koha/admin/authorised_values.pl", 'Connect to Authorized values page' );
74
$agent->get_ok( "$intranet/cgi-bin/koha/admin/authorised_values.pl?op=add_form", 'Open to create a new category' );
76
$agent->get_ok( "$intranet/cgi-bin/koha/admin/authorised_values.pl?op=add_form", 'Open to create a new category' );
Lines 80-93 $agent->field('category', $category); Link Here
80
$agent->field('branches', '');
82
$agent->field('branches', '');
81
$agent->click_ok( '', "Create new auth category and value" );
83
$agent->click_ok( '', "Create new auth category and value" );
82
84
83
$expected_base = q|authorised_values.pl\?searchfield=| . uri_escape_utf8( $category );
85
$expected_base = q|authorised_values.pl|;
84
$agent->base_like(qr|$expected_base|, "check base");
86
$agent->base_like(qr|$expected_base|, "check base");
85
$add_form_link_exists = 0;
87
$add_form_link_exists = 0;
86
$delete_form_link_exists = 0;
88
$delete_form_link_exists = 0;
87
for my $link ( $agent->links() ) {
89
for my $link ( $agent->links() ) {
88
    if ( $link->url =~ m|authorised_values.pl\?op=add_form&category=$category| ) {
90
    if ( $link->url =~ m|authorised_values.pl\?op=add_form&category=$category| ) {
89
        $add_form_link_exists = 1;
91
        $add_form_link_exists = 1;
90
    }elsif( $link->url =~ m|authorised_values.pl\?op=delete_confirm&searchfield=$category| ) {
92
    }elsif( $link->url =~ m|authorised_values.pl\?op=delete&searchfield=$category| ) {
91
        $delete_form_link_exists = 1;
93
        $delete_form_link_exists = 1;
92
    }
94
    }
93
}
95
}
Lines 105-125 my @links = $agent->links; Link Here
105
my $id_to_del ='';
107
my $id_to_del ='';
106
foreach my $dato (@links){
108
foreach my $dato (@links){
107
    my $link = $dato->url;
109
    my $link = $dato->url;
108
    if ($link =~  m/op=delete_confirm\&searchfield=学協会μμ/){
110
    if ($link =~  m/op=delete\&searchfield=学協会μμ\&id=(\d+)/){
109
        $link =~  m/(.*&id=?)(\d{1,})(&.*)/;
111
        $id_to_del = $1;
110
        $id_to_del = $2;
111
        last;
112
        last;
112
    };
113
    }
113
}
114
}
114
if ($id_to_del) {
115
if ($id_to_del) {
115
    $agent->get_ok( "$intranet/cgi-bin/koha/admin/authorised_values.pl?op=delete_confirmed&searchfield=学協会μμ&id=$id_to_del", 'UTF_8 auth. value deleted' );
116
    $agent->get_ok( "$intranet/cgi-bin/koha/admin/authorised_values.pl?op=delete&searchfield=学協会μμ&id=$id_to_del", 'UTF_8 auth. value deleted' );
116
}else{
117
}else{
117
    ok($id_to_del ne undef, "error, link to delete nor working");
118
    ok($id_to_del ne undef, "error, link to delete not working");
118
}
119
}
119
120
120
#---------------------------------------- Test with only latin utf-8 (could be taken as Latin-1/ISO 8859-1)
121
#---------------------------------------- Test with only latin utf-8 (could be taken as Latin-1/ISO 8859-1)
121
122
122
$category = 'tòmas';
123
$category = 'tòmas';
124
$dbh->do(q|DELETE FROM authorised_values WHERE category = ?|, undef, $category);
123
125
124
$agent->get_ok( "$intranet/cgi-bin/koha/admin/authorised_values.pl", 'Connect to Authorized values page' );
126
$agent->get_ok( "$intranet/cgi-bin/koha/admin/authorised_values.pl", 'Connect to Authorized values page' );
125
$agent->get_ok( "$intranet/cgi-bin/koha/admin/authorised_values.pl?op=add_form", 'Open to create a new category' );
127
$agent->get_ok( "$intranet/cgi-bin/koha/admin/authorised_values.pl?op=add_form", 'Open to create a new category' );
Lines 140-146 $delete_form_link_exists = 0; Link Here
140
for my $link ( $agent->links() ) {
142
for my $link ( $agent->links() ) {
141
    if ( $link->url =~ m|authorised_values.pl\?op=add_form&category=$category| ) {
143
    if ( $link->url =~ m|authorised_values.pl\?op=add_form&category=$category| ) {
142
        $add_form_link_exists = 1;
144
        $add_form_link_exists = 1;
143
    }elsif( $link->url =~ m|authorised_values.pl\?op=delete_confirm&searchfield=$category| ) {
145
    }elsif( $link->url =~ m|authorised_values.pl\?op=delete&searchfield=$category| ) {
144
        $delete_form_link_exists = 1;
146
        $delete_form_link_exists = 1;
145
    }
147
    }
146
}
148
}
Lines 158-173 my @links2 = $agent->links; Link Here
158
my $id_to_del2 ='';
160
my $id_to_del2 ='';
159
foreach my $dato (@links2){
161
foreach my $dato (@links2){
160
    my $link = $dato->url;
162
    my $link = $dato->url;
161
    if ($link =~  m/op=delete_confirm\&searchfield=tòmas/){
163
    if ($link =~  m/op=delete\&searchfield=tòmas\&id=(\d+)/){
162
        $link =~  m/(.*&id=?)(\d{1,})(&.*)/;
164
        $id_to_del2 = $1;
163
        $id_to_del2 = $2;
164
        last;
165
        last;
165
    };
166
    }
166
}
167
}
167
if ($id_to_del2) {
168
if ($id_to_del2) {
168
    $agent->get_ok( "$intranet/cgi-bin/koha/admin/authorised_values.pl?op=delete_confirmed&searchfield=tòmas&id=$id_to_del2", 'UTF_8 auth. value deleted' );
169
    $agent->get_ok( "$intranet/cgi-bin/koha/admin/authorised_values.pl?op=delete&searchfield=tòmas&id=$id_to_del2", 'UTF_8 auth. value deleted' );
169
}else{
170
}else{
170
    ok($id_to_del ne undef, "error, link to delete nor working");
171
    ok($id_to_del2 ne undef, "error, link to delete not working");
171
}
172
}
172
173
173
1;
174
1;
174
- 

Return to bug 10363