From a1fe32d2f81d6275d5a653bd19dae82c5a1ac231 Mon Sep 17 00:00:00 2001 From: Joe Atzberger Date: Thu, 18 Oct 2007 03:46:20 -0500 Subject: [PATCH] Total Test Overhaul! Most of these were stubs, and still are. Input.t was replaced because it tested a now obsolete function. Input.pm has that function commented out. Several files were renamed to match their counterparts or correct misspellingz. Signed-off-by: Chris Cormack Signed-off-by: Joshua Ferraro --- C4/Input.pm | 68 +++------ t/Accounts.t | 19 ++- t/Acquisition.t | 32 ++--- t/Amazon.t | 19 ++- t/Auth.t | 19 ++- t/Auth_with_ldap.t | 17 ++- t/AuthoritesMarc.t | 5 - t/AuthoritiesMarc.t | 14 ++ t/Barcodes_PrinterConfig.t | 19 ++- t/Biblio.t | 19 ++- t/Bookfund.t | 19 ++- t/Bookseller.t | 19 ++- t/Boolean.t | 3 + t/Branch.t | 19 ++- t/Breeding.t | 19 ++- t/Calendar.t | 19 ++- t/Charset.t | 5 +- t/Circulation.t | 19 ++- t/Context.t | 19 ++- t/Date.t | 0 t/Dates.t | 9 +- t/Input.t | 59 ++------ t/{koha.t => Koha.t} | 0 t/Labels.t | 19 ++- t/Languages.t | 19 ++- t/Letters.t | 19 ++- t/Log.t | 19 ++- t/Maintainance.t | 19 ++- t/Members.t | 19 ++- t/NewsChannels.t | 19 ++- t/Output.t | 0 t/Overdues.t | 19 ++- t/Print.t | 19 ++- t/Record.t | 19 ++- t/Reserves.t | 19 ++- t/Review.t | 19 ++- t/Search.t | 19 ++- t/Serials.t | 19 ++- t/Stats.t | 19 ++- t/Suggestions.t | 19 ++- t/VirtualShelves.t | 0 t/Z3950.t | 19 ++- t/dummy.t | 0 t/output.t | 282 ------------------------------------- 44 files changed, 491 insertions(+), 554 deletions(-) mode change 100644 => 100755 t/Accounts.t mode change 100644 => 100755 t/Acquisition.t mode change 100644 => 100755 t/Amazon.t mode change 100644 => 100755 t/Auth.t mode change 100644 => 100755 t/Auth_with_ldap.t delete mode 100644 t/AuthoritesMarc.t create mode 100755 t/AuthoritiesMarc.t mode change 100644 => 100755 t/Barcodes_PrinterConfig.t mode change 100644 => 100755 t/Biblio.t mode change 100644 => 100755 t/Bookfund.t mode change 100644 => 100755 t/Bookseller.t mode change 100644 => 100755 t/Boolean.t mode change 100644 => 100755 t/Branch.t mode change 100644 => 100755 t/Breeding.t mode change 100644 => 100755 t/Calendar.t mode change 100644 => 100755 t/Charset.t mode change 100644 => 100755 t/Circulation.t mode change 100644 => 100755 t/Context.t mode change 100644 => 100755 t/Date.t mode change 100644 => 100755 t/Input.t rename t/{koha.t => Koha.t} (100%) mode change 100644 => 100755 mode change 100644 => 100755 t/Labels.t mode change 100644 => 100755 t/Languages.t mode change 100644 => 100755 t/Letters.t mode change 100644 => 100755 t/Log.t mode change 100644 => 100755 t/Maintainance.t mode change 100644 => 100755 t/Members.t mode change 100644 => 100755 t/NewsChannels.t mode change 100644 => 100755 t/Output.t mode change 100644 => 100755 t/Overdues.t mode change 100644 => 100755 t/Print.t mode change 100644 => 100755 t/Record.t mode change 100644 => 100755 t/Reserves.t mode change 100644 => 100755 t/Review.t mode change 100644 => 100755 t/Search.t mode change 100644 => 100755 t/Serials.t mode change 100644 => 100755 t/Stats.t mode change 100644 => 100755 t/Suggestions.t mode change 100644 => 100755 t/VirtualShelves.t mode change 100644 => 100755 t/Z3950.t mode change 100644 => 100755 t/dummy.t delete mode 100644 t/output.t diff --git a/C4/Input.pm b/C4/Input.pm index b66c116b13..94934286ad 100644 --- a/C4/Input.pm +++ b/C4/Input.pm @@ -62,14 +62,14 @@ checkdigit at the end of C<$cardnumber>. Returns a true value iff C<$cardnumber> has a valid check digit. =cut + #' -sub checkdigit { +sub checkdigit ($;$) { my ($infl, $nounique) = @_; $infl = uc $infl; - - #Check to make sure the cardnumber is unique + # Check to make sure the cardnumber is unique #FIXME: We should make the error for a nonunique cardnumber #different from the one where the checkdigit on the number is @@ -77,9 +77,8 @@ sub checkdigit { unless ( $nounique ) { - my $dbh=C4::Context->dbh; my $query=qq{SELECT * FROM borrowers WHERE cardnumber=?}; - my $sth=$dbh->prepare($query); + my $sth=C4::Context->prepare($query); $sth->execute($infl); my %results = $sth->fetchrow_hashref(); if ( $sth->rows != 0 ) @@ -93,25 +92,22 @@ sub checkdigit { my @weightings = (8,4,6,3,5,2,1); my $sum; - my $i = 1; - my $valid = 0; - - foreach $i (1..7) { + foreach my $i (1..7) { my $temp1 = $weightings[$i-1]; my $temp2 = substr($infl,$i,1); $sum += $temp1 * $temp2; } my $rem = ($sum%11); if ($rem == 10) { - $rem = "X"; + $rem = "X"; } if ($rem eq substr($infl,8,1)) { - $valid = 1; + return 1; } - return $valid; + return 0; } # sub checkdigit -=item checkvalidisbn +=item checkvalidisbn # Obsolete Function! $valid = &checkvalidisbn($isbn); @@ -119,41 +115,23 @@ Returns a true value iff C<$isbn> is a valid ISBN: it must be ten digits long (counting "X" as a digit), and must have a valid check digit at the end. -=cut -#' -#-------------------------------------- -# Determine if a number is a valid ISBN number, according to length -# of 10 digits and valid checksum -sub checkvalidisbn { - use strict; - my ($q)=@_ ; # Input: ISBN number - - my $isbngood = 0; # Return: true or false - - $q=~s/x$/X/g; # upshift lower case X - $q=~s/[^X\d]//g; - $q=~s/X.//g; - - #return 0 if $q is not ten digits long - if (length($q)!=10) { - return 0; - } - - #If we get to here, length($q) must be 10 - my $checksum=substr($q,9,1); - my $isbn=substr($q,0,9); - my $i; - my $c=0; - for ($i=0; $i<9; $i++) { +sub checkvalidisbn ($) { # Obsolete Function! + my ($q) = shift or return undef; + $q=~s/[^Xx\d]//g; + /(\d{9})(X|\d)/i or + /(\d{12})(X|\d)/i or return 0; + my $checksum = $2; + my $isbn = $1; + my $c = 0; + my $max = length $isbn; + for (my $i=0; $i<$max; $i++) { my $digit=substr($q,$i,1); $c+=$digit*(10-$i); } $c %= 11; - ($c==10) && ($c='X'); - $isbngood = $c eq $checksum; - return $isbngood; - -} # sub checkvalidisbn + ($c==10) and $c = 'X'; + return ($c eq $checksum) ? 1 : 0; +} =item buildCGISort @@ -163,8 +141,8 @@ Returns the scrolling list with name $input_name, built on authorised Values nam Returns NULL if no authorised values found =cut + sub buildCGIsort { - use strict; my ($name,$input_name,$data) = @_; my $dbh=C4::Context->dbh; my $query=qq{SELECT * FROM authorised_values WHERE category=? order by lib}; diff --git a/t/Accounts.t b/t/Accounts.t old mode 100644 new mode 100755 index 071600447b..f0d8e4dcab --- a/t/Accounts.t +++ b/t/Accounts.t @@ -1,5 +1,14 @@ -BEGIN { $| = 1; print "1..1\n"; } -END {print "not ok 1\n" unless $loaded;} -use C4::Accounts; -$loaded = 1; -print "ok 1\n"; +#!/usr/bin/perl +# +# This Koha test module is a stub! +# Add more tests here!!! + +use strict; +use warnings; + +use Test::More tests => 1; + +BEGIN { + use_ok('C4::Accounts'); +} + diff --git a/t/Acquisition.t b/t/Acquisition.t old mode 100644 new mode 100755 index 41fccacb9d..1fd8716fea --- a/t/Acquisition.t +++ b/t/Acquisition.t @@ -1,20 +1,18 @@ -BEGIN { $| = 1; print "1..3\n"; } -END {print "not ok 1\n" unless $loaded;} -use C4::Acquisition; -$loaded = 1; -print "ok 1\n"; +#!/usr/bin/perl +# +# This Koha test module is a stub! +# Add more tests here!!! -$basketno=NewBasket(1,1); -if ($basketno){ - print "ok 2\n"; -} -else { - print "not ok 2\n"; -} +use strict; +use warnings; -if ($basket=GetBasket($basketno)){ - print "ok 3\n"; -} -else { - print "not ok 3\n"; +use Test::More tests => 3; + +BEGIN { + use_ok('C4::Acquisition'); } + +my ($basket, $basketno); +ok($basketno = NewBasket(1,1), "NewBasket( 1 , 1 ) returns $basketno"); +ok($basket = GetBasket($basketno), "GetBasket($basketno) returns $basket"); + diff --git a/t/Amazon.t b/t/Amazon.t old mode 100644 new mode 100755 index d07963a180..2d085a7192 --- a/t/Amazon.t +++ b/t/Amazon.t @@ -1,7 +1,14 @@ -# Basic compile test only at this stage, needs to be fleshed out +#!/usr/bin/perl +# +# This Koha test module is a stub! +# Add more tests here!!! + +use strict; +use warnings; + +use Test::More tests => 1; + +BEGIN { + use_ok('C4::Amazon'); +} -BEGIN { $| = 1; print "1..1\n"; } -END {print "not ok 1\n" unless $loaded;} -use C4::Amazon; -$loaded = 1; -print "ok 1\n"; diff --git a/t/Auth.t b/t/Auth.t old mode 100644 new mode 100755 index f1ade32ee3..9b1c6409f8 --- a/t/Auth.t +++ b/t/Auth.t @@ -1,5 +1,14 @@ -BEGIN { $| = 1; print "1..1\n"; } -END {print "not ok 1\n" unless $loaded;} -use C4::Auth; -$loaded = 1; -print "ok 1\n"; +#!/usr/bin/perl +# +# This Koha test module is a stub! +# Add more tests here!!! + +use strict; +use warnings; + +use Test::More tests => 1; + +BEGIN { + use_ok('C4::Auth'); +} + diff --git a/t/Auth_with_ldap.t b/t/Auth_with_ldap.t old mode 100644 new mode 100755 index 5888ca9eab..ad4f192ed3 --- a/t/Auth_with_ldap.t +++ b/t/Auth_with_ldap.t @@ -1,5 +1,12 @@ -BEGIN { $| = 1; print "1..1\n"; } -END {print "not ok 1\n" unless $loaded;} -use C4::Auth_with_ldap; -$loaded = 1; -print "ok 1\n"; +#!/bin/perl +# + +use strict; +use warnings; + +use Test::More tests => 1; + +BEGIN { + use_ok('C4::Auth_with_ldap'); +} + diff --git a/t/AuthoritesMarc.t b/t/AuthoritesMarc.t deleted file mode 100644 index a29a82e094..0000000000 --- a/t/AuthoritesMarc.t +++ /dev/null @@ -1,5 +0,0 @@ -BEGIN { $| = 1; print "1..1\n"; } -END {print "not ok 1\n" unless $loaded;} -use C4::AuthoritiesMarc; -$loaded = 1; -print "ok 1\n"; diff --git a/t/AuthoritiesMarc.t b/t/AuthoritiesMarc.t new file mode 100755 index 0000000000..d59b43b2fe --- /dev/null +++ b/t/AuthoritiesMarc.t @@ -0,0 +1,14 @@ +#!/usr/bin/perl +# +# This Koha test module is a stub! +# Add more tests here!!! + +use strict; +use warnings; + +use Test::More tests => 1; + +BEGIN { + use_ok('C4::AuthoritiesMarc'); +} + diff --git a/t/Barcodes_PrinterConfig.t b/t/Barcodes_PrinterConfig.t old mode 100644 new mode 100755 index 33ba55ceef..21e2d6a738 --- a/t/Barcodes_PrinterConfig.t +++ b/t/Barcodes_PrinterConfig.t @@ -1,5 +1,14 @@ -BEGIN { $| = 1; print "1..1\n"; } -END {print "not ok 1\n" unless $loaded;} -use C4::Barcodes::PrinterConfig; -$loaded = 1; -print "ok 1\n"; +#!/usr/bin/perl +# +# This Koha test module is a stub! +# Add more tests here!!! + +use strict; +use warnings; + +use Test::More tests => 1; + +BEGIN { + use_ok('C4::Barcodes::PrinterConfig'); +} + diff --git a/t/Biblio.t b/t/Biblio.t old mode 100644 new mode 100755 index 2b2560a5c6..c18605869a --- a/t/Biblio.t +++ b/t/Biblio.t @@ -1,5 +1,14 @@ -BEGIN { $| = 1; print "1..1\n"; } -END {print "not ok 1\n" unless $loaded;} -use C4::Biblio; -$loaded = 1; -print "ok 1\n"; +#!/usr/bin/perl +# +# This Koha test module is a stub! +# Add more tests here!!! + +use strict; +use warnings; + +use Test::More tests => 1; + +BEGIN { + use_ok('C4::Biblio'); +} + diff --git a/t/Bookfund.t b/t/Bookfund.t old mode 100644 new mode 100755 index 1b7656b436..30ac0e6562 --- a/t/Bookfund.t +++ b/t/Bookfund.t @@ -1,5 +1,14 @@ -BEGIN { $| = 1; print "1..1\n"; } -END {print "not ok 1\n" unless $loaded;} -use C4::Bookfund; -$loaded = 1; -print "ok 1\n"; +#!/usr/bin/perl +# +# This Koha test module is a stub! +# Add more tests here!!! + +use strict; +use warnings; + +use Test::More tests => 1; + +BEGIN { + use_ok('C4::Bookfund'); +} + diff --git a/t/Bookseller.t b/t/Bookseller.t old mode 100644 new mode 100755 index a1d9a1a083..360a0ad444 --- a/t/Bookseller.t +++ b/t/Bookseller.t @@ -1,5 +1,14 @@ -BEGIN { $| = 1; print "1..1\n"; } -END {print "not ok 1\n" unless $loaded;} -use C4::Bookseller; -$loaded = 1; -print "ok 1\n"; +#!/usr/bin/perl +# +# This Koha test module is a stub! +# Add more tests here!!! + +use strict; +use warnings; + +use Test::More tests => 1; + +BEGIN { + use_ok('C4::Bookseller'); +} + diff --git a/t/Boolean.t b/t/Boolean.t old mode 100644 new mode 100755 index 1c1e4de142..eba01eb0bf --- a/t/Boolean.t +++ b/t/Boolean.t @@ -1,3 +1,6 @@ +#!/usr/bin/perl +# + use strict; use C4::Boolean; diff --git a/t/Branch.t b/t/Branch.t old mode 100644 new mode 100755 index 4d8139031d..35295e6e8e --- a/t/Branch.t +++ b/t/Branch.t @@ -1,5 +1,14 @@ -BEGIN { $| = 1; print "1..1\n"; } -END {print "not ok 1\n" unless $loaded;} -use C4::Branch; -$loaded = 1; -print "ok 1\n"; +#!/usr/bin/perl +# +# This Koha test module is a stub! +# Add more tests here!!! + +use strict; +use warnings; + +use Test::More tests => 1; + +BEGIN { + use_ok('C4::Branch'); +} + diff --git a/t/Breeding.t b/t/Breeding.t old mode 100644 new mode 100755 index 36fa4288da..e672bf1395 --- a/t/Breeding.t +++ b/t/Breeding.t @@ -1,5 +1,14 @@ -BEGIN { $| = 1; print "1..1\n"; } -END {print "not ok 1\n" unless $loaded;} -use C4::Breeding; -$loaded = 1; -print "ok 1\n"; +#!/usr/bin/perl +# +# This Koha test module is a stub! +# Add more tests here!!! + +use strict; +use warnings; + +use Test::More tests => 1; + +BEGIN { + use_ok('C4::Breeding'); +} + diff --git a/t/Calendar.t b/t/Calendar.t old mode 100644 new mode 100755 index bc1705fdc6..d2690f78f6 --- a/t/Calendar.t +++ b/t/Calendar.t @@ -1,5 +1,14 @@ -BEGIN { $| = 1; print "1..1\n"; } -END {print "not ok 1\n" unless $loaded;} -use C4::Calendar; -$loaded = 1; -print "ok 1\n"; +#!/usr/bin/perl +# +# This Koha test module is a stub! +# Add more tests here!!! + +use strict; +use warnings; + +use Test::More tests => 1; + +BEGIN { + use_ok('C4::Calendar'); +} + diff --git a/t/Charset.t b/t/Charset.t old mode 100644 new mode 100755 index d4105e5d70..9919daaf7b --- a/t/Charset.t +++ b/t/Charset.t @@ -1,5 +1,8 @@ +#!/usr/bin/perl +# + use strict; -use C4::Interface::CGI::Output; +use C4::Interface::CGI::Output; # use vars qw( @tests ); use vars qw( $loaded ); diff --git a/t/Circulation.t b/t/Circulation.t old mode 100644 new mode 100755 index 9b910352e7..fc531f482c --- a/t/Circulation.t +++ b/t/Circulation.t @@ -1,5 +1,14 @@ -BEGIN { $| = 1; print "1..1\n"; } -END {print "not ok 1\n" unless $loaded;} -use C4::Circulation; -$loaded = 1; -print "ok 1\n"; +#!/usr/bin/perl +# +# This Koha test module is a stub! +# Add more tests here!!! + +use strict; +use warnings; + +use Test::More tests => 1; + +BEGIN { + use_ok('C4::Circulation'); +} + diff --git a/t/Context.t b/t/Context.t old mode 100644 new mode 100755 index 101625060d..6390b733ef --- a/t/Context.t +++ b/t/Context.t @@ -1,5 +1,14 @@ -BEGIN { $| = 1; print "1..1\n"; } -END {print "not ok 1\n" unless $loaded;} -use C4::Context; -$loaded = 1; -print "ok 1\n"; +#!/usr/bin/perl +# +# This Koha test module is a stub! +# Add more tests here!!! + +use strict; +use warnings; + +use Test::More tests => 1; + +BEGIN { + use_ok('C4::Context'); +} + diff --git a/t/Date.t b/t/Date.t old mode 100644 new mode 100755 diff --git a/t/Dates.t b/t/Dates.t index bbaf706461..303e582cd3 100755 --- a/t/Dates.t +++ b/t/Dates.t @@ -1,4 +1,7 @@ -#!/bin/perl +#!/usr/bin/perl + +use strict; +use warnings; use Test::More tests => 91; BEGIN { @@ -13,7 +16,7 @@ my %thash = ( '19890921 143907' ], ); -my ($today, $today0, $val, $re, $syspref); +my ($date, $format, $today, $today0, $val, $re, $syspref); my @formats = sort keys %thash; diag "\n Testing Legacy Functions: format_date and format_date_in_iso"; ok($syspref = C4::Dates->new->format(), "Your system preference is: $syspref"); @@ -38,7 +41,7 @@ foreach (@formats) { } diag "\nTesting with inputs:\n"; -foreach my $format (@formats) { +foreach $format (@formats) { my $pre = sprintf '(%-6s)', $format; foreach my $testval (@{$thash{ $format }}) { ok($date = C4::Dates->new($testval,$format), "$pre Date Creation : new('$testval','$format')"); diff --git a/t/Input.t b/t/Input.t old mode 100644 new mode 100755 index 8570220303..e23f591eda --- a/t/Input.t +++ b/t/Input.t @@ -1,55 +1,14 @@ -# $Id$ - -#use strict; - -BEGIN { $| = 1; print "1..13\n"; } -END {print "not ok 1\n" unless $loaded;} -use C4::Input; -$loaded = 1; -print "ok 1\n"; - -my $TestCount=1; - -#----------------- -# Test ISBN validation +#!/usr/bin/perl +# +# This Koha test module is a stub! +# Add more tests here!!! -my $isbn; +use strict; +use warnings; -# Good numbers -foreach $isbn ('0836213092','087784805X','087784805x','1878685899') { - PrintNextTestResult ( &checkvalidisbn($isbn), "Good ISBN: $isbn" ) -} +use Test::More tests => 1; -# Bad numbers -foreach $isbn ('0836213192','087784804X','087784806x','1878685898', - '', ' ', 'abc', '1234567890123') { - PrintNextTestResult ( ! &checkvalidisbn($isbn), "Bad ISBN: $isbn" ) +BEGIN { + use_ok('C4::Input'); } - - -#----------------------- -sub PrintNextTestResult { - # modifies global var $TestCount - my ($ThisTestResult, $TestComment )=@_; - - $TestCount++; - - if ( $ThisTestResult ) { - print "ok $TestCount\n"; - } else { - print STDERR "\nTest failed: $TestComment\n"; - print "not ok $TestCount\n"; - } - -} # sub PrintNextTestResult - -#----------------------- -# $Log$ -# Revision 1.2 2002/06/20 18:18:06 tonnesen -# 47 files to go, 47 files to go, take one down, pass it around... -# 46 files to go. -# -# Revision 1.1.2.1 2002/06/20 15:19:34 amillar -# Test valid ISBN numbers in Input.pm -# diff --git a/t/koha.t b/t/Koha.t old mode 100644 new mode 100755 similarity index 100% rename from t/koha.t rename to t/Koha.t diff --git a/t/Labels.t b/t/Labels.t old mode 100644 new mode 100755 index fb9d1dc5d5..ade5d7e049 --- a/t/Labels.t +++ b/t/Labels.t @@ -1,5 +1,14 @@ -BEGIN { $| = 1; print "1..1\n"; } -END {print "not ok 1\n" unless $loaded;} -use C4::Labels; -$loaded = 1; -print "ok 1\n"; +#!/usr/bin/perl +# +# This Koha test module is a stub! +# Add more tests here!!! + +use strict; +use warnings; + +use Test::More tests => 1; + +BEGIN { + use_ok('C4::Labels'); +} + diff --git a/t/Languages.t b/t/Languages.t old mode 100644 new mode 100755 index d3fb584ca7..9122936b4a --- a/t/Languages.t +++ b/t/Languages.t @@ -1,5 +1,14 @@ -BEGIN { $| = 1; print "1..1\n"; } -END {print "not ok 1\n" unless $loaded;} -use C4::Languages; -$loaded = 1; -print "ok 1\n"; +#!/usr/bin/perl +# +# This Koha test module is a stub! +# Add more tests here!!! + +use strict; +use warnings; + +use Test::More tests => 1; + +BEGIN { + use_ok('C4::Languages'); +} + diff --git a/t/Letters.t b/t/Letters.t old mode 100644 new mode 100755 index 1a669ea76f..603e37efa7 --- a/t/Letters.t +++ b/t/Letters.t @@ -1,5 +1,14 @@ -BEGIN { $| = 1; print "1..1\n"; } -END {print "not ok 1\n" unless $loaded;} -use C4::Letters; -$loaded = 1; -print "ok 1\n"; +#!/usr/bin/perl +# +# This Koha test module is a stub! +# Add more tests here!!! + +use strict; +use warnings; + +use Test::More tests => 1; + +BEGIN { + use_ok('C4::Letters'); +} + diff --git a/t/Log.t b/t/Log.t old mode 100644 new mode 100755 index 7e38ec8ca6..eca6b9c60e --- a/t/Log.t +++ b/t/Log.t @@ -1,5 +1,14 @@ -BEGIN { $| = 1; print "1..1\n"; } -END {print "not ok 1\n" unless $loaded;} -use C4::Log; -$loaded = 1; -print "ok 1\n"; +#!/usr/bin/perl +# +# This Koha test module is a stub! +# Add more tests here!!! + +use strict; +use warnings; + +use Test::More tests => 1; + +BEGIN { + use_ok('C4::Log'); +} + diff --git a/t/Maintainance.t b/t/Maintainance.t old mode 100644 new mode 100755 index 7383662306..0106d47610 --- a/t/Maintainance.t +++ b/t/Maintainance.t @@ -1,5 +1,14 @@ -BEGIN { $| = 1; print "1..1\n"; } -END {print "not ok 1\n" unless $loaded;} -use C4::Maintainance; -$loaded = 1; -print "ok 1\n"; +#!/usr/bin/perl +# +# This Koha test module is a stub! +# Add more tests here!!! + +use strict; +use warnings; + +use Test::More tests => 1; + +BEGIN { + use_ok('C4::Maintainance'); +} + diff --git a/t/Members.t b/t/Members.t old mode 100644 new mode 100755 index 4e2b714770..bbcfc95c32 --- a/t/Members.t +++ b/t/Members.t @@ -1,5 +1,14 @@ -BEGIN { $| = 1; print "1..1\n"; } -END {print "not ok 1\n" unless $loaded;} -use C4::Members; -$loaded = 1; -print "ok 1\n"; +#!/usr/bin/perl +# +# This Koha test module is a stub! +# Add more tests here!!! + +use strict; +use warnings; + +use Test::More tests => 1; + +BEGIN { + use_ok('C4::Members'); +} + diff --git a/t/NewsChannels.t b/t/NewsChannels.t old mode 100644 new mode 100755 index 7b3b09210a..bbcaab14cc --- a/t/NewsChannels.t +++ b/t/NewsChannels.t @@ -1,5 +1,14 @@ -BEGIN { $| = 1; print "1..1\n"; } -END {print "not ok 1\n" unless $loaded;} -use C4::NewsChannels; -$loaded = 1; -print "ok 1\n"; +#!/usr/bin/perl +# +# This Koha test module is a stub! +# Add more tests here!!! + +use strict; +use warnings; + +use Test::More tests => 1; + +BEGIN { + use_ok('C4::NewsChannels'); +} + diff --git a/t/Output.t b/t/Output.t old mode 100644 new mode 100755 diff --git a/t/Overdues.t b/t/Overdues.t old mode 100644 new mode 100755 index c13185da71..62725cb746 --- a/t/Overdues.t +++ b/t/Overdues.t @@ -1,5 +1,14 @@ -BEGIN { $| = 1; print "1..1\n"; } -END {print "not ok 1\n" unless $loaded;} -use C4::Overdues; -$loaded = 1; -print "ok 1\n"; +#!/usr/bin/perl +# +# This Koha test module is a stub! +# Add more tests here!!! + +use strict; +use warnings; + +use Test::More tests => 1; + +BEGIN { + use_ok('C4::Overdues'); +} + diff --git a/t/Print.t b/t/Print.t old mode 100644 new mode 100755 index 60bd85a0bc..1a05304e4d --- a/t/Print.t +++ b/t/Print.t @@ -1,5 +1,14 @@ -BEGIN { $| = 1; print "1..1\n"; } -END {print "not ok 1\n" unless $loaded;} -use C4::Print; -$loaded = 1; -print "ok 1\n"; +#!/usr/bin/perl +# +# This Koha test module is a stub! +# Add more tests here!!! + +use strict; +use warnings; + +use Test::More tests => 1; + +BEGIN { + use_ok('C4::Print'); +} + diff --git a/t/Record.t b/t/Record.t old mode 100644 new mode 100755 index aff208338a..c01bc048f0 --- a/t/Record.t +++ b/t/Record.t @@ -1,5 +1,14 @@ -BEGIN { $| = 1; print "1..1\n"; } -END {print "not ok 1\n" unless $loaded;} -use C4::Record; -$loaded = 1; -print "ok 1\n"; +#!/usr/bin/perl +# +# This Koha test module is a stub! +# Add more tests here!!! + +use strict; +use warnings; + +use Test::More tests => 1; + +BEGIN { + use_ok('C4::Record'); +} + diff --git a/t/Reserves.t b/t/Reserves.t old mode 100644 new mode 100755 index bed050bcf3..f61d25852e --- a/t/Reserves.t +++ b/t/Reserves.t @@ -1,5 +1,14 @@ -BEGIN { $| = 1; print "1..1\n"; } -END {print "not ok 1\n" unless $loaded;} -use C4::Reserves; -$loaded = 1; -print "ok 1\n"; +#!/usr/bin/perl +# +# This Koha test module is a stub! +# Add more tests here!!! + +use strict; +use warnings; + +use Test::More tests => 1; + +BEGIN { + use_ok('C4::Reserves'); +} + diff --git a/t/Review.t b/t/Review.t old mode 100644 new mode 100755 index 071600447b..40e650ff5a --- a/t/Review.t +++ b/t/Review.t @@ -1,5 +1,14 @@ -BEGIN { $| = 1; print "1..1\n"; } -END {print "not ok 1\n" unless $loaded;} -use C4::Accounts; -$loaded = 1; -print "ok 1\n"; +#!/usr/bin/perl +# +# This Koha test module is a stub! +# Add more tests here!!! + +use strict; +use warnings; + +use Test::More tests => 1; + +BEGIN { + use_ok('C4::Review'); +} + diff --git a/t/Search.t b/t/Search.t old mode 100644 new mode 100755 index dc53eb5829..3527060307 --- a/t/Search.t +++ b/t/Search.t @@ -1,5 +1,14 @@ -BEGIN { $| = 1; print "1..1\n"; } -END {print "not ok 1\n" unless $loaded;} -use C4::Search; -$loaded = 1; -print "ok 1\n"; +#!/usr/bin/perl +# +# This Koha test module is a stub! +# Add more tests here!!! + +use strict; +use warnings; + +use Test::More tests => 1; + +BEGIN { + use_ok('C4::Search'); +} + diff --git a/t/Serials.t b/t/Serials.t old mode 100644 new mode 100755 index 11a33dac91..b583746b56 --- a/t/Serials.t +++ b/t/Serials.t @@ -1,5 +1,14 @@ -BEGIN { $| = 1; print "1..1\n"; } -END {print "not ok 1\n" unless $loaded;} -use C4::Serials; -$loaded = 1; -print "ok 1\n"; +#!/usr/bin/perl +# +# This Koha test module is a stub! +# Add more tests here!!! + +use strict; +use warnings; + +use Test::More tests => 1; + +BEGIN { + use_ok('C4::Serials'); +} + diff --git a/t/Stats.t b/t/Stats.t old mode 100644 new mode 100755 index b797345fa2..d56c2c93b6 --- a/t/Stats.t +++ b/t/Stats.t @@ -1,5 +1,14 @@ -BEGIN { $| = 1; print "1..1\n"; } -END {print "not ok 1\n" unless $loaded;} -use C4::Stats; -$loaded = 1; -print "ok 1\n"; +#!/usr/bin/perl +# +# This Koha test module is a stub! +# Add more tests here!!! + +use strict; +use warnings; + +use Test::More tests => 1; + +BEGIN { + use_ok('C4::Stats'); +} + diff --git a/t/Suggestions.t b/t/Suggestions.t old mode 100644 new mode 100755 index 3ac114b9ea..afc0f00ebf --- a/t/Suggestions.t +++ b/t/Suggestions.t @@ -1,5 +1,14 @@ -BEGIN { $| = 1; print "1..1\n"; } -END {print "not ok 1\n" unless $loaded;} -use C4::Suggestions; -$loaded = 1; -print "ok 1\n"; +#!/usr/bin/perl +# +# This Koha test module is a stub! +# Add more tests here!!! + +use strict; +use warnings; + +use Test::More tests => 1; + +BEGIN { + use_ok('C4::Suggestions'); +} + diff --git a/t/VirtualShelves.t b/t/VirtualShelves.t old mode 100644 new mode 100755 diff --git a/t/Z3950.t b/t/Z3950.t old mode 100644 new mode 100755 index 672e62243e..4fb4c37917 --- a/t/Z3950.t +++ b/t/Z3950.t @@ -1,5 +1,14 @@ -BEGIN { $| = 1; print "1..1\n"; } -END {print "not ok 1\n" unless $loaded;} -use C4::Z3950; -$loaded = 1; -print "ok 1\n"; +#!/usr/bin/perl +# +# This Koha test module is a stub! +# Add more tests here!!! + +use strict; +use warnings; + +use Test::More tests => 1; + +BEGIN { + use_ok('C4::Z3950'); +} + diff --git a/t/dummy.t b/t/dummy.t old mode 100644 new mode 100755 diff --git a/t/output.t b/t/output.t deleted file mode 100644 index 059c2c6788..0000000000 --- a/t/output.t +++ /dev/null @@ -1,282 +0,0 @@ -BEGIN { $| = 1; print "1..25\n"; } -END {print "not ok 1\n" unless $loaded;} -use C4::Output; -$loaded = 1; -print "ok 1\n"; - -# -# ensure &startpage returns correct value -# -if ("\n" eq startpage()) { - print "ok 2\n"; -} else { - print "not ok 2\n"; -} - -# -# Check that &gotopage returns proper value -# -if ("" eq gotopage('foo')) { - print "ok 3\n"; -} else { - print "not ok 3\n"; -} - -# -# skipping &startmenu for now -# - -# -# skipping &endmenu for now - -# -# ensure &mktablehdr returns a proper value -# - -if ("\n" eq mktablehdr()) { - print "ok 4\n"; -} else { - print "not ok 4\n"; -} - -# -# ensure &mktablerow returns a proper value -# -# 1 row, no background image -if ("\n" eq - mktablerow(1,'red','text')) { - print "ok 5\n"; -} else { - print "not ok 5\n"; -} -# 1 row, background image -if ("\n" eq - mktablerow(1,'red','text','foo.jpg')) { - print "ok 6\n"; -} else { - print "not ok 6\n"; -} -#2 rows, no background image -if ("\n" eq - mktablerow(2,'red','text','text')) { - print "ok 7\n"; -} else { - print "not ok 7\n"; -} - -# 2 rows, background image -if ("\n" eq - mktablerow(2,'red','text','text', 'foo.jpg')) { - print "ok 8\n"; -} else { - print "not ok 8\n"; -} - -# -# ensure mktableft returns the proper value -# - -if ("
text
text
texttext
texttext
\n" eq mktableft()) { - print "ok 9\n"; -} else { - print "not ok 9\n"; -} - - -# -# skipping mkform for now -# - -# -# skipping mkform3 for now -# - -# -# skipping mkform2 for now -# - -# -# ensure endpage returns the proper value -# - -if ("\n" eq endpage()) { - print "ok 10\n"; -} else { - print "not ok 10\n"; -} - - -# -# ensure mklink returns the right value -# - -if ("foo" eq mklink('foo.html', 'foo')) { - print "ok 11\n"; -} else { - print "not ok 11\n"; -} - -# -# ensure mkheadr returns the proper value -# - -if ("foo
" eq mkheadr(1,'foo')) { - print "ok 12\n"; -} else { - print "not ok 12\n"; -} - -if ("foo" eq mkheadr(2,'foo')) { - print "ok 13\n"; -} else { - print "not ok 13\n"; -} - -if ("foo

