From e79a6d44c50151cc63a4b58339cb51cb5e7e93bd Mon Sep 17 00:00:00 2001
From: Josef Moravec <josef.moravec@gmail.com>
Date: Thu, 18 May 2017 08:07:47 +0000
Subject: [PATCH] Bug 18606: Add test to t/db_dependent/Koha/Items.t

---
 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 0864825034..cd8f2b7aa9 100644
--- a/t/db_dependent/Koha/Items.t
+++ b/t/db_dependent/Koha/Items.t
@@ -19,12 +19,13 @@
 
 use Modern::Perl;
 
-use Test::More tests => 8;
+use Test::More tests => 9;
 
 use C4::Circulation;
 use Koha::Item;
 use Koha::Items;
 use Koha::Database;
+use Koha::RotatingCollections;
 
 use t::lib::TestBuilder;
 
@@ -118,6 +119,22 @@ subtest 'checkout' => sub {
     is( $checkout, undef, 'Koha::Item->checkout should return undef if there is no *current* checkout on this item' );
 };
 
+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.11.0