Lines 83-94
$agent->click_ok( '', "Create new AV category " );
Link Here
|
83 |
$agent->base_like(qr|$expected_base|, "check base"); |
83 |
$agent->base_like(qr|$expected_base|, "check base"); |
84 |
$add_form_link_exists = 0; |
84 |
$add_form_link_exists = 0; |
85 |
for my $link ( $agent->links() ) { |
85 |
for my $link ( $agent->links() ) { |
86 |
if ( $link->url =~ m|authorised_values.pl\?op=add_form&category=$category| ) { |
86 |
if ( $link->url =~ m|authorised_values.pl\?op=add_form&category=| . uri_escape_utf8($category) ) { |
87 |
$add_form_link_exists = 1; |
87 |
$add_form_link_exists = 1; |
88 |
} |
88 |
} |
89 |
} |
89 |
} |
90 |
is( $add_form_link_exists, 1, 'Add a new category button should be displayed'); |
90 |
is( $add_form_link_exists, 1, 'Add a new category button should be displayed'); |
91 |
$agent->get_ok( "$intranet/cgi-bin/koha/admin/authorised_values.pl?op=add_form&category=$category", 'Open to create a new AV for this category' ); |
91 |
$agent->get_ok( "$intranet/cgi-bin/koha/admin/authorised_values.pl?op=add_form&category=" . uri_escape_utf8($category), 'Open to create a new AV for this category' ); |
92 |
|
92 |
|
93 |
$agent->form_name('Aform'); |
93 |
$agent->form_name('Aform'); |
94 |
$agent->field('authorised_value', 'επιμεq'); |
94 |
$agent->field('authorised_value', 'επιμεq'); |
Lines 100-109
$agent->click_ok( '', "Create a new value for the category" );
Link Here
|
100 |
$agent->base_like(qr|$expected_base|, "check base"); |
100 |
$agent->base_like(qr|$expected_base|, "check base"); |
101 |
$add_form_link_exists = 0; |
101 |
$add_form_link_exists = 0; |
102 |
$delete_form_link_exists = 0; |
102 |
$delete_form_link_exists = 0; |
|
|
103 |
my $add_form_re = q|authorised_values.pl\?op=add_form&category=| . uri_escape_utf8($category); |
104 |
my $delete_re = q|authorised_values.pl\?op=delete&searchfield=| . uri_escape_utf8($category); |
103 |
for my $link ( $agent->links() ) { |
105 |
for my $link ( $agent->links() ) { |
104 |
if ( $link->url =~ m|authorised_values.pl\?op=add_form&category=$category| ) { |
106 |
if ( $link->url =~ qr|$add_form_re| ) { |
105 |
$add_form_link_exists = 1; |
107 |
$add_form_link_exists = 1; |
106 |
}elsif( $link->url =~ m|authorised_values.pl\?op=delete&searchfield=$category| ) { |
108 |
} elsif ( $link->url =~ qr|$delete_re| ) { |
107 |
$delete_form_link_exists = 1; |
109 |
$delete_form_link_exists = 1; |
108 |
} |
110 |
} |
109 |
} |
111 |
} |
Lines 111-117
is( $add_form_link_exists, 1, 'Add a new category button should be displayed');
Link Here
|
111 |
is( $delete_form_link_exists, 1, ''); |
113 |
is( $delete_form_link_exists, 1, ''); |
112 |
|
114 |
|
113 |
$agent->get_ok( "$intranet/cgi-bin/koha/admin/authorised_values.pl", 'Return to Authorized values page' ); |
115 |
$agent->get_ok( "$intranet/cgi-bin/koha/admin/authorised_values.pl", 'Return to Authorized values page' ); |
114 |
$agent->get_ok( "$intranet/cgi-bin/koha/admin/authorised_values.pl?searchfield=学協会μμ&offset=0", 'Search the values inserted' ); |
116 |
$agent->get_ok( "$intranet/cgi-bin/koha/admin/authorised_values.pl?searchfield=" . uri_escape_utf8($category) . "&offset=0", 'Search the values inserted' ); |
115 |
my $text = $agent->text() ; |
117 |
my $text = $agent->text() ; |
116 |
#Tests on UTF-8 |
118 |
#Tests on UTF-8 |
117 |
ok ( ( length(Encode::encode('UTF-8', $text)) != length($text) ) , 'UTF-8 are multi-byte. Good') ; |
119 |
ok ( ( length(Encode::encode('UTF-8', $text)) != length($text) ) , 'UTF-8 are multi-byte. Good') ; |
Lines 119-133
ok ($text =~ m/学協会μμ/, 'UTF-8 (Asia) chars are correctly present. Good'
Link Here
|
119 |
ok ($text =~ m/επιμεq/, 'UTF-8 (Greek) chars are correctly present. Good'); |
121 |
ok ($text =~ m/επιμεq/, 'UTF-8 (Greek) chars are correctly present. Good'); |
120 |
my @links = $agent->links; |
122 |
my @links = $agent->links; |
121 |
my $id_to_del =''; |
123 |
my $id_to_del =''; |
|
|
124 |
$delete_re = q|op=delete\&searchfield=| . uri_escape_utf8($category) . '\&id=(\d+)'; |
122 |
foreach my $dato (@links){ |
125 |
foreach my $dato (@links){ |
123 |
my $link = $dato->url; |
126 |
my $link = $dato->url; |
124 |
if ($link =~ m/op=delete\&searchfield=学協会μμ\&id=(\d+)/){ |
127 |
if ($link =~ qr|$delete_re| ) { |
125 |
$id_to_del = $1; |
128 |
$id_to_del = $1; |
126 |
last; |
129 |
last; |
127 |
} |
130 |
} |
128 |
} |
131 |
} |
129 |
if ($id_to_del) { |
132 |
if ($id_to_del) { |
130 |
$agent->get_ok( "$intranet/cgi-bin/koha/admin/authorised_values.pl?op=delete&searchfield=学協会μμ&id=$id_to_del", 'UTF_8 auth. value deleted' ); |
133 |
$agent->get_ok( "$intranet/cgi-bin/koha/admin/authorised_values.pl?op=delete&searchfield=" . uri_escape_utf8($category) . "&id=$id_to_del", 'UTF_8 auth. value deleted' ); |
131 |
}else{ |
134 |
}else{ |
132 |
ok($id_to_del ne undef, "error, link to delete not working"); |
135 |
ok($id_to_del ne undef, "error, link to delete not working"); |
133 |
} |
136 |
} |
Lines 156-165
$expected_base = q|authorised_values.pl|;
Link Here
|
156 |
$agent->base_like(qr|$expected_base|, "check base"); |
159 |
$agent->base_like(qr|$expected_base|, "check base"); |
157 |
$add_form_link_exists = 0; |
160 |
$add_form_link_exists = 0; |
158 |
$delete_form_link_exists = 0; |
161 |
$delete_form_link_exists = 0; |
|
|
162 |
$add_form_re = q|authorised_values.pl\?op=add_form&category=| . uri_escape_utf8($category); |
163 |
$delete_re = q|authorised_values.pl\?op=delete&searchfield=| . uri_escape_utf8($category); |
159 |
for my $link ( $agent->links() ) { |
164 |
for my $link ( $agent->links() ) { |
160 |
if ( $link->url =~ m|authorised_values.pl\?op=add_form&category=$category| ) { |
165 |
if ( $link->url =~ qr|$add_form_re| ) { |
161 |
$add_form_link_exists = 1; |
166 |
$add_form_link_exists = 1; |
162 |
}elsif( $link->url =~ m|authorised_values.pl\?op=delete&searchfield=$category| ) { |
167 |
}elsif( $link->url =~ qr|$delete_re| ) { |
163 |
$delete_form_link_exists = 1; |
168 |
$delete_form_link_exists = 1; |
164 |
} |
169 |
} |
165 |
} |
170 |
} |
Lines 175-183
ok ($text2 =~ m/tòmas/, 'UTF-8 not Latin-1 first test is OK. Good');
Link Here
|
175 |
ok ($text2=~ m/ràmen/, 'UTF-8 not Latin-1 second test is OK. Good'); |
180 |
ok ($text2=~ m/ràmen/, 'UTF-8 not Latin-1 second test is OK. Good'); |
176 |
my @links2 = $agent->links; |
181 |
my @links2 = $agent->links; |
177 |
my $id_to_del2 =''; |
182 |
my $id_to_del2 =''; |
|
|
183 |
$delete_re = q|op=delete\&searchfield=| . uri_escape_utf8($category) . q|\&id=(\d+)|; |
178 |
foreach my $dato (@links2){ |
184 |
foreach my $dato (@links2){ |
179 |
my $link = $dato->url; |
185 |
my $link = $dato->url; |
180 |
if ($link =~ m/op=delete\&searchfield=tòmas\&id=(\d+)/){ |
186 |
if ($link =~ qr|$delete_re| ){ |
181 |
$id_to_del2 = $1; |
187 |
$id_to_del2 = $1; |
182 |
last; |
188 |
last; |
183 |
} |
189 |
} |
184 |
- |
|
|