|
Lines 23-34
use Koha::Database;
Link Here
|
| 23 |
|
23 |
|
| 24 |
use t::lib::TestBuilder; |
24 |
use t::lib::TestBuilder; |
| 25 |
|
25 |
|
| 26 |
use Test::More tests => 1; |
26 |
use Test::More tests => 2; |
| 27 |
use Test::Exception; |
27 |
use Test::Exception; |
| 28 |
|
28 |
|
| 29 |
my $schema = Koha::Database->new->schema; |
29 |
my $schema = Koha::Database->new->schema; |
| 30 |
my $builder = t::lib::TestBuilder->new; |
30 |
my $builder = t::lib::TestBuilder->new; |
| 31 |
|
31 |
|
|
|
32 |
subtest 'item relation tests' => sub { |
| 33 |
plan tests => 2; |
| 34 |
|
| 35 |
$schema->storage->txn_begin; |
| 36 |
|
| 37 |
my $item = $builder->build_sample_item(); |
| 38 |
my $transfer = $builder->build_object( |
| 39 |
{ |
| 40 |
class => 'Koha::Item::Transfers', |
| 41 |
value => { |
| 42 |
itemnumber => $item->itemnumber, |
| 43 |
} |
| 44 |
} |
| 45 |
); |
| 46 |
|
| 47 |
my $transfer_item = $transfer->item; |
| 48 |
is( ref( $transfer_item ), 'Koha::Item', 'Koha::Item::Transfer->item should return a Koha::Item' ); |
| 49 |
is( $transfer_item->itemnumber, $item->itemnumber, 'Koha::Item::Tranfer->item should return the correct item' ); |
| 50 |
|
| 51 |
$schema->storage->txn_rollback; |
| 52 |
}; |
| 53 |
|
| 32 |
subtest 'transit tests' => sub { |
54 |
subtest 'transit tests' => sub { |
| 33 |
plan tests => 7; |
55 |
plan tests => 7; |
| 34 |
|
56 |
|
| 35 |
- |
|
|