From 49a5970ab455a9f9306dbc2cca83166e64c8ad84 Mon Sep 17 00:00:00 2001 From: Chris Hall Date: Tue, 22 Nov 2011 10:08:02 +1300 Subject: [PATCH 1/2] Added reference case to Boolean.pm unit test --- t/Boolean.t | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/t/Boolean.t b/t/Boolean.t index fb3b0bf..af5c8b7 100755 --- a/t/Boolean.t +++ b/t/Boolean.t @@ -19,3 +19,4 @@ is( true_p('YES'), '1', 'verified case insensitivity' ); is( true_p(undef), undef, 'recognizes undefined as not boolean' ); is( true_p('foo'), undef, 'recognizes \'foo\' as not boolean' ); +is( true_p([]), undef, 'recognizes a reference as not a boolean' ); -- 1.7.4.1 From 6dd9df1b0ff6f24fe6ed0c91078fb393f3ba26b9 Mon Sep 17 00:00:00 2001 From: Chris Hall Date: Tue, 22 Nov 2011 12:19:55 +1300 Subject: [PATCH 2/2] Unit tests for C4/Exteral/BakerTaylor.pm --- t/db_dependent/External_BakerTaylor.t | 28 ++++++++++++++++++++++++---- 1 files changed, 24 insertions(+), 4 deletions(-) diff --git a/t/db_dependent/External_BakerTaylor.t b/t/db_dependent/External_BakerTaylor.t index fdccaee..e6e6118 100755 --- a/t/db_dependent/External_BakerTaylor.t +++ b/t/db_dependent/External_BakerTaylor.t @@ -1,14 +1,34 @@ #!/usr/bin/perl -# -# This Koha test module is a stub! -# Add more tests here!!! + +# some simple tests of the elements of C4::External::BakerTaylor that do not require a valid username and password use strict; use warnings; -use Test::More tests => 1; +use Test::More tests => 9; BEGIN { use_ok('C4::External::BakerTaylor'); } +# for testing, to avoid using C4::Context +my $username="testing_username"; +my $password="testing_password"; + +# taken from C4::External::BakerTaylor::initialize +my $image_url = "http://contentcafe2.btol.com/ContentCafe/Jacket.aspx?UserID=$username&Password=$password&Options=Y&Return=T&Type=S&Value="; + +# test without initializing +is( C4::External::BakerTaylor::image_url(), undef, "testing image url pre initilization"); +is( C4::External::BakerTaylor::link_url(), undef, "testing link url pre initilization"); +is( C4::External::BakerTaylor::content_cafe_url(""), undef, "testing content cafe url pre initilization"); +is( C4::External::BakerTaylor::http_jacket_link(""), undef, "testing http jacket link pre initilization"); +is( C4::External::BakerTaylor::availability(""), undef, "testing availability pre initilization"); + +# intitialize +C4::External::BakerTaylor::initialize($username, $password, "link_url"); + +# testing basic results +is( C4::External::BakerTaylor::image_url("aa"), $image_url."aa", "testing image url construction"); +is( C4::External::BakerTaylor::link_url("bb"), "link_urlbb", "testing link url construction"); +is( C4::External::BakerTaylor::content_cafe_url("cc"), "http://contentcafe2.btol.com/ContentCafeClient/ContentCafe.aspx?UserID=$username&Password=$password&Options=Y&ItemKey=cc", "testing content cafe url construction"); -- 1.7.4.1