Bug 25805: Regression tests
authorTomas Cohen Arazi <tomascohen@theke.io>
Thu, 18 Jun 2020 19:54:42 +0000 (16:54 -0300)
committerVictor Grousset/tuxayo <victor@tuxayo.net>
Sun, 26 Jul 2020 15:06:51 +0000 (17:06 +0200)
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 115eeada2b6f959997d21d0e0dd73606f1ca7324)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit c65e76a7c49720cf112c59a0583a9545b34844c4)

Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com>

(cherry picked from commit 4a3486a7bcc06b05b664a69ba5e977988e7897e6)
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>

t/db_dependent/SIP/Message.t

index bc8e87a..0aa4b7b 100755 (executable)
@@ -21,7 +21,7 @@
 # along with Koha; if not, see <http://www.gnu.org/licenses>.
 
 use Modern::Perl;
-use Test::More tests => 5;
+use Test::More tests => 6;
 use Test::MockObject;
 use Test::MockModule;
 use Test::Warn;
@@ -82,6 +82,41 @@ subtest 'Test hold_patron_bcode' => sub {
     $schema->storage->txn_rollback;
 };
 
+subtest 'hold_patron_name() tests' => sub {
+
+    plan tests => 2;
+
+    my $schema = Koha::Database->new->schema;
+    $schema->storage->txn_begin;
+
+    my $builder = t::lib::TestBuilder->new();
+
+    my $branchcode = $builder->build({ source => 'Branch' })->{branchcode};
+    my ( $response, $findpatron );
+    my $mocks = create_mocks( \$response, \$findpatron, \$branchcode );
+
+    my $item = $builder->build_sample_item(
+        {
+            damaged       => 0,
+            withdrawn     => 0,
+            itemlost      => 0,
+            restricted    => 0,
+            homebranch    => $branchcode,
+            holdingbranch => $branchcode
+        }
+    );
+
+    my $server = { ils => $mocks->{ils} };
+    my $sip_item = C4::SIP::ILS::Item->new( $item->barcode );
+
+    is( $sip_item->hold_patron_name, q{}, "SIP item with no hold returns empty string for patron name" );
+
+    my $resp .= C4::SIP::Sip::maybe_add( FID_CALL_NUMBER, $sip_item->hold_patron_name, $server );
+    is( $resp, q{}, "maybe_add returns empty string for SIP item with no hold returns empty string" );
+
+    $schema->storage->txn_rollback;
+};
+
 subtest 'Lastseen response' => sub {
 
     my $schema = Koha::Database->new->schema;