Bugzilla – Attachment 35078 Details for
Bug 13264
Full stack encoding tests (UTF-8)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[SIGNED OFF] Bug 13264: Add tests for Latin-1 vs. UTF-8 deduction
SIGNED-OFF-Bug-13264-Add-tests-for-Latin-1-vs-UTF-.patch (text/plain), 5.17 KB, created by
Tomás Cohen Arazi (tcohen)
on 2015-01-09 14:27:45 UTC
(
hide
)
Description:
[SIGNED OFF] Bug 13264: Add tests for Latin-1 vs. UTF-8 deduction
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2015-01-09 14:27:45 UTC
Size:
5.17 KB
patch
obsolete
>From 8cebe7c7d1ff4fafedad4bedb38150028fedca74 Mon Sep 17 00:00:00 2001 >From: Zeno Tajoli <z.tajoli@cineca.it> >Date: Sun, 28 Dec 2014 23:14:56 +0100 >Subject: [PATCH] [SIGNED OFF] Bug 13264: Add tests for Latin-1 vs. UTF-8 > deduction > >add a test in auth_values_input_www to check chars that could be Latin-1 or UTF-8 > >http://bugs.koha-community.org/show_bug.cgi?id=13264 >Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com> >--- > t/db_dependent/www/auth_values_input_www.t | 70 +++++++++++++++++++++++++++--- > 1 file changed, 64 insertions(+), 6 deletions(-) > >diff --git a/t/db_dependent/www/auth_values_input_www.t b/t/db_dependent/www/auth_values_input_www.t >index b9aeea7..0844fc3 100644 >--- a/t/db_dependent/www/auth_values_input_www.t >+++ b/t/db_dependent/www/auth_values_input_www.t >@@ -18,7 +18,7 @@ > use Modern::Perl; > > use utf8; >-use Test::More tests => 15; >+use Test::More tests => 28; > use Test::WWW::Mechanize; > use XML::Simple; > use JSON; >@@ -53,10 +53,11 @@ $intranet =~ s#/$##; > > my $agent = Test::WWW::Mechanize->new( autocheck => 1 ); > my $jsonresponse; >+my ($category, $expected_base, $add_form_link_exists, $delete_form_link_exists); >+ >+# -------------------------------------------------- LOGIN > >-# -------------------------------------------------- LOAD RECORD > >-my $category = 'å¦åä¼Î¼Î¼'; > $agent->get_ok( "$intranet/cgi-bin/koha/mainpage.pl", 'connect to intranet' ); > $agent->form_name('loginform'); > $agent->field( 'password', $password ); >@@ -65,6 +66,10 @@ $agent->field( 'branch', '' ); > $agent->click_ok( '', 'login to staff client' ); > $agent->get_ok( "$intranet/cgi-bin/koha/mainpage.pl", 'load main page' ); > >+#--------------------------------------------------- Test with corean and greek chars >+ >+$category = 'å¦åä¼Î¼Î¼'; >+ > $agent->get_ok( "$intranet/cgi-bin/koha/admin/authorised_values.pl", 'Connect to Authorized values page' ); > $agent->get_ok( "$intranet/cgi-bin/koha/admin/authorised_values.pl?op=add_form", 'Open to create a new category' ); > $agent->form_name('Aform'); >@@ -75,10 +80,10 @@ $agent->field('category', $category); > $agent->field('branches', ''); > $agent->click_ok( '', "Create new auth category and value" ); > >-my $expected_base = q|authorised_values.pl\?searchfield=| . uri_escape_utf8( $category ); >+$expected_base = q|authorised_values.pl\?searchfield=| . uri_escape_utf8( $category ); > $agent->base_like(qr|$expected_base|, "check base"); >-my $add_form_link_exists = 0; >-my $delete_form_link_exists = 0; >+$add_form_link_exists = 0; >+$delete_form_link_exists = 0; > for my $link ( $agent->links() ) { > if ( $link->url =~ m|authorised_values.pl\?op=add_form&category=$category| ) { > $add_form_link_exists = 1; >@@ -112,4 +117,57 @@ if ($id_to_del) { > ok($id_to_del ne undef, "error, link to delete nor working"); > } > >+#---------------------------------------- Test with only latin utf-8 (could be taken as Latin-1/ISO 8859-1) >+ >+$category = 'tòmas'; >+ >+$agent->get_ok( "$intranet/cgi-bin/koha/admin/authorised_values.pl", 'Connect to Authorized values page' ); >+$agent->get_ok( "$intranet/cgi-bin/koha/admin/authorised_values.pl?op=add_form", 'Open to create a new category' ); >+$agent->form_name('Aform'); >+$agent->field('authorised_value', 'rà men'); >+$agent->field('lib_opac', 'autdesc2'); >+$agent->field('lib', 'desc1'); >+$agent->field('category', $category); >+$agent->field('branches', ''); >+$agent->click_ok( '', "Create new auth category and value" ); >+$agent->get_ok( "$intranet/cgi-bin/koha/admin/authorised_values.pl?searchfield=tòmas&offset=0", 'Search the values inserted' ); >+ >+$expected_base = q|authorised_values.pl\?searchfield=| . uri_escape_utf8( $category ); >+#$expected_base = q|authorised_values.pl\?searchfield=| . $category; >+$agent->base_like(qr|$expected_base|, "check base"); >+$add_form_link_exists = 0; >+$delete_form_link_exists = 0; >+for my $link ( $agent->links() ) { >+ if ( $link->url =~ m|authorised_values.pl\?op=add_form&category=$category| ) { >+ $add_form_link_exists = 1; >+ }elsif( $link->url =~ m|authorised_values.pl\?op=delete_confirm&searchfield=$category| ) { >+ $delete_form_link_exists = 1; >+ } >+} >+is( $add_form_link_exists, 1, ); >+is( $delete_form_link_exists, 1, ); >+ >+$agent->get_ok( "$intranet/cgi-bin/koha/admin/authorised_values.pl", 'Return to Authorized values page' ); >+$agent->get_ok( "$intranet/cgi-bin/koha/admin/authorised_values.pl?searchfield=tòmas&offset=0", 'Search the values inserted' ); >+my $text2 = $agent->text() ; >+#Tests on UTF-8 >+ok ( ( length(Encode::encode('UTF-8', $text)) != length($text) ) , 'UTF-8 are multi-byte. Good') ; >+ok ($text2 =~ m/tòmas/, 'UTF-8 not Latin-1 first test is OK. Good'); >+ok ($text2=~ m/rà men/, 'UTF-8 not Latin-1 second test is OK. Good'); >+my @links2 = $agent->links; >+my $id_to_del2 =''; >+foreach my $dato (@links2){ >+ my $link = $dato->url; >+ if ($link =~ m/op=delete_confirm\&searchfield=tòmas/){ >+ $link =~ m/(.*&id=?)(\d{1,})(&.*)/; >+ $id_to_del2 = $2; >+ last; >+ }; >+} >+if ($id_to_del2) { >+ $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' ); >+}else{ >+ ok($id_to_del ne undef, "error, link to delete nor working"); >+} >+ > 1; >-- >1.9.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 13264
:
33614
|
33703
|
33704
|
33705
|
33743
|
33744
|
33756
|
33757
|
33758
|
33759
|
33760
|
33777
|
33778
|
33779
|
33780
|
33781
|
33782
|
33783
|
33784
|
33785
|
33786
|
33811
|
33812
|
33813
|
33814
|
33815
|
33816
|
33817
|
34110
|
34111
|
34112
|
34113
|
34114
|
34115
|
34116
|
34117
|
34694
|
34766
|
34767
|
34768
|
34769
|
34770
|
34771
|
34772
|
34773
|
34774
|
34775
|
34776
|
34798
|
34799
|
34800
|
34801
|
34802
|
34803
|
34804
|
34805
|
34806
|
34807
|
34808
|
34809
|
34810
|
34811
|
34814
|
35068
|
35069
|
35070
|
35071
|
35072
|
35073
|
35074
|
35075
|
35076
|
35077
|
35078
|
35079
|
35080
|
35081
|
35082
|
35110
|
35111
|
35112
|
35113
|
35114
|
35115
|
35116
|
35117
|
35118
|
35119
|
35120
|
35121
|
35122
|
35123
|
35124