|
Lines 19-25
Link Here
|
| 19 |
|
19 |
|
| 20 |
use Modern::Perl; |
20 |
use Modern::Perl; |
| 21 |
|
21 |
|
| 22 |
use Test::More tests => 5; |
22 |
use Test::More tests => 6; |
| 23 |
use t::lib::TestBuilder; |
23 |
use t::lib::TestBuilder; |
| 24 |
use t::lib::Mocks; |
24 |
use t::lib::Mocks; |
| 25 |
|
25 |
|
|
Lines 109-114
subtest 'basket_group' => sub {
Link Here
|
| 109 |
$schema->storage->txn_rollback; |
109 |
$schema->storage->txn_rollback; |
| 110 |
}; |
110 |
}; |
| 111 |
|
111 |
|
|
|
112 |
subtest 'creator() tests' => sub { |
| 113 |
|
| 114 |
plan tests => 4; |
| 115 |
|
| 116 |
$schema->storage->txn_begin; |
| 117 |
|
| 118 |
my $basket = $builder->build_object( |
| 119 |
{ |
| 120 |
class => 'Koha::Acquisition::Baskets', |
| 121 |
value => { authorisedby => undef } |
| 122 |
} |
| 123 |
); |
| 124 |
|
| 125 |
is( $basket->creator, undef, 'Undef is handled as expected' ); |
| 126 |
|
| 127 |
my $patron = $builder->build_object({ class => 'Koha::Patrons' }); |
| 128 |
$basket->authorisedby( $patron->borrowernumber )->store->discard_changes; |
| 129 |
|
| 130 |
my $creator = $basket->creator; |
| 131 |
is( ref($creator), 'Koha::Patron', 'Return type is correct' ); |
| 132 |
is( $creator->borrowernumber, $patron->borrowernumber, 'Returned object is the right one' ); |
| 133 |
|
| 134 |
# Delete the patron |
| 135 |
$patron->delete; |
| 136 |
|
| 137 |
is( $basket->creator, undef, 'Undef is handled as expected' ); |
| 138 |
|
| 139 |
$schema->storage->txn_rollback; |
| 140 |
}; |
| 141 |
|
| 112 |
subtest 'to_api() tests' => sub { |
142 |
subtest 'to_api() tests' => sub { |
| 113 |
|
143 |
|
| 114 |
plan tests => 6; |
144 |
plan tests => 6; |
| 115 |
- |
|
|