" eq mkheadr(3,'foo')) { - print "ok 14\n"; -} else { - print "not ok 14\n"; -} - -# -# test ¢er and &endcenter -# - -if ("

\n" eq center()) { - print "ok 15\n"; -} else { - print "not ok15\n"; -} - -if ("
\n" eq endcenter()) { - print "ok 16\n"; -} else { - print "not ok 16\n"; -} - -# -# ensure bold returns proper value -# - -if ("foo" eq bold('foo')) { - print "ok 17\n"; -} else { - print "not ok\n"; -} - -# -# ensure &mkformnotable returns a valid value -# - -@inputHidden = qw(hidden hiddenname hiddenvalue); -@inputRadio = qw(radio radioname radiovalue); -@inputText = qw(text textname textvalue); -@inputTextarea = qw(textarea textareaname textareavalue); -@inputSubmit = qw(submit submitname submitvalue); -@inputReset = qw(reset resetname resetvalue); - -# 1 input; hidden -@inputs = (\@inputHidden); -$return ="
\n"; -$return .= "\n"; -$return .= "
"; - -if ($return eq mkformnotable('actionurl', @inputs)) { - print "ok 18\n"; -} else { - print "not ok 18\n"; -} - -# 1 input; radio -@inputs = (\@inputRadio); -$return ="
\n"; -$return .= "radiovalue\n"; -$return .= "
"; - -if ($return eq mkformnotable('actionurl', @inputs)) { - print "ok 19\n"; -} else { - print "not ok 19\n"; -} - -# 1 input; text -@inputs = (\@inputText); -$return = "
\n"; -$return .= "\n"; -$return .= "
"; - -if ($return eq mkformnotable('actionurl', @inputs)) { - print "ok 20\n"; -} else { - print "not ok 20\n"; -} - - -# 1 input; textarea -@inputs = (\@inputTextarea); -$return = "
\n"; -$return .= "\n"; -$return .= "
"; - -if ($return eq mkformnotable('actionurl', @inputs)) { - print "ok 21\n"; -} else { - print "not ok 21\n"; -} - -# 1 input; submit -@inputs = (\@inputSubmit); -$return = "
\n"; -$return .= "\n"; -$return .= "
"; - -if ($return eq mkformnotable('actionurl', @inputs)) { - print "ok 22\n"; -} else { - print "not ok 22\n"; -} - -# 1 input; reset -@inputs = (\@inputReset); -$return = "
\n"; -$return .= "\n"; -$return .= "
"; - -if ($return eq mkformnotable('actionurl', @inputs)) { - print "ok 23\n"; -} else { - print "not ok 23\n"; -} - -# 2 inputs; hidden and submit -@inputs = (\@inputHidden, \@inputSubmit); -$return = "
\n"; -$return .= "\n"; -$return .= "\n"; -$return .= "
"; - -if ($return eq mkformnotable('actionurl', @inputs)) { - print "ok 24\n"; -} else { - print "not ok 24\n"; -} - - -# 3 inputs; text, submit, and reset -@inputs = (\@inputText, \@inputSubmit, \@inputReset); -$return = "
\n"; -$return .= "\n"; -$return .= "\n"; -$return .= "\n"; -$return .= "
"; - -if ($return eq mkformnotable('actionurl', @inputs)) { - print "ok 25\n"; -} else { - print "not ok 25\n"; -} - - - - - -- 2.39.5