|
Lines 43-49
subtest '->baskets() tests' => sub {
Link Here
|
| 43 |
|
43 |
|
| 44 |
my $vendor = $builder->build_object( { class => 'Koha::Acquisition::Booksellers' } ); |
44 |
my $vendor = $builder->build_object( { class => 'Koha::Acquisition::Booksellers' } ); |
| 45 |
|
45 |
|
| 46 |
is( $vendor->baskets, 0, 'Vendor has no baskets' ); |
46 |
is( $vendor->baskets->count, 0, 'Vendor has no baskets' ); |
| 47 |
|
47 |
|
| 48 |
# Add two baskets |
48 |
# Add two baskets |
| 49 |
my $basket_1_id = C4::Acquisition::NewBasket( $vendor->id, $patron->borrowernumber, 'basketname1' ); |
49 |
my $basket_1_id = C4::Acquisition::NewBasket( $vendor->id, $patron->borrowernumber, 'basketname1' ); |
|
Lines 51-57
subtest '->baskets() tests' => sub {
Link Here
|
| 51 |
|
51 |
|
| 52 |
# Re-fetch vendor |
52 |
# Re-fetch vendor |
| 53 |
$vendor = Koha::Acquisition::Booksellers->find( $vendor->id ); |
53 |
$vendor = Koha::Acquisition::Booksellers->find( $vendor->id ); |
| 54 |
is( $vendor->baskets, 2, 'Vendor has two baskets' ); |
54 |
is( $vendor->baskets->count, 2, 'Vendor has two baskets' ); |
| 55 |
|
55 |
|
| 56 |
$schema->storage->txn_rollback(); |
56 |
$schema->storage->txn_rollback(); |
| 57 |
}; |
57 |
}; |
|
Lines 139-145
subtest '->subscriptions() tests' => sub {
Link Here
|
| 139 |
|
139 |
|
| 140 |
subtest '->contacts() tests' => sub { |
140 |
subtest '->contacts() tests' => sub { |
| 141 |
|
141 |
|
| 142 |
plan tests => 4; |
142 |
plan tests => 3; |
| 143 |
|
143 |
|
| 144 |
$schema->storage->txn_begin(); |
144 |
$schema->storage->txn_begin(); |
| 145 |
|
145 |
|
|
Lines 161-170
subtest '->contacts() tests' => sub {
Link Here
|
| 161 |
|
161 |
|
| 162 |
# Re-fetch vendor |
162 |
# Re-fetch vendor |
| 163 |
$vendor = Koha::Acquisition::Booksellers->find( $vendor->id ); |
163 |
$vendor = Koha::Acquisition::Booksellers->find( $vendor->id ); |
| 164 |
is( $vendor->contacts->count, 2, 'Vendor has two contacts' ); |
164 |
my $contacts = $vendor->contacts; |
| 165 |
foreach my $contact ( $vendor->contacts ) { |
165 |
is( $contacts->count, 2, 'Vendor has two contacts' ); |
| 166 |
is( ref($contact), 'Koha::Acquisition::Bookseller::Contact', 'Type is correct' ); |
166 |
is( ref($contacts), 'Koha::Acquisition::Bookseller::Contacts', 'Type is correct' ); |
| 167 |
} |
|
|
| 168 |
|
167 |
|
| 169 |
$schema->storage->txn_rollback(); |
168 |
$schema->storage->txn_rollback(); |
| 170 |
}; |
169 |
}; |
| 171 |
- |
|
|