Bug 18459: Add the Koha::Item->biblioitem method
Test plan: prove t/db_dependent/Koha/Items.t Signed-off-by: Marc Véron <veron@veron.ch> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
This commit is contained in:
parent
2ba4a661d3
commit
6527b3b675
2 changed files with 24 additions and 2 deletions
14
Koha/Item.pm
14
Koha/Item.pm
|
@ -92,6 +92,20 @@ sub biblio {
|
|||
return Koha::Biblio->_new_from_dbic( $biblio_rs );
|
||||
}
|
||||
|
||||
=head3 biblioitem
|
||||
|
||||
my $biblioitem = $item->biblioitem;
|
||||
|
||||
Return the biblioitem record of this item
|
||||
|
||||
=cut
|
||||
|
||||
sub biblioitem {
|
||||
my ( $self ) = @_;
|
||||
my $biblioitem_rs = $self->_result->biblioitem;
|
||||
return Koha::Biblioitem->_new_from_dbic( $biblioitem_rs );
|
||||
}
|
||||
|
||||
=head3 get_transfer
|
||||
|
||||
my $transfer = $item->get_transfer;
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
use Modern::Perl;
|
||||
|
||||
use Test::More tests => 6;
|
||||
use Test::More tests => 7;
|
||||
|
||||
use C4::Circulation;
|
||||
use Koha::Item;
|
||||
|
@ -78,10 +78,18 @@ subtest 'biblio' => sub {
|
|||
plan tests => 2;
|
||||
|
||||
my $biblio = $retrieved_item_1->biblio;
|
||||
is( ref( $biblio ), 'Koha::Biblio', 'Koha::Item->bilio should return a Koha::Biblio' );
|
||||
is( ref( $biblio ), 'Koha::Biblio', 'Koha::Item->biblio should return a Koha::Biblio' );
|
||||
is( $biblio->biblionumber, $retrieved_item_1->biblionumber, 'Koha::Item->biblio should return the correct biblio' );
|
||||
};
|
||||
|
||||
subtest 'biblioitem' => sub {
|
||||
plan tests => 2;
|
||||
|
||||
my $biblioitem = $retrieved_item_1->biblioitem;
|
||||
is( ref( $biblioitem ), 'Koha::Biblioitem', 'Koha::Item->biblioitem should return a Koha::Biblioitem' );
|
||||
is( $biblioitem->biblionumber, $retrieved_item_1->biblionumber, 'Koha::Item->biblioitem should return the correct biblioitem' );
|
||||
};
|
||||
|
||||
$retrieved_item_1->delete;
|
||||
is( Koha::Items->search->count, $nb_of_items + 1, 'Delete should have deleted the item' );
|
||||
|
||||
|
|
Loading…
Reference in a new issue