From 71a9b187d86bd5f7c3679d38b3919c9260c3feef Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Mon, 28 Sep 2015 12:17:39 +0200 Subject: [PATCH] Bug 14909: Warnings from search_utf8.t when empty idx= misses in base The regex in this test looks like: opac-search.pl\?idx=&q=%CE%91%CE%B8%CE%AE%CE%BD%CE%B1 The result it got was: opac-search.pl?q=%CE%91%CE%B8%CE%AE%CE%BD%CE%B1 The empty idx should not be a reason to fail the test. I changed the original regex to make the 'idx=&' part optional and added a base_unlike test to verify that the base does not include a idx=\w+ anywhere. Also corrected the typo Goog. Good! Signed-off-by: Marcel de Rooy All 66 tests now pass with me. Signed-off-by: Jonathan Druart Signed-off-by: Tomas Cohen Arazi --- t/db_dependent/www/search_utf8.t | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/t/db_dependent/www/search_utf8.t b/t/db_dependent/www/search_utf8.t index 6229254eb9..9eb66b9f39 100644 --- a/t/db_dependent/www/search_utf8.t +++ b/t/db_dependent/www/search_utf8.t @@ -18,7 +18,7 @@ use Modern::Perl; use utf8; -use Test::More tests => 64; +use Test::More tests => 66; use Test::WWW::Mechanize; use Data::Dumper; use XML::Simple; @@ -249,7 +249,7 @@ sub test_search{ my $expected_base = q|search.pl\?idx=kw&q=| . uri_escape_utf8( $publisher ); $agent->base_like(qr|$expected_base|, ); - ok ( ( length(Encode::encode('UTF-8', $intra_text)) != length($intra_text) ) , 'UTF-8 are multi-byte. Goog') ; + ok ( ( length(Encode::encode('UTF-8', $intra_text)) != length($intra_text) ) , 'UTF-8 are multi-byte. Good') ; ok ($intra_text =~ $utf8_reg, 'UTF-8 chars are correctly present. Good'); # -------------------------------------------------- TEST ON OPAC @@ -269,10 +269,14 @@ sub test_search{ $opac_text = $agent->text(); like( $opac_text, qr|Publisher: $publisher|, ); - $expected_base = q|opac-search.pl\?idx=&q=| . uri_escape_utf8( $publisher ); + $expected_base = q|opac-search.pl\?(idx=&)?q=| . uri_escape_utf8( $publisher ); $agent->base_like(qr|$expected_base|, ); + # Test added on BZ 14909 in addition to making the empty idx= optional + # in the previous regex + $agent->base_unlike( qr|idx=\w+|, 'Base does not contain an idx' ); - ok ( ( length(Encode::encode('UTF-8', $opac_text)) != length($opac_text) ) , 'UTF-8 are multi-byte. Goog') ; + + ok ( ( length(Encode::encode('UTF-8', $opac_text)) != length($opac_text) ) , 'UTF-8 are multi-byte. Good') ; ok ($opac_text =~ $utf8_reg, 'UTF-8 chars are correctly present. Good'); #-------------------------------------------------- REVERT -- 2.39.5