X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=rt%2Ft%2Farticles%2Fsearch-interface.t;h=3c75268b9af88852768058f1590db3d3f0827698;hb=0ed195595b5c7ea404c8848d9d1881ada4214489;hp=e957a6c31e417273dd4b1e5ea23bb10ee87cb0c0;hpb=3d0a1bb06b895c5be6e3f0517d355442a6b1e125;p=freeside.git diff --git a/rt/t/articles/search-interface.t b/rt/t/articles/search-interface.t index e957a6c31..3c75268b9 100644 --- a/rt/t/articles/search-interface.t +++ b/rt/t/articles/search-interface.t @@ -2,7 +2,7 @@ use strict; use warnings; -use RT::Test tests => 44; +use RT::Test tests => undef; use RT::CustomField; use RT::Queue; @@ -16,36 +16,39 @@ my ($url, $m) = RT::Test->started_ok; # Variables to test return values my ($ret, $msg); -# Create a test class +# Create two classes my $class = RT::Class->new($RT::SystemUser); -($ret, $msg) = $class->Create('Name' => 'tlaTestClass-'.$$, - 'Description' => 'A general-purpose test class'); +($ret, $msg) = $class->Create('Name' => 'First-class', + 'Description' => 'A general-purpose test class'); ok($ret, "Test class created"); +($ret, $msg) = $class->Create('Name' => 'Second-class', + 'Description' => 'Another class'); +ok($ret, "Test class created"); my $questionCF = RT::CustomField->new($RT::SystemUser); my $answerCF = RT::CustomField->new($RT::SystemUser); my $ticketCF = RT::CustomField->new($RT::SystemUser); ($ret, $msg) = $questionCF->Create('Name' => 'Question-'.$$, - 'Type' => 'Text', - 'MaxValues' => 1, - 'LookupType' => 'RT::Class-RT::Article', - 'Description' => 'The question to be answered', - 'Disabled' => 0); + 'Type' => 'Text', + 'MaxValues' => 1, + 'LookupType' => 'RT::Class-RT::Article', + 'Description' => 'The question to be answered', + 'Disabled' => 0); ok($ret, "Question CF created: $msg"); ($ret, $msg) = $answerCF->Create('Name' => 'Answer-'.$$, - 'Type' => 'Text', - 'MaxValues' => 1, - 'LookupType' => 'RT::Class-RT::Article', - 'Description' => 'The answer to the question', - 'Disabled' => 0); + 'Type' => 'Text', + 'MaxValues' => 1, + 'LookupType' => 'RT::Class-RT::Article', + 'Description' => 'The answer to the question', + 'Disabled' => 0); ok($ret, "Answer CF created: $msg"); ($ret, $msg) = $ticketCF->Create('Name' => 'Class', - 'Type' => 'Text', - 'MaxValues' => 1, - 'LookupType' => 'RT::Queue-RT::Ticket', - 'Disabled' => 0); + 'Type' => 'Text', + 'MaxValues' => 1, + 'LookupType' => 'RT::Queue-RT::Ticket', + 'Disabled' => 0); ok($ret, "Ticket CF 'Class' created: $msg"); # Attach the custom fields to our class @@ -60,18 +63,18 @@ my $global_queue = RT::Queue->new($RT::SystemUser); ok($ret, "Ticket CF added globally: $msg"); my %cvals = ('article1q' => 'Some question about swallows', - 'article1a' => 'Some answer about Europe and Africa', - 'article2q' => 'Another question about Monty Python', - 'article2a' => 'Romani ite domum', - 'article3q' => 'Why should I eat my supper?', - 'article3a' => 'There are starving children in Africa', - 'article4q' => 'What did Brian originally write?', - 'article4a' => 'This is an answer that is longer than 255 ' - . 'characters so these tests will be sure to use the LargeContent ' - . 'SQL as well as the normal SQL that would be generated if this ' - . 'was an answer that was shorter than 255 characters. This second ' - . 'sentence has a few extra characters to get this string to go ' - . 'over the 255 character boundary. Lorem ipsum.'); + 'article1a' => 'Some answer about Europe and Africa', + 'article2q' => 'Another question about Monty Python', + 'article2a' => 'Romani ite domum', + 'article3q' => 'Why should I eat my supper?', + 'article3a' => 'There are starving children in Africa', + 'article4q' => 'What did Brian originally write?', + 'article4a' => 'This is an answer that is longer than 255 ' + . 'characters so these tests will be sure to use the LargeContent ' + . 'SQL as well as the normal SQL that would be generated if this ' + . 'was an answer that was shorter than 255 characters. This second ' + . 'sentence has a few extra characters to get this string to go ' + . 'over the 255 character boundary. Lorem ipsum.'); # Create an article or two with our custom field values. @@ -80,32 +83,32 @@ my $article2 = RT::Article->new($RT::SystemUser); my $article3 = RT::Article->new($RT::SystemUser); my $article4 = RT::Article->new($RT::SystemUser); ($ret, $msg) = $article1->Create(Name => 'First article '.$$, - Summary => 'blah blah 1', - Class => $class->Id, - "CustomField-$qid" => $cvals{'article1q'}, - "CustomField-$aid" => $cvals{'article1a'}, - ); + Summary => 'blah blah 1', + Class => $class->Id, + "CustomField-$qid" => $cvals{'article1q'}, + "CustomField-$aid" => $cvals{'article1a'}, + ); ok($ret, "article 1 created"); ($ret, $msg) = $article2->Create(Name => 'Second article '.$$, - Summary => 'foo bar 2', - Class => $class->Id, - "CustomField-$qid" => $cvals{'article2q'}, - "CustomField-$aid" => $cvals{'article2a'}, - ); + Summary => 'foo bar 2', + Class => $class->Id, + "CustomField-$qid" => $cvals{'article2q'}, + "CustomField-$aid" => $cvals{'article2a'}, + ); ok($ret, "article 2 created"); ($ret, $msg) = $article3->Create(Name => 'Third article '.$$, - Summary => 'ping pong 3', - Class => $class->Id, - "CustomField-$qid" => $cvals{'article3q'}, - "CustomField-$aid" => $cvals{'article3a'}, - ); + Summary => 'ping pong 3', + Class => $class->Id, + "CustomField-$qid" => $cvals{'article3q'}, + "CustomField-$aid" => $cvals{'article3a'}, + ); ok($ret, "article 3 created"); ($ret, $msg) = $article4->Create(Name => 'Fourth article '.$$, - Summary => 'hoi polloi 4', - Class => $class->Id, - "CustomField-$qid" => $cvals{'article4q'}, - "CustomField-$aid" => $cvals{'article4a'}, - ); + Summary => 'hoi polloi 4', + Class => $class->Id, + "CustomField-$qid" => $cvals{'article4q'}, + "CustomField-$aid" => $cvals{'article4a'}, + ); ok($ret, "article 4 created"); isa_ok($m, 'Test::WWW::Mechanize'); @@ -140,6 +143,9 @@ TODO:{ $m->text_contains('hoi polloi 4'); } +undef $m; +done_testing; + # When you send $m to this sub, it must be on a page with # a Search link. sub DoArticleSearch{ @@ -147,7 +153,7 @@ sub DoArticleSearch{ my $class_name = shift; my $search_text = shift; - $m->follow_link_ok( {text => 'Search'}, 'Articles -> Search'); + $m->follow_link_ok( {text => 'Articles'}, 'Articles Search'); $m->follow_link_ok( {text => 'in class '. $class_name}, 'Articles in class '. $class_name); $m->text_contains('First article');