From f918c57e89d7dcc2ce0f824e54ca3285fc511f69 Mon Sep 17 00:00:00 2001
From: Sam Sanders <sam-sanders@live.com>
Date: Thu, 19 Jan 2012 16:18:48 +1300
Subject: [PATCH 01/13] bug 5327 added unit test for C4/Csv.pm

Signed-off-by: Chris Hall <chrish@catalyst.net.nz>
---
 t/Csv.t |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/t/Csv.t b/t/Csv.t
index 068f094..17cd8bb 100755
--- a/t/Csv.t
+++ b/t/Csv.t
@@ -6,9 +6,13 @@
 use strict;
 use warnings;
 
-use Test::More tests => 1;
+use Test::More tests => 4;
 
 BEGIN {
         use_ok('C4::Csv');
 }
 
+ok(C4::Csv::GetCsvProfiles(), 'test getting csv profiles');
+is(C4::Csv::GetCsvProfile(),undef, 'test getting csv profiles');
+
+ok(C4::Csv::GetCsvProfilesLoop(), 'test getting profile loop');
-- 
1.7.5.4


From 3b9722c7dd08009a7baabdb84ad108462a1ba3c4 Mon Sep 17 00:00:00 2001
From: Sam Sanders <sam-sanders@live.com>
Date: Thu, 19 Jan 2012 13:53:15 +1300
Subject: [PATCH 02/13] Bug 5327 added tests for C4/Labels.pm

Signed-off-by: Chris Hall <chrish@catalyst.net.nz>
---
 t/Labels.t |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/t/Labels.t b/t/Labels.t
index 2450794..823511b 100644
--- a/t/Labels.t
+++ b/t/Labels.t
@@ -20,7 +20,7 @@
 use strict;
 use warnings;
 
