Lines 19-25
use Modern::Perl;
Link Here
|
19 |
|
19 |
|
20 |
use CGI qw ( -utf8 ); |
20 |
use CGI qw ( -utf8 ); |
21 |
|
21 |
|
22 |
use Test::More tests => 9; |
22 |
use Test::More tests => 10; |
23 |
use Test::MockModule; |
23 |
use Test::MockModule; |
24 |
use t::lib::Mocks; |
24 |
use t::lib::Mocks; |
25 |
use t::lib::TestBuilder; |
25 |
use t::lib::TestBuilder; |
Lines 544-549
subtest 'Holds test for branch transfer limits' => sub {
Link Here
|
544 |
$schema->storage->txn_rollback; |
544 |
$schema->storage->txn_rollback; |
545 |
}; |
545 |
}; |
546 |
|
546 |
|
|
|
547 |
subtest 'GetPickupLocation test' => sub { |
548 |
|
549 |
plan tests => 5; |
550 |
|
551 |
$schema->storage->txn_begin; |
552 |
|
553 |
my $pickup_branch = $builder->build( |
554 |
{ |
555 |
source => 'Branch', |
556 |
value => { |
557 |
pickup_location => 1, |
558 |
} |
559 |
} |
560 |
); |
561 |
|
562 |
my $biblio = $builder->build({ |
563 |
source => 'Biblio', |
564 |
}); |
565 |
my $biblioitem = $builder->build({ |
566 |
source => 'Biblioitem', |
567 |
value => { |
568 |
biblionumber => $biblio->{biblionumber}, |
569 |
} |
570 |
}); |
571 |
my $item = $builder->build({ |
572 |
source => 'Item', |
573 |
value => { |
574 |
homebranch => $pickup_branch->{branchcode}, |
575 |
holdingbranch => $pickup_branch->{branchcode}, |
576 |
biblionumber => $biblio->{biblionumber}, |
577 |
} |
578 |
}); |
579 |
|
580 |
my $patron = $builder->build({ |
581 |
source => 'Borrower', |
582 |
}); |
583 |
|
584 |
my $query = new CGI; |
585 |
|
586 |
my $reply = C4::ILSDI::Services::GetPickupLocation( $query ); |
587 |
is( $reply->{error}, 'PatronNotFound', "Patron not found" ); |
588 |
|
589 |
$query->param( 'patron_id', $patron->{borrowernumber}); |
590 |
$reply = C4::ILSDI::Services::GetPickupLocation( $query ); |
591 |
is( $reply->{error}, 'MissingParameter', 'Id type undefined' ); |
592 |
|
593 |
$query->param( 'id_type', 'bib'); |
594 |
$query->param( 'id', '105799999' ); |
595 |
$reply = C4::ILSDI::Services::GetPickupLocation( $query ); |
596 |
is( $reply->{error}, 'RecordNotFound', 'Record not found' ); |
597 |
|
598 |
$query->param( 'id', $biblio->{biblionumber}); |
599 |
$reply = C4::ILSDI::Services::GetPickupLocation( $query ); |
600 |
is( $reply->{error}, undef, 'no error' ); |
601 |
is( defined $reply->{library}, 1, 'got branchcode' ); |
602 |
|
603 |
$schema->storage->txn_rollback; |
604 |
}; |
605 |
|
547 |
subtest 'GetRecords' => sub { |
606 |
subtest 'GetRecords' => sub { |
548 |
|
607 |
|
549 |
plan tests => 1; |
608 |
plan tests => 1; |
550 |
- |
|
|