Browse Source

Bug 24440: ->biblio tests

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
20.05.x
Tomás Cohen Arazi 4 years ago
committed by Martin Renvoize
parent
commit
a905fd8a38
Signed by: martin.renvoize GPG Key ID: 422B469130441A0F
  1. 28
      t/db_dependent/Koha/Acquisition/Order.t

28
t/db_dependent/Koha/Acquisition/Order.t

@ -19,7 +19,7 @@
use Modern::Perl;
use Test::More tests => 7;
use Test::More tests => 8;
use t::lib::TestBuilder;
use t::lib::Mocks;
@ -57,6 +57,32 @@ subtest 'basket() tests' => sub {
$schema->storage->txn_rollback;
};
subtest 'biblio() tests' => sub {
plan tests => 3;
$schema->storage->txn_begin;
my $order = $builder->build_object(
{
class => 'Koha::Acquisition::Orders',
value => { biblionumber => undef }
}
);
is( $order->biblio, undef, 'If no linked biblio, undef is returned' );
# Add and link a biblio to the order
my $biblio = $builder->build_sample_biblio();
$order->set({ biblionumber => $biblio->biblionumber })->store->discard_changes;
my $THE_biblio = $order->biblio;
is( ref($THE_biblio), 'Koha::Biblio', 'Returns a Koha::Biblio object' );
is( $THE_biblio->biblionumber, $biblio->biblionumber, 'It is not cheating about the object' );
$schema->storage->txn_rollback;
};
subtest 'store' => sub {
plan tests => 1;

Loading…
Cancel
Save