From e9f69c93b0cdfb93ac870f07efac536641b74070 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Fri, 18 Dec 2020 16:35:21 +0000 Subject: [PATCH] Bug 25757: Add unit tests for item relation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Test plan 1/ Run the unit test Signed-off-by: Kathleen Milne Signed-off-by: Katrin Fischer Signed-off-by: Joonas Kylmälä --- t/db_dependent/Koha/Item/Transfer.t | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/t/db_dependent/Koha/Item/Transfer.t b/t/db_dependent/Koha/Item/Transfer.t index 37b5fbae75..4b094d80cb 100755 --- a/t/db_dependent/Koha/Item/Transfer.t +++ b/t/db_dependent/Koha/Item/Transfer.t @@ -23,12 +23,34 @@ use Koha::Database; use t::lib::TestBuilder; -use Test::More tests => 1; +use Test::More tests => 2; use Test::Exception; my $schema = Koha::Database->new->schema; my $builder = t::lib::TestBuilder->new; +subtest 'item relation tests' => sub { + plan tests => 2; + + $schema->storage->txn_begin; + + my $item = $builder->build_sample_item(); + my $transfer = $builder->build_object( + { + class => 'Koha::Item::Transfers', + value => { + itemnumber => $item->itemnumber, + } + } + ); + + my $transfer_item = $transfer->item; + is( ref( $transfer_item ), 'Koha::Item', 'Koha::Item::Transfer->item should return a Koha::Item' ); + is( $transfer_item->itemnumber, $item->itemnumber, 'Koha::Item::Transfer->item should return the correct item' ); + + $schema->storage->txn_rollback; +}; + subtest 'transit tests' => sub { plan tests => 7; -- 2.20.1