https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17934 --- Comment #2 from M. Tompsett <mtompset@hotmail.com> --- Comment on attachment 59173 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=59173 Bug 17934: Make t/db_dependent/www/auth_values_input_www.t awesome Review of attachment 59173: --> (https://bugs.koha-community.org/bugzilla3/page.cgi?id=splinter.html&bug=17934&attachment=59173) ----------------------------------------------------------------- After rereading the code changes, perhaps enhancement is better. You'll note that perlcritic -1 on this will be nice and short. ::: t/db_dependent/www/auth_values_input_www.t @@ -30,2 @@
-my $testdir = File::Spec->rel2abs( dirname(__FILE__) );
not used. @@ +35,5 @@
+ $skip_all = "Tests skipped. You must have a working C4::Context.\n"; +} +elsif ( ! can_load( modules => { 'C4::Context' => undef } ) ) { + $skip_all = "Tests skipped. You must be able to load C4::Context.\n"; +}
Added to determine cause of failure better. @@ +45,5 @@
+ $user = $ENV{KOHA_USER} || $xml->{config}->{user}; + $password = $ENV{KOHA_PASS} || $xml->{config}->{pass}; +} +elsif ($skip_all eq q{}) { + $skip_all = "Tests skipped. You must set env. variable KOHA_CONF to run tests.\n";
Added check. @@ +56,4 @@
}
+if (length $skip_all > 0) { + croak $skip_all; # to keep Test Summary output
Any failures due to prerequisites will happen here. @@ +63,3 @@
my $dbh = C4::Context->dbh;
+$intranet =~ s/\/$//xsm;
perlcritic -1 prefers /'s and xsm added. @@ -54,3 @@
my $agent = Test::WWW::Mechanize->new( autocheck => 1 ); -my $jsonresponse;
Not used. @@ +72,5 @@
$agent->get_ok( "$intranet/cgi-bin/koha/mainpage.pl", 'connect to intranet' ); $agent->form_name('loginform'); $agent->field( 'password', $password ); $agent->field( 'userid', $user ); +$agent->field( 'branch', q{} );
q{} is perlcritic -1 friendly. @@ +78,3 @@
$agent->get_ok( "$intranet/cgi-bin/koha/mainpage.pl", 'load main page' );
+#--------------------------------------------------- Test with Korean and greek chars
Typo! @@ +88,4 @@
$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('category', $category); +$agent->click_ok( q{}, 'Create new AV category ' );
Using single quotes for non-interpolated strings is perlcritic friendlier. @@ +94,3 @@
$add_form_link_exists = 0; for my $link ( $agent->links() ) { + if ( $link->url =~ m/authorised_values.pl\x3Fop=add_form&category=$category/xsm ) {
perlcritic didn't like \?, so I hex'd it. @@ +123,5 @@
$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=学協会μμ&offset=0", 'Search the values inserted' ); my $text = $agent->text() ; #Tests on UTF-8 +ok ( ( length Encode::encode('UTF-8', $text) != length $text ) , 'UTF-8 are multi-byte. Good') ;
length is a built in function, no need for brackets on it. Removed brackets for perlcritic friendliness. @@ +173,5 @@
$delete_form_link_exists = 1; } } +is( $add_form_link_exists, 1, 'Add form link exists'); +is( $delete_form_link_exists, 1, 'Delete form link exists');
Added a reasonable test description string to make perlcritic happier. -- You are receiving this mail because: You are watching all bug changes.