From 9abeae359a33a0ee18cf35a1f2686a19366ff61a Mon Sep 17 00:00:00 2001 From: Graham Knop Date: Fri, 19 Mar 2010 17:22:21 -0500 Subject: [PATCH] skip ideogram tests if mysql is configured badly --- t/Search.t | 6 +++++- t/Search/Index.t | 41 ++++++++++++++++++++++++----------------- 2 files changed, 29 insertions(+), 18 deletions(-) diff --git a/t/Search.t b/t/Search.t index 8f08574d3..e46fdbaec 100644 --- a/t/Search.t +++ b/t/Search.t @@ -57,9 +57,13 @@ ok(! $search->_isStopword('private.+'), '_isStopword: regex metacharacters # Chinese ideograph handling # ################################################ -{ +SKIP: { use utf8; + my $min_word_length = $session->db->quickScalar('SELECT @@ft_min_word_len'); + skip 'MySQL minimum word length too long to support ideograms', 2 + if $min_word_length > 2; + # Create an article to index my $article = WebGUI::Asset->getImportNode( $session )->addChild( { className => 'WebGUI::Asset::Wobject::Article', diff --git a/t/Search/Index.t b/t/Search/Index.t index 9c9231f6a..fb63e4e49 100644 --- a/t/Search/Index.t +++ b/t/Search/Index.t @@ -244,23 +244,30 @@ cmp_deeply ( #---------------------------------------------------------------------------- # Test that Chinese ideographical characters are inserted and searchable. -use utf8; -$article->update({ - description => "甲骨文", -}); -$indexer = WebGUI::Search::Index->create( $article ); +SKIP: { + use utf8; -$row = $db->quickHashRef( "SELECT * FROM assetIndex WHERE assetId=?", [ $article->getId ] ); -cmp_deeply ( - $row, - superhashof({ - keywords => all( # keywords contains title, menuTitle, every part of the URL and every keyword - re("''甲''"), - re("''骨''"), - re("''文''"), - ), - }), - "Index has Chinese ideographs, separated by spaces and delimited with quotes to pad the length" -); + my $min_word_length = $session->db->quickScalar('SELECT @@ft_min_word_len'); + skip 'MySQL minimum word length too long to support ideograms', 1 + if $min_word_length > 2; + + $article->update({ + description => "甲骨文", + }); + $indexer = WebGUI::Search::Index->create( $article ); + + $row = $db->quickHashRef( "SELECT * FROM assetIndex WHERE assetId=?", [ $article->getId ] ); + cmp_deeply ( + $row, + superhashof({ + keywords => all( # keywords contains title, menuTitle, every part of the URL and every keyword + re("''甲''"), + re("''骨''"), + re("''文''"), + ), + }), + "Index has Chinese ideographs, separated by spaces and delimited with quotes to pad the length" + ); +} #vim:ft=perl