Merge remote-tracking branch 'origin/new/bug_5327'

This commit is contained in:
Paul Poulain 2012-01-31 17:30:28 +01:00
commit d508f0244b
13 changed files with 191 additions and 12 deletions

View file

@ -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");

View file

@ -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");

View file

@ -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 '__'");

View file

@ -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';

View file

@ -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');

View file

@ -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');

View file

@ -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');

10
t/Ris.t
View file

@ -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');

View file

@ -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");

View file

@ -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");

View file

@ -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");

View file

@ -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(), "", "");

View file

@ -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');