Bug 25757: Add unit tests for item relation
Test plan 1/ Run the unit test Signed-off-by: Kathleen Milne <kathleen.milne@cne-siar.gov.uk> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
parent
74bcdd3765
commit
62e16bbbe4
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue