From db755a4307ac09543b4e9e93347f5b319c030bc1 Mon Sep 17 00:00:00 2001 From: Andrew Moore Date: Thu, 8 May 2008 08:10:37 -0500 Subject: [PATCH] bug 2088: test suite refactoring to deal with t/override_context_prefs.pm Some minor changes to get the test suite working a bit better: I removed a superfluous method from t/lib/KohaTest.pm. I made each barcode for the items added in KohaTest.pm unique so that they would actually get inserted. Then, I removed t/override_context_prefs.pm. If you need that functionality, you're a database dependent test and should be a module in t/lib. So, I deleted all of the trivial .t tests that just 'use'd their modules and had no other tests and replaced them with lib/KohaTest/*pm modules that do a little bit more checking on those modules. I removed the references to override_context_prefs.pm in all of the other .t modules. They all pass now with no override_context_prefs.pm module. The database_depenedent.pl test script still does not pass entirely. There's a problem with the zebra index not being reset each time that the tables are truncated. I'll get to that. no functional or documentation changes here. Signed-off-by: Joshua Ferraro --- t/Accounts.t | 17 ------- t/AuthoritiesMarc.t | 17 ------- t/Biblio.t | 17 ------- t/Breeding.t | 17 ------- t/Circulation.t | 17 ------- t/Date.t | 1 - t/Dates.t | 1 - t/Items.t | 2 +- t/Letters.t | 17 ------- t/Log.t | 17 ------- t/Members.t | 17 ------- t/NewsChannels.t | 17 ------- t/Overdues.t | 17 ------- t/Print.t | 17 ------- t/Reserves.t | 17 ------- t/Search.t | 17 ------- t/Serials.t | 17 ------- t/Suggestions.t | 17 ------- t/Z3950.t | 17 ------- t/lib/KohaTest.pm | 28 +----------- t/lib/KohaTest/Accounts.pm | 31 +++++++++++++ t/lib/KohaTest/AuthoritiesMarc.pm | 41 +++++++++++++++++ t/lib/KohaTest/Biblio.pm | 73 +++++++++++++++++++++++++++++++ t/lib/KohaTest/Breeding.pm | 23 ++++++++++ t/lib/KohaTest/Circulation.pm | 54 +++++++++++++++++++++++ t/lib/KohaTest/Dates.pm | 37 ++++++++++++++++ t/lib/KohaTest/Log.pm | 25 +++++++++++ t/lib/KohaTest/Members.pm | 65 +++++++++++++++++++++++++++ t/lib/KohaTest/NewsChannels.pm | 43 ++++++++++++++++++ t/lib/KohaTest/Overdues.pm | 50 +++++++++++++++++++++ t/lib/KohaTest/Print.pm | 24 ++++++++++ t/lib/KohaTest/Reserves.pm | 41 +++++++++++++++++ t/lib/KohaTest/Serials.pm | 70 +++++++++++++++++++++++++++++ t/lib/KohaTest/Suggestions.pm | 30 +++++++++++++ t/lib/KohaTest/Z3950.pm | 25 +++++++++++ t/override_context_prefs.pm | 23 ---------- 36 files changed, 635 insertions(+), 324 deletions(-) delete mode 100755 t/Accounts.t delete mode 100755 t/AuthoritiesMarc.t delete mode 100755 t/Biblio.t delete mode 100755 t/Breeding.t delete mode 100755 t/Circulation.t delete mode 100755 t/Letters.t delete mode 100755 t/Log.t delete mode 100755 t/Members.t delete mode 100755 t/NewsChannels.t delete mode 100755 t/Overdues.t delete mode 100755 t/Print.t delete mode 100755 t/Reserves.t delete mode 100755 t/Search.t delete mode 100755 t/Serials.t delete mode 100755 t/Suggestions.t delete mode 100755 t/Z3950.t create mode 100644 t/lib/KohaTest/Accounts.pm create mode 100644 t/lib/KohaTest/AuthoritiesMarc.pm create mode 100644 t/lib/KohaTest/Biblio.pm create mode 100644 t/lib/KohaTest/Breeding.pm create mode 100644 t/lib/KohaTest/Circulation.pm create mode 100644 t/lib/KohaTest/Dates.pm create mode 100644 t/lib/KohaTest/Log.pm create mode 100644 t/lib/KohaTest/Members.pm create mode 100644 t/lib/KohaTest/NewsChannels.pm create mode 100644 t/lib/KohaTest/Overdues.pm create mode 100644 t/lib/KohaTest/Print.pm create mode 100644 t/lib/KohaTest/Reserves.pm create mode 100644 t/lib/KohaTest/Serials.pm create mode 100644 t/lib/KohaTest/Suggestions.pm create mode 100644 t/lib/KohaTest/Z3950.pm delete mode 100644 t/override_context_prefs.pm diff --git a/t/Accounts.t b/t/Accounts.t deleted file mode 100755 index 27c5f6f3bf..0000000000 --- a/t/Accounts.t +++ /dev/null @@ -1,17 +0,0 @@ -#!/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 FindBin; - use lib $FindBin::Bin; - use override_context_prefs; - use_ok('C4::Accounts'); -} - diff --git a/t/AuthoritiesMarc.t b/t/AuthoritiesMarc.t deleted file mode 100755 index 68fe6d06de..0000000000 --- a/t/AuthoritiesMarc.t +++ /dev/null @@ -1,17 +0,0 @@ -#!/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 FindBin; - use lib $FindBin::Bin; - use override_context_prefs; - use_ok('C4::AuthoritiesMarc'); -} - diff --git a/t/Biblio.t b/t/Biblio.t deleted file mode 100755 index bed3a4599b..0000000000 --- a/t/Biblio.t +++ /dev/null @@ -1,17 +0,0 @@ -#!/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 FindBin; - use lib $FindBin::Bin; - use override_context_prefs; - use_ok('C4::Biblio'); -} - diff --git a/t/Breeding.t b/t/Breeding.t deleted file mode 100755 index 69151d9810..0000000000 --- a/t/Breeding.t +++ /dev/null @@ -1,17 +0,0 @@ -#!/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 FindBin; - use lib $FindBin::Bin; - use override_context_prefs; - use_ok('C4::Breeding'); -} - diff --git a/t/Circulation.t b/t/Circulation.t deleted file mode 100755 index 7d47efce45..0000000000 --- a/t/Circulation.t +++ /dev/null @@ -1,17 +0,0 @@ -#!/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 FindBin; - use lib $FindBin::Bin; - use override_context_prefs; - use_ok('C4::Circulation'); -} - diff --git a/t/Date.t b/t/Date.t index 28c32b2635..a9d9b61e92 100755 --- a/t/Date.t +++ b/t/Date.t @@ -9,7 +9,6 @@ use Test::More tests => 4; BEGIN { use FindBin; use lib $FindBin::Bin; - use override_context_prefs; use_ok('C4::Date'); } diff --git a/t/Dates.t b/t/Dates.t index 755c390ca7..aeec309a4e 100755 --- a/t/Dates.t +++ b/t/Dates.t @@ -7,7 +7,6 @@ use Test::More tests => 126; BEGIN { use FindBin; use lib $FindBin::Bin; - use override_context_prefs; use_ok('C4::Dates', qw(format_date format_date_in_iso)); } diff --git a/t/Items.t b/t/Items.t index 3a10e080a9..e9513bdbe8 100644 --- a/t/Items.t +++ b/t/Items.t @@ -7,7 +7,7 @@ use Test::More tests => 28; BEGIN { use FindBin; use lib $FindBin::Bin; - use override_context_prefs; + # use override_context_prefs; use_ok('C4::Items'); } diff --git a/t/Letters.t b/t/Letters.t deleted file mode 100755 index ad02beb8fe..0000000000 --- a/t/Letters.t +++ /dev/null @@ -1,17 +0,0 @@ -#!/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 FindBin; - use lib $FindBin::Bin; - use override_context_prefs; - use_ok('C4::Letters'); -} - diff --git a/t/Log.t b/t/Log.t deleted file mode 100755 index 823a14e307..0000000000 --- a/t/Log.t +++ /dev/null @@ -1,17 +0,0 @@ -#!/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 FindBin; - use lib $FindBin::Bin; - use override_context_prefs; - use_ok('C4::Log'); -} - diff --git a/t/Members.t b/t/Members.t deleted file mode 100755 index 6f5f588683..0000000000 --- a/t/Members.t +++ /dev/null @@ -1,17 +0,0 @@ -#!/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 FindBin; - use lib $FindBin::Bin; - use override_context_prefs; - use_ok('C4::Members'); -} - diff --git a/t/NewsChannels.t b/t/NewsChannels.t deleted file mode 100755 index 1de9281314..0000000000 --- a/t/NewsChannels.t +++ /dev/null @@ -1,17 +0,0 @@ -#!/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 FindBin; - use lib $FindBin::Bin; - use override_context_prefs; - use_ok('C4::NewsChannels'); -} - diff --git a/t/Overdues.t b/t/Overdues.t deleted file mode 100755 index 4a76e0051a..0000000000 --- a/t/Overdues.t +++ /dev/null @@ -1,17 +0,0 @@ -#!/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 FindBin; - use lib $FindBin::Bin; - use override_context_prefs; - use_ok('C4::Overdues'); -} - diff --git a/t/Print.t b/t/Print.t deleted file mode 100755 index 1064d33665..0000000000 --- a/t/Print.t +++ /dev/null @@ -1,17 +0,0 @@ -#!/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 FindBin; - use lib $FindBin::Bin; - use override_context_prefs; - use_ok('C4::Print'); -} - diff --git a/t/Reserves.t b/t/Reserves.t deleted file mode 100755 index a1ea60fb01..0000000000 --- a/t/Reserves.t +++ /dev/null @@ -1,17 +0,0 @@ -#!/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'); - use FindBin; - use lib $FindBin::Bin; - use override_context_prefs; -} - diff --git a/t/Search.t b/t/Search.t deleted file mode 100755 index 916507b3e4..0000000000 --- a/t/Search.t +++ /dev/null @@ -1,17 +0,0 @@ -#!/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 FindBin; - use lib $FindBin::Bin; - use override_context_prefs; - use_ok('C4::Search'); -} - diff --git a/t/Serials.t b/t/Serials.t deleted file mode 100755 index b078869701..0000000000 --- a/t/Serials.t +++ /dev/null @@ -1,17 +0,0 @@ -#!/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 FindBin; - use lib $FindBin::Bin; - use override_context_prefs; - use_ok('C4::Serials'); -} - diff --git a/t/Suggestions.t b/t/Suggestions.t deleted file mode 100755 index fcf6bfd23d..0000000000 --- a/t/Suggestions.t +++ /dev/null @@ -1,17 +0,0 @@ -#!/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 FindBin; - use lib $FindBin::Bin; - use override_context_prefs; - use_ok('C4::Suggestions'); -} - diff --git a/t/Z3950.t b/t/Z3950.t deleted file mode 100755 index 5b720bd18c..0000000000 --- a/t/Z3950.t +++ /dev/null @@ -1,17 +0,0 @@ -#!/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 FindBin; - use lib $FindBin::Bin; - use override_context_prefs; - use_ok('C4::Z3950'); -} - diff --git a/t/lib/KohaTest.pm b/t/lib/KohaTest.pm index 7ad2d5c6a2..0f65da7dda 100644 --- a/t/lib/KohaTest.pm +++ b/t/lib/KohaTest.pm @@ -193,30 +193,6 @@ sub startup_15_truncate_tables : Test( startup => 1 ) { or $failed_to_truncate = 1; } is( $failed_to_truncate, 0, 'truncated tables' ); - -} - -=head startup_18_set_insecure - -=cut - -# sub startup_18_set_insecure : Test( startup => 4 ) { -sub startup_18_set_insecure { - my $self = shift; - - ok( C4::Context->dbh, 'got a database handle' ); - isa_ok( C4::Context->dbh, 'DBI::db' ); - my $query = q( UPDATE systempreferences - SET value = 1 - WHERE variable = 'insecure' ); - my $ok = C4::Context->dbh->do( $query ); - ok( $ok, 'set context to insecure' ); - - my $insecure_from_preference = C4::Context->preference( 'insecure' ); - is( $insecure_from_preference, 1, 'running in insecure mode' ) - or diag( Data::Dumper->Dump( [ $insecure_from_preference ], [ 'insecure_from_preference' ] ) ); - - return $ok; } =head2 startup_20_add_bookseller @@ -404,7 +380,7 @@ sub add_biblios { a => sprintf( 'The Adventures of Huckleberry Finn Test %s', $counter ), c => "Mark Twain ; illustrated by E.W. Kemble." ), MARC::Field->new( '952', '0', '0', - p => '12345678' ), # barcode + p => '12345678' . $self->random_string() ), # barcode MARC::Field->new( '952', '0', '0', a => 'CPL', b => 'CPL' ), @@ -450,7 +426,7 @@ sub add_biblios { } -=head3 reindex_bibs +=head3 reindex_marc Do a fast reindexing of all of the bib and authority records and mark all zebraqueue entries done. diff --git a/t/lib/KohaTest/Accounts.pm b/t/lib/KohaTest/Accounts.pm new file mode 100644 index 0000000000..1eef7dbc6d --- /dev/null +++ b/t/lib/KohaTest/Accounts.pm @@ -0,0 +1,31 @@ +package KohaTest::Accounts; +use base qw( KohaTest ); + +use strict; +use warnings; + +use Test::More; + +use C4::Accounts; +sub testing_class { 'C4::Accounts' }; + + +sub methods : Test( 1 ) { + my $self = shift; + my @methods = qw( recordpayment + makepayment + getnextacctno + fixaccounts + returnlost + manualinvoice + fixcredit + refund + getcharges + getcredits + getrefunds + ); + + can_ok( $self->testing_class, @methods ); +} + +1; diff --git a/t/lib/KohaTest/AuthoritiesMarc.pm b/t/lib/KohaTest/AuthoritiesMarc.pm new file mode 100644 index 0000000000..6114843ca4 --- /dev/null +++ b/t/lib/KohaTest/AuthoritiesMarc.pm @@ -0,0 +1,41 @@ +package KohaTest::AuthoritiesMarc; +use base qw( KohaTest ); + +use strict; +use warnings; + +use Test::More; + +use C4::AuthoritiesMarc; +sub testing_class { 'C4::AuthoritiesMarc' }; + + +sub methods : Test( 1 ) { + my $self = shift; + my @methods = qw( GetAuthMARCFromKohaField + SearchAuthorities + CountUsage + CountUsageChildren + GetAuthTypeCode + GetTagsLabels + AddAuthority + DelAuthority + ModAuthority + GetAuthorityXML + GetAuthority + GetAuthType + AUTHhtml2marc + FindDuplicateAuthority + BuildSummary + BuildUnimarcHierarchies + BuildUnimarcHierarchy + GetHeaderAuthority + AddAuthorityTrees + merge + get_auth_type_location + ); + + can_ok( $self->testing_class, @methods ); +} + +1; diff --git a/t/lib/KohaTest/Biblio.pm b/t/lib/KohaTest/Biblio.pm new file mode 100644 index 0000000000..3e6634cb48 --- /dev/null +++ b/t/lib/KohaTest/Biblio.pm @@ -0,0 +1,73 @@ +package KohaTest::Biblio; +use base qw( KohaTest ); + +use strict; +use warnings; + +use Test::More; + +use C4::Biblio; +sub testing_class { 'C4::Biblio' }; + + +sub methods : Test( 1 ) { + my $self = shift; + my @methods = qw( + AddBiblio + ModBiblio + ModBiblioframework + DelBiblio + LinkBibHeadingsToAuthorities + GetBiblioData + GetBiblioItemData + GetBiblioItemByBiblioNumber + GetBiblioFromItemNumber + GetBiblio + GetBiblioItemInfosOf + GetMarcStructure + GetUsedMarcStructure + GetMarcFromKohaField + GetMarcBiblio + GetXmlBiblio + GetAuthorisedValueDesc + GetMarcNotes + GetMarcSubjects + GetMarcAuthors + GetMarcUrls + GetMarcSeries + GetFrameworkCode + GetPublisherNameFromIsbn + TransformKohaToMarc + TransformKohaToMarcOneField + TransformHtmlToXml + TransformHtmlToMarc + TransformMarcToKoha + _get_inverted_marc_field_map + _disambiguate + get_koha_field_from_marc + TransformMarcToKohaOneField + PrepareItemrecordDisplay + ModZebra + GetNoZebraIndexes + _DelBiblioNoZebra + _AddBiblioNoZebra + _find_value + _koha_marc_update_bib_ids + _koha_marc_update_biblioitem_cn_sort + _koha_add_biblio + _koha_modify_biblio + _koha_modify_biblioitem_nonmarc + _koha_add_biblioitem + _koha_delete_biblio + _koha_delete_biblioitems + ModBiblioMarc + z3950_extended_services + set_service_options + get_biblio_authorised_values + ); + + can_ok( $self->testing_class, @methods ); +} + +1; + diff --git a/t/lib/KohaTest/Breeding.pm b/t/lib/KohaTest/Breeding.pm new file mode 100644 index 0000000000..d098ae5ffa --- /dev/null +++ b/t/lib/KohaTest/Breeding.pm @@ -0,0 +1,23 @@ +package KohaTest::Breeding; +use base qw( KohaTest ); + +use strict; +use warnings; + +use Test::More; + +use C4::Breeding; +sub testing_class { 'C4::Breeding' }; + + +sub methods : Test( 1 ) { + my $self = shift; + my @methods = qw( ImportBreeding + BreedingSearch + ); + + can_ok( $self->testing_class, @methods ); +} + +1; + diff --git a/t/lib/KohaTest/Circulation.pm b/t/lib/KohaTest/Circulation.pm new file mode 100644 index 0000000000..87b1f6bd39 --- /dev/null +++ b/t/lib/KohaTest/Circulation.pm @@ -0,0 +1,54 @@ +package KohaTest::Circulation; +use base qw( KohaTest ); + +use strict; +use warnings; + +use Test::More; + +use C4::Circulation; +sub testing_class { 'C4::Circulation' }; + + +sub methods : Test( 1 ) { + my $self = shift; + my @methods = qw( barcodedecode + decode + transferbook + TooMany + itemissues + CanBookBeIssued + AddIssue + GetLoanLength + GetIssuingRule + AddReturn + MarkIssueReturned + FixOverduesOnReturn + FixAccountForLostAndReturned + GetItemIssue + GetItemIssues + GetBiblioIssues + CanBookBeRenewed + AddRenewal + GetRenewCount + GetIssuingCharges + AddIssuingCharge + GetTransfers + GetTransfersFromTo + DeleteTransfer + AnonymiseIssueHistory + updateWrongTransfer + UpdateHoldingbranch + CalcDateDue + CheckValidDatedue + CheckRepeatableHolidays + CheckSpecialHolidays + CheckRepeatableSpecialHolidays + CheckValidBarcode + ); + + can_ok( $self->testing_class, @methods ); +} + +1; + diff --git a/t/lib/KohaTest/Dates.pm b/t/lib/KohaTest/Dates.pm new file mode 100644 index 0000000000..19a309d4a7 --- /dev/null +++ b/t/lib/KohaTest/Dates.pm @@ -0,0 +1,37 @@ +package KohaTest::Dates; +use base qw( KohaTest ); + +use strict; +use warnings; + +use Test::More; + +use C4::Dates; +sub testing_class { 'C4::Dates' }; + + +sub methods : Test( 1 ) { + my $self = shift; + my @methods = qw( _prefformat + regexp + dmy_map + _check_date_and_time + _chron_to_ymd + _chron_to_hms + new + init + output + today + _recognize_format + DHTMLcalendar + format + visual + format_date + format_date_in_iso + ); + + can_ok( $self->testing_class, @methods ); +} + +1; + diff --git a/t/lib/KohaTest/Log.pm b/t/lib/KohaTest/Log.pm new file mode 100644 index 0000000000..dc7b26eef4 --- /dev/null +++ b/t/lib/KohaTest/Log.pm @@ -0,0 +1,25 @@ +package KohaTest::Log; +use base qw( KohaTest ); + +use strict; +use warnings; + +use Test::More; + +use C4::Log; +sub testing_class { 'C4::Log' }; + + +sub methods : Test( 1 ) { + my $self = shift; + my @methods = qw( logaction + GetLogStatus + displaylog + GetLogs + ); + + can_ok( $self->testing_class, @methods ); +} + +1; + diff --git a/t/lib/KohaTest/Members.pm b/t/lib/KohaTest/Members.pm new file mode 100644 index 0000000000..9342faba1a --- /dev/null +++ b/t/lib/KohaTest/Members.pm @@ -0,0 +1,65 @@ +package KohaTest::Members; +use base qw( KohaTest ); + +use strict; +use warnings; + +use Test::More; + +use C4::Members; +sub testing_class { 'C4::Members' }; + + +sub methods : Test( 1 ) { + my $self = shift; + my @methods = qw( SearchMember + GetMemberDetails + patronflags + GetMember + GetMemberIssuesAndFines + ModMember + AddMember + Check_Userid + changepassword + fixup_cardnumber + GetGuarantees + UpdateGuarantees + GetPendingIssues + GetAllIssues + GetMemberAccountRecords + GetBorNotifyAcctRecord + checkuniquemember + checkcardnumber + getzipnamecity + getidcity + GetExpiryDate + checkuserpassword + GetborCatFromCatType + GetBorrowercategory + ethnicitycategories + fixEthnicity + GetAge + get_institutions + add_member_orgs + GetCities + GetSortDetails + MoveMemberToDeleted + DelMember + ExtendMemberSubscriptionTo + GetRoadTypes + GetTitles + GetPatronImage + PutPatronImage + RmPatronImage + GetRoadTypeDetails + GetBorrowersWhoHaveNotBorrowedSince + GetBorrowersWhoHaveNeverBorrowed + GetBorrowersWithIssuesHistoryOlderThan + GetBorrowersNamesAndLatestIssue + ); + + can_ok( $self->testing_class, @methods ); +} + +1; + diff --git a/t/lib/KohaTest/NewsChannels.pm b/t/lib/KohaTest/NewsChannels.pm new file mode 100644 index 0000000000..917dfc9847 --- /dev/null +++ b/t/lib/KohaTest/NewsChannels.pm @@ -0,0 +1,43 @@ +package KohaTest::NewsChannels; +use base qw( KohaTest ); + +use strict; +use warnings; + +use Test::More; + +use C4::NewsChannels; +sub testing_class { 'C4::NewsChannels' }; + + +sub methods : Test( 1 ) { + my $self = shift; + my @methods = qw( news_channels + news_channels_by_category + get_new_channel + del_channels + add_channel + update_channel + news_channels_categories + get_new_channel_category + del_channels_categories + add_channel_category + update_channel_category + add_opac_new + upd_opac_new + del_opac_new + get_opac_new + get_opac_news + GetNewsToDisplay + add_opac_electronic + upd_opac_electronic + del_opac_electronic + get_opac_electronic + get_opac_electronics + ); + + can_ok( $self->testing_class, @methods ); +} + +1; + diff --git a/t/lib/KohaTest/Overdues.pm b/t/lib/KohaTest/Overdues.pm new file mode 100644 index 0000000000..949c670961 --- /dev/null +++ b/t/lib/KohaTest/Overdues.pm @@ -0,0 +1,50 @@ +package KohaTest::Overdues; +use base qw( KohaTest ); + +use strict; +use warnings; + +use Test::More; + +use C4::Overdues; +sub testing_class { 'C4::Overdues' }; + + +sub methods : Test( 1 ) { + my $self = shift; + my @methods = qw( Getoverdues + checkoverdues + CalcFine + GetSpecialHolidays + GetRepeatableHolidays + GetWdayFromItemnumber + GetIssuesIteminfo + UpdateFine + BorType + ReplacementCost + GetFine + GetIssuingRules + ReplacementCost2 + GetNextIdNotify + NumberNotifyId + AmountNotify + UpdateAccountLines + GetItems + GetOverdueDelays + CheckAccountLineLevelInfo + GetOverduerules + CheckBorrowerDebarred + UpdateBorrowerDebarred + CheckExistantNotifyid + CheckAccountLineItemInfo + CheckItemNotify + GetOverduesForBranch + AddNotifyLine + RemoveNotifyLine + ); + + can_ok( $self->testing_class, @methods ); +} + +1; + diff --git a/t/lib/KohaTest/Print.pm b/t/lib/KohaTest/Print.pm new file mode 100644 index 0000000000..02fd5fb894 --- /dev/null +++ b/t/lib/KohaTest/Print.pm @@ -0,0 +1,24 @@ +package KohaTest::Print; +use base qw( KohaTest ); + +use strict; +use warnings; + +use Test::More; + +use C4::Print; +sub testing_class { 'C4::Print' }; + + +sub methods : Test( 1 ) { + my $self = shift; + my @methods = qw( remoteprint + printreserve + printslip + ); + + can_ok( $self->testing_class, @methods ); +} + +1; + diff --git a/t/lib/KohaTest/Reserves.pm b/t/lib/KohaTest/Reserves.pm new file mode 100644 index 0000000000..5317029c75 --- /dev/null +++ b/t/lib/KohaTest/Reserves.pm @@ -0,0 +1,41 @@ +package KohaTest::Reserves; +use base qw( KohaTest ); + +use strict; +use warnings; + +use Test::More; + +use C4::Reserves; +sub testing_class { 'C4::Reserves' }; + + +sub methods : Test( 1 ) { + my $self = shift; + my @methods = qw( AddReserve + GetReservesFromBiblionumber + GetReservesFromItemnumber + GetReservesFromBorrowernumber + GetReserveCount + GetOtherReserves + GetReserveFee + GetReservesToBranch + GetReservesForBranch + CheckReserves + CancelReserve + ModReserve + ModReserveFill + ModReserveStatus + ModReserveAffect + ModReserveCancelAll + ModReserveMinusPriority + GetReserveInfo + _FixPriority + _Findgroupreserve + ); + + can_ok( $self->testing_class, @methods ); +} + +1; + diff --git a/t/lib/KohaTest/Serials.pm b/t/lib/KohaTest/Serials.pm new file mode 100644 index 0000000000..e572d1faff --- /dev/null +++ b/t/lib/KohaTest/Serials.pm @@ -0,0 +1,70 @@ +package KohaTest::Serials; +use base qw( KohaTest ); + +use strict; +use warnings; + +use Test::More; + +use C4::Serials; +sub testing_class { 'C4::Serials' }; + + +sub methods : Test( 1 ) { + my $self = shift; + my @methods = qw( GetSuppliersWithLateIssues + GetLateIssues + GetSubscriptionHistoryFromSubscriptionId + GetSerialStatusFromSerialId + GetSerialInformation + AddItem2Serial + UpdateClaimdateIssues + GetSubscription + GetFullSubscription + PrepareSerialsData + GetSubscriptionsFromBiblionumber + GetFullSubscriptionsFromBiblionumber + GetSubscriptions + GetSerials + GetSerials2 + GetLatestSerials + GetDistributedTo + GetNextSeq + GetSeq + GetExpirationDate + CountSubscriptionFromBiblionumber + ModSubscriptionHistory + ModSerialStatus + ModSubscription + NewSubscription + ReNewSubscription + NewIssue + ItemizeSerials + HasSubscriptionExpired + SetDistributedto + DelSubscription + DelIssue + GetLateOrMissingIssues + removeMissingIssue + updateClaim + getsupplierbyserialid + check_routing + addroutingmember + reorder_members + delroutingmember + getroutinglist + countissuesfrom + abouttoexpire + old_newsubscription + old_modsubscription + old_getserials + in_array + GetNextDate + itemdata + ); + + can_ok( $self->testing_class, @methods ); +} + +1; + diff --git a/t/lib/KohaTest/Suggestions.pm b/t/lib/KohaTest/Suggestions.pm new file mode 100644 index 0000000000..0c74717a0f --- /dev/null +++ b/t/lib/KohaTest/Suggestions.pm @@ -0,0 +1,30 @@ +package KohaTest::Suggestions; +use base qw( KohaTest ); + +use strict; +use warnings; + +use Test::More; + +use C4::Suggestions; +sub testing_class { 'C4::Suggestions' }; + + +sub methods : Test( 1 ) { + my $self = shift; + my @methods = qw( SearchSuggestion + GetSuggestion + GetSuggestionFromBiblionumber + GetSuggestionByStatus + CountSuggestion + NewSuggestion + ModStatus + ConnectSuggestionAndBiblio + DelSuggestion + ); + + can_ok( $self->testing_class, @methods ); +} + +1; + diff --git a/t/lib/KohaTest/Z3950.pm b/t/lib/KohaTest/Z3950.pm new file mode 100644 index 0000000000..3d94cff151 --- /dev/null +++ b/t/lib/KohaTest/Z3950.pm @@ -0,0 +1,25 @@ +package KohaTest::Z3950; +use base qw( KohaTest ); + +use strict; +use warnings; + +use Test::More; + +use C4::Z3950; +sub testing_class { 'C4::Z3950' }; + + +sub methods : Test( 1 ) { + my $self = shift; + my @methods = qw( getz3950servers + z3950servername + addz3950queue + checkz3950searchdone + ); + + can_ok( $self->testing_class, @methods ); +} + +1; + diff --git a/t/override_context_prefs.pm b/t/override_context_prefs.pm deleted file mode 100644 index 588fd68d4d..0000000000 --- a/t/override_context_prefs.pm +++ /dev/null @@ -1,23 +0,0 @@ -use strict; -use warnings; - -# This stub module is used to override -# the C4::Context sub preference for the -# purpose of the test suite. This allows -# non-DB-dependent tests of most modules, -# particularly the ones that include C4::Dates. - -use C4::Context; - -package C4::Context; -no warnings; -sub preference { - my $self = shift; - my $pref = shift; - return 'us' if $pref eq 'dateformat'; - return 'MARC21' if $pref eq 'marcflavour'; - return 'Test Library' if $pref eq 'LibraryName'; - return; -} - -1; -- 2.39.5