|
Lines 24-30
use Koha::DateUtils;
Link Here
|
| 24 |
|
24 |
|
| 25 |
use t::lib::TestBuilder; |
25 |
use t::lib::TestBuilder; |
| 26 |
|
26 |
|
| 27 |
use Test::More tests => 5; |
27 |
use Test::More tests => 7; |
| 28 |
use Test::Exception; |
28 |
use Test::Exception; |
| 29 |
|
29 |
|
| 30 |
my $schema = Koha::Database->new->schema; |
30 |
my $schema = Koha::Database->new->schema; |
|
Lines 52-57
subtest 'item relation tests' => sub {
Link Here
|
| 52 |
$schema->storage->txn_rollback; |
52 |
$schema->storage->txn_rollback; |
| 53 |
}; |
53 |
}; |
| 54 |
|
54 |
|
|
|
55 |
subtest 'from_library relation tests' => sub { |
| 56 |
plan tests => 2; |
| 57 |
|
| 58 |
$schema->storage->txn_begin; |
| 59 |
|
| 60 |
my $library = $builder->build_object( { class => 'Koha::Libraries' } ); |
| 61 |
my $transfer = $builder->build_object( |
| 62 |
{ |
| 63 |
class => 'Koha::Item::Transfers', |
| 64 |
value => { |
| 65 |
frombranch => $library->branchcode, |
| 66 |
} |
| 67 |
} |
| 68 |
); |
| 69 |
|
| 70 |
my $from_library = $transfer->from_library; |
| 71 |
is( ref( $from_library ), 'Koha::Library', 'Koha::Item::Transfer->from_library should return a Koha::Library' ); |
| 72 |
is( $from_library->branchcode, $library->branchcode, 'Koha::Item::Transfer->from_library should return the correct library' ); |
| 73 |
|
| 74 |
$schema->storage->txn_rollback; |
| 75 |
}; |
| 76 |
|
| 77 |
subtest 'to_library relation tests' => sub { |
| 78 |
plan tests => 2; |
| 79 |
|
| 80 |
$schema->storage->txn_begin; |
| 81 |
|
| 82 |
my $library = $builder->build_object( { class => 'Koha::Libraries' } ); |
| 83 |
my $transfer = $builder->build_object( |
| 84 |
{ |
| 85 |
class => 'Koha::Item::Transfers', |
| 86 |
value => { |
| 87 |
tobranch => $library->branchcode, |
| 88 |
} |
| 89 |
} |
| 90 |
); |
| 91 |
|
| 92 |
my $to_library = $transfer->to_library; |
| 93 |
is( ref( $to_library ), 'Koha::Library', 'Koha::Item::Transfer->to_library should return a Koha::Library' ); |
| 94 |
is( $to_library->branchcode, $library->branchcode, 'Koha::Item::Transfer->to_library should return the correct library' ); |
| 95 |
|
| 96 |
$schema->storage->txn_rollback; |
| 97 |
}; |
| 98 |
|
| 55 |
subtest 'transit tests' => sub { |
99 |
subtest 'transit tests' => sub { |
| 56 |
plan tests => 7; |
100 |
plan tests => 7; |
| 57 |
|
101 |
|
| 58 |
- |
|
|