Permalink
Browse files

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 <crc@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
  • Loading branch information...
1 parent 92dbfc6 commit a1fe32d2f81d6275d5a653bd19dae82c5a1ac231 Joe Atzberger committed with Joshua Ferraro Oct 18, 2007
Showing with 491 additions and 554 deletions.
  1. +23 −45 C4/Input.pm
  2. +14 −5 t/Accounts.t
  3. +15 −17 t/Acquisition.t
  4. +13 −6 t/Amazon.t
  5. +14 −5 t/Auth.t
  6. +12 −5 t/Auth_with_ldap.t
  7. +0 −5 t/AuthoritesMarc.t
  8. +14 −0 t/AuthoritiesMarc.t
  9. +14 −5 t/Barcodes_PrinterConfig.t
  10. +14 −5 t/Biblio.t
  11. +14 −5 t/Bookfund.t
  12. +14 −5 t/Bookseller.t
  13. +3 −0 t/Boolean.t
  14. +14 −5 t/Branch.t
  15. +14 −5 t/Breeding.t
  16. +14 −5 t/Calendar.t
  17. +4 −1 t/Charset.t
  18. +14 −5 t/Circulation.t
  19. +14 −5 t/Context.t
  20. 0 t/Date.t
  21. +6 −3 t/Dates.t
  22. +9 −50 t/Input.t
  23. 0 t/{koha.t → Koha.t}
  24. +14 −5 t/Labels.t
  25. +14 −5 t/Languages.t
  26. +14 −5 t/Letters.t
  27. +14 −5 t/Log.t
  28. +14 −5 t/Maintainance.t
  29. +14 −5 t/Members.t
  30. +14 −5 t/NewsChannels.t
  31. 0 t/Output.t
  32. +14 −5 t/Overdues.t
  33. +14 −5 t/Print.t
  34. +14 −5 t/Record.t
  35. +14 −5 t/Reserves.t
  36. +14 −5 t/Review.t
  37. +14 −5 t/Search.t
  38. +14 −5 t/Serials.t
  39. +14 −5 t/Stats.t
  40. +14 −5 t/Suggestions.t
  41. 0 t/VirtualShelves.t
  42. +14 −5 t/Z3950.t
  43. 0 t/dummy.t
  44. +0 −282 t/output.t
