From 4e422e6079bb2eb6396e9fe4a68bddffc0d9498e Mon Sep 17 00:00:00 2001 From: Josef Moravec Date: Thu, 18 May 2017 08:07:47 +0000 Subject: [PATCH] Bug 18606: Add test to t/db_dependent/Koha/Items.t Signed-off-by: Kyle M Hall --- t/db_dependent/Koha/Items.t | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/t/db_dependent/Koha/Items.t b/t/db_dependent/Koha/Items.t index 87ebfb3..8f4c804 100644 --- a/t/db_dependent/Koha/Items.t +++ b/t/db_dependent/Koha/Items.t @@ -19,7 +19,7 @@ use Modern::Perl; -use Test::More tests => 9; +use Test::More tests => 10; use Test::Exception; use C4::Circulation; @@ -27,6 +27,7 @@ use Koha::Item; use Koha::Item::Transfer::Limits; use Koha::Items; use Koha::Database; +use Koha::RotatingCollections; use t::lib::TestBuilder; use t::lib::Mocks; @@ -161,6 +162,22 @@ subtest 'can_be_transferred' => sub { 'We get the same result also if we pass the from-library parameter.'); }; +subtest 'rotating_collection' => sub { + plan tests => 2; + + my $collection = Koha::RotatingCollection->new( { + colTitle => 'Collection title', + colDesc => 'Collection description', + } )->store; + + my $item = Koha::Items->find( $new_item_1->itemnumber ); + $collection->add_item( $item ); + my $retrieved_collection = $item->rotating_collection; + + is( ref( $retrieved_collection ), 'Koha::RotatingCollection', 'Koha::Item->rotating_collection should return a Koha::RotatingCollection' ); + is( $retrieved_collection->colId, $collection->colId, 'Koha::Item->rotating_collection should return right collection' ); +}; + $retrieved_item_1->delete; is( Koha::Items->search->count, $nb_of_items + 1, 'Delete should have deleted the item' ); -- 2.1.4