|
Lines 19-32
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 |
use t::lib::TestBuilder; |
23 |
use t::lib::TestBuilder; |
| 24 |
|
24 |
|
| 25 |
use Koha::Database; |
25 |
use Koha::Database; |
|
|
26 |
use Koha::DateUtils qw( dt_from_string ); |
| 26 |
|
27 |
|
| 27 |
my $builder = t::lib::TestBuilder->new; |
28 |
my $builder = t::lib::TestBuilder->new; |
| 28 |
my $schema = Koha::Database->new->schema; |
29 |
my $schema = Koha::Database->new->schema; |
| 29 |
|
30 |
|
|
|
31 |
subtest 'store() tests' => sub { |
| 32 |
plan tests => 2; |
| 33 |
|
| 34 |
$schema->storage->txn_begin; |
| 35 |
|
| 36 |
my $checkout = $builder->build_object( |
| 37 |
{ |
| 38 |
class => 'Koha::Checkouts' |
| 39 |
} |
| 40 |
); |
| 41 |
|
| 42 |
my $new_due = dt_from_string()->add( days => 7 ); |
| 43 |
|
| 44 |
# Update date due for checkout |
| 45 |
$checkout->date_due($new_due)->store(); |
| 46 |
$checkout->discard_changes; |
| 47 |
|
| 48 |
is( dt_from_string($checkout->date_due), $new_due, "Checkout date_due updated" ); |
| 49 |
|
| 50 |
my $item = $checkout->item; |
| 51 |
is( dt_from_string($item->onloan), $new_due->truncate( to => 'day' ), "Item->onloan update with date_due"); |
| 52 |
|
| 53 |
$schema->storage->txn_rollback; |
| 54 |
}; |
| 55 |
|
| 30 |
subtest 'library() tests' => sub { |
56 |
subtest 'library() tests' => sub { |
| 31 |
|
57 |
|
| 32 |
plan tests => 2; |
58 |
plan tests => 2; |
| 33 |
- |
|
|