View
68 C4/Input.pm
@@ -62,24 +62,23 @@ 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
#not correct
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,67 +92,46 @@ 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);
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};
View
19 t/Accounts.t 100644 → 100755
@@ -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');
+}
+
View
32 t/Acquisition.t 100644 → 100755
@@ -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");
+
View
19 t/Amazon.t 100644 → 100755
@@ -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";
View
19 t/Auth.t 100644 → 100755
@@ -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');
+}
+
View
17 t/Auth_with_ldap.t 100644 → 100755
@@ -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');
+}
+
View
5 t/AuthoritesMarc.t
@@ -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";
View
14 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');
+}
+
View
19 t/Barcodes_PrinterConfig.t 100644 → 100755
@@ -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');
+}
+
View
19 t/Biblio.t 100644 → 100755
@@ -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');
+}
+
View
19 t/Bookfund.t 100644 → 100755
@@ -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');
+}
+
View
19 t/Bookseller.t 100644 → 100755
@@ -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');
+}
+
View
3 t/Boolean.t 100644 → 100755
@@ -1,3 +1,6 @@
+#!/usr/bin/perl
+#
+
use strict;
use C4::Boolean;
View
19 t/Branch.t 100644 → 100755
@@ -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');
+}
+
View
19 t/Breeding.t 100644 → 100755
@@ -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');
+}
+
View
19 t/Calendar.t 100644 → 100755
@@ -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');
+}
+
View
5 t/Charset.t 100644 → 100755
@@ -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 );
View
19 t/Circulation.t 100644 → 100755
@@ -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');
+}
+
View
19 t/Context.t 100644 → 100755
@@ -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');
+}
+
View
0 t/Date.t 100644 → 100755
File mode changed.
View
9 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')");
View
59 t/Input.t 100644 → 100755
@@ -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
-#
View
0 t/koha.t → t/Koha.t 100644 → 100755
File renamed without changes.
View
19 t/Labels.t 100644 → 100755
@@ -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');
+}
+
View
19 t/Languages.t 100644 → 100755
@@ -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');
+}
+
View
19 t/Letters.t 100644 → 100755
@@ -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');
+}
+
View
19 t/Log.t 100644 → 100755
@@ -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');
+}
+
View
19 t/Maintainance.t 100644 → 100755
@@ -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');
+}
+
View
19 t/Members.t 100644 → 100755
@@ -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');
+}
+
View
19 t/NewsChannels.t 100644 → 100755
@@ -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');
+}
+
View
0 t/Output.t 100644 → 100755
File mode changed.
View
19 t/Overdues.t 100644 → 100755
@@ -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');
+}
+
View
19 t/Print.t 100644 → 100755
@@ -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');
+}
+
View
19 t/Record.t 100644 → 100755
@@ -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');
+}
+
View
19 t/Reserves.t 100644 → 100755
@@ -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');
+}
+
View
19 t/Review.t 100644 → 100755
@@ -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');
+}
+
View
19 t/Search.t 100644 → 100755
@@ -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');
+}
+
View
19 t/Serials.t 100644 → 100755
@@ -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');
+}
+
View
19 t/Stats.t 100644 → 100755
@@ -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');
+}
+
View
19 t/Suggestions.t 100644 → 100755
@@ -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');
+}
+
View
0 t/VirtualShelves.t 100644 → 100755
File mode changed.
View
19 t/Z3950.t 100644 → 100755
@@ -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');
+}
+
View
0 t/dummy.t 100644 → 100755
File mode changed.
View
282 t/output.t
@@ -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 ("<html>\n" eq startpage()) {
- print "ok 2\n";
-} else {
- print "not ok 2\n";
-}
-
-#
-# Check that &gotopage returns proper value
-#
-if ("<META HTTP-EQUIV=Refresh CONTENT=\"0;URL=http:foo\">" 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 ("<table border=0 cellspacing=0 cellpadding=5>\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 ("<tr valign=top bgcolor=red><td>text</td></tr>\n" eq
- mktablerow(1,'red','text')) {
- print "ok 5\n";
-} else {
- print "not ok 5\n";
-}
-# 1 row, background image
-if ("<tr valign=top bgcolor=red><td background=\"foo.jpg\">text</td></tr>\n" eq
- mktablerow(1,'red','text','foo.jpg')) {
- print "ok 6\n";
-} else {
- print "not ok 6\n";
-}
-#2 rows, no background image
-if ("<tr valign=top bgcolor=red><td>text</td><td>text</td></tr>\n" eq
- mktablerow(2,'red','text','text')) {
- print "ok 7\n";
-} else {
- print "not ok 7\n";
-}
-
-# 2 rows, background image
-if ("<tr valign=top bgcolor=red><td background=\"foo.jpg\">text</td><td background=\"foo.jpg\">text</td></tr>\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 ("</table>\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 ("</body></html>\n" eq endpage()) {
- print "ok 10\n";
-} else {
- print "not ok 10\n";
-}
-
-
-#
-# ensure mklink returns the right value
-#
-
-if ("<a href=\"foo.html\">foo</a>" eq mklink('foo.html', 'foo')) {
- print "ok 11\n";
-} else {
- print "not ok 11\n";
-}
-
-#
-# ensure mkheadr returns the proper value
-#
-
-if ("<FONT SIZE=6><em>foo</em></FONT><br>" eq mkheadr(1,'foo')) {
- print "ok 12\n";
-} else {
- print "not ok 12\n";
-}
-
-if ("<FONT SIZE=6><em>foo</em></FONT>" eq mkheadr(2,'foo')) {
- print "ok 13\n";
-} else {
- print "not ok 13\n";
-}
-
-if ("<FONT SIZE=6><em>foo</em></FONT><p>" eq mkheadr(3,'foo')) {
- print "ok 14\n";
-} else {
- print "not ok 14\n";
-}
-
-#
-# test &center and &endcenter
-#
-
-if ("<CENTER>\n" eq center()) {
- print "ok 15\n";
-} else {
- print "not ok15\n";
-}
-
-if ("</CENTER>\n" eq endcenter()) {
- print "ok 16\n";
-} else {
- print "not ok 16\n";
-}
-
-#
-# ensure bold returns proper value
-#
-
-if ("<b>foo</b>" 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 ="<form action=actionurl method=post>\n";
-$return .= "<input type=hidden name=hiddenname value=\"hiddenvalue\">\n";
-$return .= "</form>";
-
-if ($return eq mkformnotable('actionurl', @inputs)) {
- print "ok 18\n";
-} else {
- print "not ok 18\n";
-}
-
-# 1 input; radio
-@inputs = (\@inputRadio);
-$return ="<form action=actionurl method=post>\n";
-$return .= "<input type=radio name=radioname value=\"radiovalue\">radiovalue\n";
-$return .= "</form>";
-
-if ($return eq mkformnotable('actionurl', @inputs)) {
- print "ok 19\n";
-} else {
- print "not ok 19\n";
-}
-
-# 1 input; text
-@inputs = (\@inputText);
-$return = "<form action=actionurl method=post>\n";
-$return .= "<input type=text name=textname value=\"textvalue\">\n";
-$return .= "</form>";
-
-if ($return eq mkformnotable('actionurl', @inputs)) {
- print "ok 20\n";
-} else {
- print "not ok 20\n";
-}
-
-
-# 1 input; textarea
-@inputs = (\@inputTextarea);
-$return = "<form action=actionurl method=post>\n";
-$return .= "<textarea name=textareaname wrap=physical cols=40 rows=4>textareavalue</textarea>\n";
-$return .= "</form>";
-
-if ($return eq mkformnotable('actionurl', @inputs)) {
- print "ok 21\n";
-} else {
- print "not ok 21\n";
-}
-
-# 1 input; submit
-@inputs = (\@inputSubmit);
-$return = "<form action=actionurl method=post>\n";
-$return .= "<input type=submit name=submitname value=\"submitvalue\">\n";
-$return .= "</form>";
-
-if ($return eq mkformnotable('actionurl', @inputs)) {
- print "ok 22\n";
-} else {
- print "not ok 22\n";
-}
-
-# 1 input; reset
-@inputs = (\@inputReset);
-$return = "<form action=actionurl method=post>\n";
-$return .= "<input type=reset name=resetname value=\"resetvalue\">\n";
-$return .= "</form>";
-
-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 = "<form action=actionurl method=post>\n";
-$return .= "<input type=hidden name=hiddenname value=\"hiddenvalue\">\n";
-$return .= "<input type=submit name=submitname value=\"submitvalue\">\n";
-$return .= "</form>";
-
-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 = "<form action=actionurl method=post>\n";
-$return .= "<input type=text name=textname value=\"textvalue\">\n";
-$return .= "<input type=submit name=submitname value=\"submitvalue\">\n";
-$return .= "<input type=reset name=resetname value=\"resetvalue\">\n";
-$return .= "</form>";
-
-if ($return eq mkformnotable('actionurl', @inputs)) {
- print "ok 25\n";
-} else {
- print "not ok 25\n";
-}
-
-
-
-
-

0 comments on commit a1fe32d

Please sign in to comment.