-use Test::More tests => 2;
+use Test::More tests => 6;
 
 BEGIN {
     use_ok('C4::Labels::Label');
@@ -33,3 +33,11 @@ my $expected_fields = [
     { code => 'itemcallnumber', desc => 'itemcallnumber' }, 
 ];
 is_deeply($parsed_fields, $expected_fields, '"callnumber" in label layout alias for "itemcallnumber" per bug 5653');
+
+is(C4::Labels::Label::_check_params(),"0",'test checking parameters');
+
+ok(C4::Labels::Label::_guide_box(), 'test guide box with nothing entered');
+
+ok(C4::Labels::Label::_get_text_fields(), 'test getting textx fields');
+
+is(C4::Labels::Label::_split_lccn(),"0", 'test when _split_lccn is null');
-- 
1.7.5.4


From 5579abe41f5ab6ce04761545efe1d423faa037d6 Mon Sep 17 00:00:00 2001
From: Jono Mingard <reason.koan@gmail.com>
Date: Thu, 19 Jan 2012 11:03:59 +1300
Subject: [PATCH 03/13] Bug 5327 added unit tests for
 C4/AuthoritiesMarc/MARC21.pm

Signed-off-by: Chris Hall <chrish@catalyst.net.nz>
---
 t/AuthoritiesMarc_MARC21.t |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/t/AuthoritiesMarc_MARC21.t b/t/AuthoritiesMarc_MARC21.t
index d83534a..fbf713a 100755
--- a/t/AuthoritiesMarc_MARC21.t
+++ b/t/AuthoritiesMarc_MARC21.t
@@ -6,9 +6,16 @@
 use strict;
 use warnings;
 
-use Test::More tests => 1;
+use Test::More tests => 4;
+use MARC::Record;
 
 BEGIN {
         use_ok('C4::AuthoritiesMarc::MARC21');
 }
 
+my @result = C4::AuthoritiesMarc::MARC21::default_auth_type_location();
+ok($result[0] eq '942', "testing default_auth_type_location has first value '942'");
+ok($result[1] eq 'a', "testing default_auth_type_location has first value 'a'");
+
+my $marc_record = MARC::Record->new();
+is(C4::AuthoritiesMarc::MARC21::fix_marc21_auth_type_location($marc_record, '', ''), undef, "testing fix_marc21_auth_type_location returns undef with empty MARC record");
-- 
1.7.5.4


From 1a20feb4caa812d49eb8861b06ebc81164ea66c1 Mon Sep 17 00:00:00 2001
From: Jorgia Kelsey <jorgia_m_kelsey@hotmail.com>
Date: Thu, 19 Jan 2012 12:30:05 +1300
Subject: [PATCH 04/13] Bug 5327 added unit tests for
 C4/Barcodes_PrinterConfig.pm

Signed-off-by: Chris Hall <chrish@catalyst.net.nz>
---
 t/Barcodes_PrinterConfig.t |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/t/Barcodes_PrinterConfig.t b/t/Barcodes_PrinterConfig.t
index 21e2d6a..94102e5 100755
--- a/t/Barcodes_PrinterConfig.t
+++ b/t/Barcodes_PrinterConfig.t
@@ -6,9 +6,17 @@
 use strict;
 use warnings;
 
-use Test::More tests => 1;
+use Test::More tests => 6;
 
 BEGIN {
         use_ok('C4::Barcodes::PrinterConfig');
 }
 
+is(C4::Barcodes::PrinterConfig::setPositionsForY(), "0", "testing setPositionsForY returns'0' when given no arguments");
+is(C4::Barcodes::PrinterConfig::setPositionsForX(), "0", "testing setPositionsForX returns'0' when given no arguments");
+
+is(C4::Barcodes::PrinterConfig::setPositionsForY(undef, undef, 5), "5", "testing setPositionsForY returns'5' when given (undef, undef, 5)");
+is(C4::Barcodes::PrinterConfig::setPositionsForX(undef, undef, 5), "5", "testing setPositionsForX returns'5' when given (undef, undef, 5)");
+
+
+is(C4::Barcodes::PrinterConfig::labelsPage(), "0", "testing labelsPage returns'0' when given no arguments");
-- 
1.7.5.4


From 200b5a8231d800a5bec0e57a5cdd0030aa248f75 Mon Sep 17 00:00:00 2001
From: Sam Sanders <sam-sanders@live.com>
Date: Wed, 18 Jan 2012 09:39:55 +1300
Subject: [PATCH 05/13] Bug 5327 added unit tests for C4/ClassSortRoutine/LCC

Signed-off-by: Chris Hall <chrish@catalyst.net.nz>
---
 t/ClassSortRoutine_LCC.t |   15 ++++++++++++++-
 1 files changed, 14 insertions(+), 1 deletions(-)

diff --git a/t/ClassSortRoutine_LCC.t b/t/ClassSortRoutine_LCC.t
index 9a5e007..573c8fe 100755
--- a/t/ClassSortRoutine_LCC.t
+++ b/t/ClassSortRoutine_LCC.t
@@ -6,9 +6,22 @@
 use strict;
 use warnings;
 
-use Test::More tests => 1;
+use Test::More tests => 9;
 
 BEGIN {
         use_ok('C4::ClassSortRoutine::LCC');
 }
 
+#Obvious cases
+is(C4::ClassSortRoutine::LCC::get_class_sort_key(), "", "No arguments returns an empty string");
+is(C4::ClassSortRoutine::LCC::get_class_sort_key('a','b'), "A_B", "Arguments 'a','b' return 'A_B'");
+
+#spaces in arguements
+is(C4::ClassSortRoutine::LCC::get_class_sort_key(' ','b'), "B_", "Arguments ' ','b' return 'B_'");
+is(C4::ClassSortRoutine::LCC::get_class_sort_key('a',' '), "A_", "Arguments 'a',' ' return 'A_'");
+is(C4::ClassSortRoutine::LCC::get_class_sort_key(' ','    '), "", "Arguments ' ','    ' return ''");
+
+#'funky cases' based on regex in code
+is(C4::ClassSortRoutine::LCC::get_class_sort_key('.','b'), "_B", "Arguments '.','b' return '_B'");
+is(C4::ClassSortRoutine::LCC::get_class_sort_key('....','........'), "_______", "Arguments '....','........' return '_______'");
+is(C4::ClassSortRoutine::LCC::get_class_sort_key('.','.'), "__", "Arguments '.','.' return '__'");
-- 
1.7.5.4


From e81cbd7fe0064519fa86f96b2dc4a7800b5e3c67 Mon Sep 17 00:00:00 2001
From: Jono Mingard <reason.koan@gmail.com>
Date: Thu, 19 Jan 2012 14:31:57 +1300
Subject: [PATCH 06/13] Bug 5327 added unit tests for C4/Creators/PDF.pm

Signed-off-by: Chris Hall <chrish@catalyst.net.nz>
---
 t/Creators.t |   33 ++++++++++++++++++++++++++++++++-
 1 files changed, 32 insertions(+), 1 deletions(-)

diff --git a/t/Creators.t b/t/Creators.t
index 5264d32..720aa2c 100755
--- a/t/Creators.t
+++ b/t/Creators.t
@@ -6,9 +6,40 @@
 use strict;
 use warnings;
 
-use Test::More tests => 1;
+use Test::More tests => 15;
 
 BEGIN {
         use_ok('C4::Creators');
+        use_ok('C4::Creators::PDF');
 }
 
+my $pdf_creator = C4::Creators::PDF->new('test.pdf' => '', InitVars => 0);
+ok($pdf_creator, "testing new() works");
+if (-e 'test.pdf') {
+  pass('testing pdf file created');
+}
+else {
+  fail('testing pdf file created');
+}
+
+ok($pdf_creator->Add(""), "testing Add() works");
+ok($pdf_creator->Bookmark({}), "testing Bookmark() works");
+ok($pdf_creator->Compress(1), "testing Compress() works");
+
+is($pdf_creator->Font("H"), "Ft1", "testing Font() works");
+is($pdf_creator->FontSize(), '12', "testing FontSize() is set to 12 by default");
+my @result = $pdf_creator->FontSize(14);
+is($result[0], '14', "testing FontSize() can be set to a different value");
+$pdf_creator->FontSize(); # Reset font size before testing text width etc below
+
+ok($pdf_creator->Page(), "testing Page() works");
+
+is($pdf_creator->StrWidth("test", "H", 12), '19.344', "testing StrWidth() returns correct point width");
+
+@result = $pdf_creator->Text(10, 10, "test");
+is($result[0], '10', "testing Text() writes from a given x-value");
+is($result[1], '29.344', "testing Text() writes to the correct x-value");
+
+ok($pdf_creator->End(), "testing End() works");
+
+unlink 'test.pdf';
-- 
1.7.5.4


From 0618b9db72b548a962c5e235397e1cdb6feb0f13 Mon Sep 17 00:00:00 2001
From: Sam Sanders <sam-sanders@live.com>
Date: Wed, 18 Jan 2012 15:38:52 +1300
Subject: [PATCH 07/13] bug 5327 added unit tests for C4/Ris.pm

Signed-off-by: Chris Hall <chrish@catalyst.net.nz>
---
 t/Ris.t |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/t/Ris.t b/t/Ris.t
index 30157e4..b4126c5 100755
--- a/t/Ris.t
+++ b/t/Ris.t
@@ -6,9 +6,17 @@
 use strict;
 use warnings;
 
-use Test::More tests => 1;
+use Test::More tests => 6;
 
 BEGIN {
         use_ok('C4::Ris');
 }
 
+is(C4::Ris::print_typetag(),undef,'test printing typetag');
+
+is(C4::Ris::print_title(),undef, 'test printing title when print_title is nil');
+
+is(C4::Ris::print_stitle(),undef, 'test printing info from series title field when its nil');
+
+ok((C4::Ris::charconv('hello world'))[0] eq 'hello world', 'testing that it returns what you entered');
+ok(C4::Ris::charconv() == 0, 'testing when charconv is nil');
-- 
1.7.5.4


From 1e2e7b9dd8614dd7729ecdebb6b6c99ad52d602a Mon Sep 17 00:00:00 2001
From: Kate Henderson <kate.h@paradise.net.nz>
Date: Thu, 19 Jan 2012 14:29:53 +1300
Subject: [PATCH 08/13] Bug 5327 added unit tests for C4/Scheduler.pm

Signed-off-by: Chris Hall <chrish@catalyst.net.nz>
---
 t/Scheduler.t |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/t/Scheduler.t b/t/Scheduler.t
index 5fd05b3..f0f02e1 100644
--- a/t/Scheduler.t
+++ b/t/Scheduler.t
@@ -6,9 +6,14 @@
 use strict;
 use warnings;
 
-use Test::More tests => 1;
+use Test::More tests => 6;
 
 BEGIN {
         use_ok('C4::Scheduler');
 }
 
+ok(C4::Scheduler::get_jobs(), "testing get_jobs with no arguments");
+ok(C4::Scheduler::get_at_jobs(), "testing get_at_jobs with no arguments");
+is(C4::Scheduler::get_at_job(), "0", "testing get_at_job returns '0' when given no arguments");
+is(C4::Scheduler::add_at_job(), "", "testing add_at_job with no arguments");
+is(C4::Scheduler::remove_at_job(), undef , "testing remove_at_job returns undef when given no arguments");
-- 
1.7.5.4


From 77a9e9162e54678c545943578f36b46a381485bc Mon Sep 17 00:00:00 2001
From: Sam Sanders <sam-sanders@live.com>
Date: Thu, 19 Jan 2012 17:05:16 +1300
Subject: [PATCH 09/13] added unit tests for C4/Serials.pm

http://bugs.koha-community.org/show_bug.cgi?id=5327
---
 t/db_dependent/Serials.t |   56 +++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 55 insertions(+), 1 deletions(-)

diff --git a/t/db_dependent/Serials.t b/t/db_dependent/Serials.t
index 7097642..33f2ac6 100644
--- a/t/db_dependent/Serials.t
+++ b/t/db_dependent/Serials.t
@@ -9,7 +9,7 @@ use YAML;
 
 use C4::Serials;
 use C4::Debug;
-use Test::More tests => 5;
+use Test::More tests => 33;
 
 BEGIN {
     use_ok('C4::Serials');
@@ -40,3 +40,57 @@ if ($subscriptioninformation->{periodicity} % 16==0){
 my $expirationdate = GetExpirationDate(1) ;
 ok( $expirationdate, "not NULL" );
 $debug && warn "$expirationdate";
+
+is(C4::Serials::GetLateIssues(),"0", 'test getting late issues');
+
+ok(C4::Serials::GetSubscriptionHistoryFromSubscriptionId(), 'test getting history from sub-scription');
+
+ok(C4::Serials::GetSerialStatusFromSerialId(), 'test getting Serial Status From Serial Id');
+
+ok(C4::Serials::GetSerialInformation(), 'test getting Serial Information');
+
+ok(C4::Serials::AddItem2Serial(), 'test adding item to serial');
+
+ok(C4::Serials::UpdateClaimdateIssues(), 'test updating claim date');
+
+ok(C4::Serials::GetFullSubscription(), 'test getting full subscription');
+
+ok(C4::Serials::PrepareSerialsData(), 'test preparing serial data');
+
+ok(C4::Serials::GetSubscriptionsFromBiblionumber(), 'test getting subscriptions form biblio number');
+
+is(C4::Serials::GetSerials(),"0", 'test getting serials when you enter nothing');
+is(C4::Serials::GetSerials2(),"0", 'test getting serials when you enter nothing');
+
+ok(C4::Serials::GetLatestSerials(), 'test getting lastest serials');
+
+is(C4::Serials::GetDistributedTo(),"0", 'test getting distributed when nothing is entered');
+
+is(C4::Serials::GetNextSeq(),"0", 'test getting next seq when you enter nothing');
+
+is(C4::Serials::GetSeq(),undef, 'test getting seq when you enter nothing');
+
+is(C4::Serials::CountSubscriptionFromBiblionumber(),"0", 'test counting subscription when nothing is entered');
+
+is(C4::Serials::ModSubscriptionHistory(),"0", 'test modding subscription history');
+
+is(C4::Serials::ModSerialStatus(),undef, 'test modding serials');
+
+is(C4::Serials::NewIssue(),"0", 'test getting 0 when nothing is entered');
+
+is(C4::Serials::ItemizeSerials(),undef, 'test getting nothing when nothing is entered');
+
+ok(C4::Serials::HasSubscriptionStrictlyExpired(), 'test if the subscriptions has expired');
+is(C4::Serials::HasSubscriptionExpired(),"0", 'test if the subscriptions has expired');
+
+is(C4::Serials::GetLateOrMissingIssues(),"0", 'test getting last or missing issues');
+
+is(C4::Serials::removeMissingIssue(),undef, 'test removing a missing issue');
+
+is(C4::Serials::updateClaim(),undef, 'test updating claim');
+
+is(C4::Serials::getsupplierbyserialid(),undef, 'test getting supplier idea');
+
+is(C4::Serials::check_routing(),"0", 'test checking route');
+
+is(C4::Serials::addroutingmember(),undef, 'test adding route member');
-- 
1.7.5.4


From 66fecdd798fa499e9184c5b70b252d36f4b64235 Mon Sep 17 00:00:00 2001
From: Kate Henderson <kate.h@paradise.net.nz>
Date: Thu, 19 Jan 2012 11:24:00 +1300
Subject: [PATCH 10/13] Bug 5327 added unit tests for C4/Search_PazPar2.pm

Signed-off-by: Chris Hall <chrish@catalyst.net.nz>
---
 t/Search_PazPar2.t |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/t/Search_PazPar2.t b/t/Search_PazPar2.t
index 8d51720..5af0ac4 100755
--- a/t/Search_PazPar2.t
+++ b/t/Search_PazPar2.t
@@ -6,9 +6,17 @@
 use strict;
 use warnings;
 
-use Test::More tests => 1;
+use Test::More tests => 8;
 
 BEGIN {
         use_ok('C4::Search::PazPar2');
 }
 
+my $obj = C4::Search::PazPar2->new();
+ok ($obj, "testing new works");
+is ($obj->init(), "1", "testing init returns '1' when given no arguments");
+is ($obj->search(), "1", "testing search returns '1' when given no arguments");
+is ($obj->stat(), undef, "testing stat returns undef when given no arguments");
+is ($obj->show(), undef, "testing show returns undef when given no arguments");
+is ($obj->record(), undef, "testing record returns undef when given no arguments");
+is ($obj->termlist(), undef, "testing termlist returns undef when given no arguments");
-- 
1.7.5.4


From 37c9ffcf7d12dcd3218fa7956c7a9adf5604a7b2 Mon Sep 17 00:00:00 2001
From: Bart Jorgensen <bart.tj@gmail.com>
Date: Thu, 19 Jan 2012 12:08:58 +1300
Subject: [PATCH 11/13] Bug 5327 added unit tests for C4/TmplToken.pm

Signed-off-by: Chris Hall <chrish@catalyst.net.nz>
---
 t/TmplToken.t |   26 +++++++++++++++++++++++++-
 1 files changed, 25 insertions(+), 1 deletions(-)

diff --git a/t/TmplToken.t b/t/TmplToken.t
index b9f1612..579ee9d 100755
--- a/t/TmplToken.t
+++ b/t/TmplToken.t
@@ -6,7 +6,7 @@
 use strict;
 use warnings;
 use C4::TmplTokenType;
-use Test::More tests => 7;
+use Test::More tests => 19;
 
 BEGIN {
         use_ok('C4::TmplToken');
@@ -20,3 +20,27 @@ ok ($token->pathname eq '/tmp/translate.txt', "Path works");
 
 
 ok ($token->text_p, "text_p works");
+
+is($token-> children(), undef, "testing children returns undef when given argument");
+
+ok($token-> set_children(), "testing set_children with no arguments");
+
+is($token-> parameters_and_fields(), "0", "testing Parameters and fields returns 0 when given argument");
+
+is($token-> anchors(), "0", "testing anchors returns 0 when given argument");
+
+is($token-> form(),undef, "testing form returns undef when given argument");
+
+ok($token-> set_form(), "testing set_form with no arguments");
+
+is($token-> js_data(),undef, "testing form returns undef when given argument");
+
+ok($token-> set_js_data(), "testing set_js_data with no arguments");
+
+is($token-> tag_p(),"", "testing tag_p returns '' when given argument");
+
+is($token-> cdata_p(),"", "testing cdata_p returns '' when given argument");
+
+is($token-> text_parametrized_p(),"", "testing text_parametrized returns '' when given argument");
+
+is($token-> directive_p(),"", "testing directive_p returns '' when given argument");
-- 
1.7.5.4


From 597fabf4f474c52d0c9fc3f9fa9ce0267f6e04e2 Mon Sep 17 00:00:00 2001
From: Connor Dewar <connor.dewar@gmail.com>
Date: Wed, 18 Jan 2012 15:33:43 +1300
Subject: [PATCH 12/13] Bug 5327 Added unit tests for
 C4/SIP/ILS/Transaction/Renew.pm

Signed-off-by: Chris Hall <chrish@catalyst.net.nz>
---
 t/db_dependent/SIP_ILS.t |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/t/db_dependent/SIP_ILS.t b/t/db_dependent/SIP_ILS.t
index daf1c29..ff01f8f 100755
--- a/t/db_dependent/SIP_ILS.t
+++ b/t/db_dependent/SIP_ILS.t
@@ -27,3 +27,7 @@ $transaction2->patron(my $patron2 = ILS::Patron->new("ABCDE12345"));
 ok(!defined $patron2, "patron code: ABCDE12345 is invalid");
 
 ok($transaction->do_renew_all(), "items renewed correctly");
+
+
+my $object = ILS::Transaction::Renew->new();
+is($object->do_renew(), "", "");
-- 
1.7.5.4


From a0c1414f6d7e431dd0c6bc55f0dd11b55951df81 Mon Sep 17 00:00:00 2001
From: Sam Sanders <sam-sanders@live.com>
Date: Thu, 19 Jan 2012 14:15:45 +1300
Subject: [PATCH 13/13] Bug 5327 added tests for C4/Languages.pm

Signed-off-by: Chris Hall <chrish@catalyst.net.nz>
---
 t/Languages.t |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/t/Languages.t b/t/Languages.t
index 9122936..5918d95 100755
--- a/t/Languages.t
+++ b/t/Languages.t
@@ -6,9 +6,14 @@
 use strict;
 use warnings;
 
-use Test::More tests => 1;
+use Test::More tests => 4;
 
 BEGIN {
         use_ok('C4::Languages');
 }
 
+isnt(C4::Languages::_get_themes(), undef, 'testing _get_themes doesnt return undef');
+
+ok(C4::Languages::_get_language_dirs(), 'test getting _get_language_dirs');
+
+is(C4::Languages::accept_language(),undef, 'test that accept_languages returns undef when nothing is entered');
-- 
1.7.5.4