Lines 19-33
Link Here
|
19 |
|
19 |
|
20 |
use Modern::Perl; |
20 |
use Modern::Perl; |
21 |
|
21 |
|
22 |
use Test::More tests => 1; |
22 |
use Test::More tests => 2; |
23 |
|
23 |
|
24 |
use Koha::Subscription; |
24 |
use Koha::Subscriptions; |
25 |
use Koha::Biblio; |
25 |
use Koha::Biblio; |
26 |
|
26 |
|
|
|
27 |
use t::lib::TestBuilder; |
28 |
|
27 |
my $schema = Koha::Database->new->schema; |
29 |
my $schema = Koha::Database->new->schema; |
28 |
$schema->storage->txn_begin; |
30 |
$schema->storage->txn_begin; |
29 |
|
31 |
|
30 |
subtest 'Koha::Subscription::biblio' => sub { |
32 |
my $builder = t::lib::TestBuilder->new; |
|
|
33 |
|
34 |
subtest 'Koha::Subscription->biblio' => sub { |
31 |
plan tests => 1; |
35 |
plan tests => 1; |
32 |
|
36 |
|
33 |
my $biblio = Koha::Biblio->new()->store(); |
37 |
my $biblio = Koha::Biblio->new()->store(); |
Lines 39-44
subtest 'Koha::Subscription::biblio' => sub {
Link Here
|
39 |
is($b->biblionumber, $biblio->biblionumber, 'Koha::Subscription::biblio returns the correct biblio'); |
43 |
is($b->biblionumber, $biblio->biblionumber, 'Koha::Subscription::biblio returns the correct biblio'); |
40 |
}; |
44 |
}; |
41 |
|
45 |
|
|
|
46 |
subtest 'Koha::Subscription->vendor' => sub { |
47 |
plan tests => 2; |
48 |
my $vendor = $builder->build( { source => 'Aqbookseller' } ); |
49 |
my $subscription = $builder->build( |
50 |
{ |
51 |
source => 'Subscription', |
52 |
value => { aqbooksellerid => $vendor->{id} } |
53 |
} |
54 |
); |
55 |
my $object = Koha::Subscriptions->find( $subscription->{subscriptionid} ); |
56 |
is( ref($object->vendor), 'Koha::Acquisition::Bookseller', 'Koha::Subscription->vendor should return a Koha::Acquisition::Bookseller' ); |
57 |
is( $object->vendor->id, $subscription->{aqbooksellerid}, 'Koha::Subscription->vendor should return the correct vendor' ); |
58 |
}; |
59 |
|
42 |
$schema->storage->txn_rollback; |
60 |
$schema->storage->txn_rollback; |
43 |
|
61 |
|
44 |
1; |
62 |
1; |
45 |
- |
|
|