From 995485e57409ec5ffff32aea33f6dda642d75b87 Mon Sep 17 00:00:00 2001 From: Connor Dewar Date: Tue, 17 Jan 2012 13:55:03 +1300 Subject: [PATCH 1/4] Bug 5327 added unit tests for C4/ClassSortRoutine/Generic Signed-off-by: Chris Cormack --- t/ClassSortRoutine_Generic.t | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/t/ClassSortRoutine_Generic.t b/t/ClassSortRoutine_Generic.t index d627259f53..128006bff2 100755 --- a/t/ClassSortRoutine_Generic.t +++ b/t/ClassSortRoutine_Generic.t @@ -6,9 +6,19 @@ use strict; use warnings; -use Test::More tests => 1; +use Test::More tests => 3; BEGIN { use_ok('C4::ClassSortRoutine::Generic'); } +my $cn_class = "My class "; +my $cn_item = " hellO"; + +my $cn_sort = C4::ClassSortRoutine::Generic::get_class_sort_key($cn_class, $cn_item); + +is($cn_sort,"MY_CLASS_HELLO","testing cnsort"); + +$cn_sort = C4::ClassSortRoutine::Generic::get_class_sort_key(undef, undef); + +is($cn_sort,"","Testing blank cnsort"); From f053ca0c22fdc0429fdcb1a7a67fde6171c971a9 Mon Sep 17 00:00:00 2001 From: Connor Dewar Date: Tue, 17 Jan 2012 14:32:29 +1300 Subject: [PATCH 2/4] Bug 5327 Added unit tests for C4/ClassSortRoutine/Dewey.pm Signed-off-by: Chris Cormack --- t/ClassSortRoutine_Dewey.t | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/t/ClassSortRoutine_Dewey.t b/t/ClassSortRoutine_Dewey.t index a2d3dc1681..7a4d7f4e4c 100755 --- a/t/ClassSortRoutine_Dewey.t +++ b/t/ClassSortRoutine_Dewey.t @@ -6,9 +6,23 @@ use strict; use warnings; -use Test::More tests => 1; +use Test::More tests => 6; BEGIN { use_ok('C4::ClassSortRoutine::Dewey'); } +my $cn_sort = C4::ClassSortRoutine::Dewey::get_class_sort_key(undef, undef ); +is($cn_sort,"","testing whitespace"); + +$cn_sort = C4::ClassSortRoutine::Dewey::get_class_sort_key("....","....."); +is($cn_sort,"","testing fullstops"); + +$cn_sort = C4::ClassSortRoutine::Dewey::get_class_sort_key("123","456"); +is($cn_sort,"123_456000000000000","testing numbers"); + +$cn_sort = C4::ClassSortRoutine::Dewey::get_class_sort_key("abc123","456"); +is($cn_sort,"ABC_123_456000000000000","testing alphanumeric"); + +$cn_sort = C4::ClassSortRoutine::Dewey::get_class_sort_key("ab c123","45 6"); +is($cn_sort,"AB_C123_45_600000000000000","testing middle whitespace"); From e96c92d077b8fdc4da70781a18c52c2706299254 Mon Sep 17 00:00:00 2001 From: Connor Dewar Date: Tue, 17 Jan 2012 15:40:25 +1300 Subject: [PATCH 3/4] Bug 5327 Added unit tests for C4/Reports.pm Signed-off-by: Katrin Fischer perl t/Reports.t b/t/Reports.t All tests complete successfully. --- t/Reports.t | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/t/Reports.t b/t/Reports.t index 667cb8c880..e28efd682e 100755 --- a/t/Reports.t +++ b/t/Reports.t @@ -6,9 +6,11 @@ use strict; use warnings; -use Test::More tests => 1; +use Test::More tests => 2; BEGIN { use_ok('C4::Reports'); } + +ok(GetDelimiterChoices(),"Testing getting delimeter choices"); #Not testing the value of the output just that it returns something. From dbb29b4042f3e1785dff1ca5aaa351a6340a8183 Mon Sep 17 00:00:00 2001 From: Sam Sanders Date: Tue, 17 Jan 2012 15:37:59 +1300 Subject: [PATCH 4/4] bug 5327 add tests for C4/BackgroundJob.pm Signed-off-by: Katrin Fischer perl t/db_dependent/BackgroundJob.t All tests complete successfully. Note: Test 11 does not tell what it's about, but it has been there before. --- t/db_dependent/BackgroundJob.t | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/t/db_dependent/BackgroundJob.t b/t/db_dependent/BackgroundJob.t index 8106e02523..0afa3158c0 100644 --- a/t/db_dependent/BackgroundJob.t +++ b/t/db_dependent/BackgroundJob.t @@ -7,7 +7,7 @@ use strict; use warnings; use C4::Auth; use CGI; -use Test::More tests => 10; +use Test::More tests => 11; BEGIN { use_ok('C4::BackgroundJob'); @@ -17,8 +17,8 @@ my ($userid, $cookie, $sessionID) = &checkauth($query, 1); #my ($sessionID, $job_name, $job_invoker, $num_work_units) = @_; my $background; diag $sessionID; -ok ($background=C4::BackgroundJob->new($sessionID)); -ok ($background->id); +ok ($background=C4::BackgroundJob->new($sessionID), "making job"); +ok ($background->id, "fetching id number"); $background->name("George"); is ($background->name, "George", "testing name"); @@ -29,12 +29,15 @@ is ($background->invoker, "enjoys", "testing invoker"); $background->progress("testing"); is ($background->progress, "testing", "testing progress"); -ok ($background->status); +ok ($background->status, "testing status"); $background->size("56"); is ($background->size, "56", "testing size"); +ok (!$background->fetch($sessionID, $background->id), "testing fetch"); + + $background->finish("finished"); is ($background->status,'completed', "testing finished"); -ok ($background->results); # Will return undef unless finished \ No newline at end of file +ok ($background->results); #Will return undef unless finished